Skip to content

Add support for scheduleCustomizations in the rule deployment resource. - #18364

Merged
SirGitsalot merged 2 commits into
GoogleCloudPlatform:mainfrom
rzalog:chronicle-rule-deployment-rzalog-customizable-schedules-updates
Aug 7, 2026
Merged

Add support for scheduleCustomizations in the rule deployment resource.#18364
SirGitsalot merged 2 commits into
GoogleCloudPlatform:mainfrom
rzalog:chronicle-rule-deployment-rzalog-customizable-schedules-updates

Conversation

@rzalog

@rzalog rzalog commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

Add schedule_customizations field to RuleDeployment resource.

This is for the customizable schedules feature, which is launching to GA soon.

There were two difficulties in updating the RuleDeployment resource.

Problem 1: Bad terraform interaction with backwards compatibility behaviors

With the release of customizable schedules we've added additional restrictions on which run frequencies are allowed for which rules. However, because of this, we run into a "permadiff" problem:

  • Multi-event rule is currently HOURLY and the user updates their HCL for that rule to LIVE.
  • Terraform sees a diff between current state (HOURLY) and requested state (LIVE).
  • Terraform sends an UpdateRuleDeployment request with run_frequency=LIVE.
  • Backend updates saved run frequency to LIVE_CUSTOMIZABLE.
  • Now on the second terraform run, terraform again sees a diff between current state (LIVE_CUSTOMIZABLE) and requested state (LIVE). So it again sends a request. Terraform calls this a permadiff.
  • Terraform will keep sending needless requests and eat through API quotas.

A similar problem happens with single-event rules.

We can mostly solve the problem using the diff suppression function. However, we have one edge case where the user has a LIVE (legacy run frequency) multi-event rule, and tries to update to HOURLY or DAILY. In that case, we will silently suppress the diff because of the single-event permadiff logic. There does not seem to be a good way around this because we can't figure out the parent rule resource rule_type corresponding to the rule deployment.

Added tests for this. I also tested manually since some of the logic depends on feature flags being flipped which we can't replicate in the basic terraform unit tests.

So to help with this, we noted a warning in the terraform docs to suggest people to start using the new customizable run frequencies. We will also add warnings to our normal API docs.

Problem 2: The run_frequency and schedule_customizations fields share a field mask

This is for the customizable schedules feature, which is launching to GA soon. In addition to the typical boilerplate of adding a new field, we had to add special logic to the custom_create and pre_update handlers to address two problems:

This causes two related issues:

  1. The scheduleCustomizations field does not have its own update mask field. Instead, it uses the runFrequency update mask field. So, if we want to update scheduleCustomizations, we have to add the runFrequency update mask if it's not already there.
  2. Because scheduleCustomizations and runFrequency share the same update mask field, they are always updated together. By default terraform won't add runFrequency or scheduleCustomizations if either did not change. But because they will be updated together, we still need to include the field that did not change into the request, or it will revert back to the default, unspecified value.

We added special logic to the custom_create and pre_update handlers to handle this. Added test cases to catch these edge cases. There is no user-facing impact of this change, unlike for problem 1.

I also removed the logic that removes runFrequency from the updateMask. This is no longer needed because we made run frequency updates idempotent in Feb 2026.

Other changes

  • Removed the logic that removes runFrequency from the updateMask. This is not needed because run_frequency updates are now idempotent, which fixes the issue with Chronicle Rule deployment issue hashicorp/terraform-provider-google#21347.
  • I turned on the feature flag for the customizable schedules feature in all 3 CI secops tenants, which is needed for the VCR tests to record and pass correctly.

Release Note Template for Downstream PRs (will be copied)

chronicle: Added `schedule_customizations` field to `RuleDeployment` resource.

@modular-magician

modular-magician commented Jul 22, 2026

Copy link
Copy Markdown
Collaborator

Hi there, I'm the Modular magician. I've detected the following information about your changes for commit 1da9c0c:

Diff report

Your PR generated the following diffs in downstream repositories:

Repository Diff Link Changes
google provider View Diff 5 files changed, 495 insertions(+), 21 deletions(-)
google-beta provider View Diff 5 files changed, 495 insertions(+), 21 deletions(-)
terraform-google-conversion View Diff 1 file changed, 43 insertions(+)

Test report

Analytics

Total Tests Passed Skipped Affected
56 52 1 3
Affected Service Packages
  • chronicle

Learn how VCR tests work


Step 1: Replaying Mode

Action taken

Found 3 affected test(s) by replaying old test recordings. Starting RECORDING based on the most recent commit.

Click here to see the affected tests
  • TestAccChronicleRuleDeployment_chronicleRuledeploymentBasicExample
  • TestAccChronicleRuleDeployment_chronicleRuledeploymentBasicExample_update
  • TestAccChronicleRuleDeployment_chronicleRuledeploymentScheduleCustomizationsExample

View the replaying VCR build log


Step 2: Recording Mode

Recording Mode Replaying Rerun Test Name
✅ Log TestAccChronicleRuleDeployment_chronicleRuledeploymentBasicExample
✅ Log TestAccChronicleRuleDeployment_chronicleRuledeploymentBasicExample_update
❌ Error · Log - TestAccChronicleRuleDeployment_chronicleRuledeploymentScheduleCustomizationsExample

Caution

Issues requiring attention before PR completion

🔴 Initial Recording Failed: Some tests failed during the recording step. See the table above for details.

Please address these issues to complete your PR. If you believe these detections are incorrect or unrelated to your change, please raise the concern with your reviewer.

View the recording VCR build log or the debug logs folder for detailed results.

@rzalog, @ankitgoyal0301 VCR tests complete for 1da9c0c!

@rzalog

rzalog commented Jul 30, 2026

Copy link
Copy Markdown
Contributor Author

@modular-magician rerun vcr

@rzalog

rzalog commented Jul 30, 2026

Copy link
Copy Markdown
Contributor Author

/gcbrun

@rzalog
rzalog force-pushed the chronicle-rule-deployment-rzalog-customizable-schedules-updates branch from b6d028b to 1ad0c1f Compare August 3, 2026 18:26
@modular-magician

modular-magician commented Aug 3, 2026

Copy link
Copy Markdown
Collaborator

Hi there, I'm the Modular magician. I've detected the following information about your changes for commit 1ad0c1f:

Diff report

Your PR generated the following diffs in downstream repositories:

Repository Diff Link Changes
google provider View Diff 5 files changed, 645 insertions(+), 21 deletions(-)
google-beta provider View Diff 5 files changed, 645 insertions(+), 21 deletions(-)
terraform-google-conversion View Diff 1 file changed, 61 insertions(+)

Test report

Analytics

Total Tests Passed Skipped Affected
58 54 1 3
Affected Service Packages
  • chronicle

Learn how VCR tests work


Step 1: Replaying Mode

Action taken

Found 3 affected test(s) by replaying old test recordings. Starting RECORDING based on the most recent commit.

Click here to see the affected tests
  • TestAccChronicleRuleDeployment_chronicleRuledeploymentLegacyRunFrequencyDiffSuppressedExample
  • TestAccChronicleRuleDeployment_chronicleRuledeploymentScheduleCustomizationsExample
  • TestAccChronicleRuleDeployment_chronicleRuledeploymentSingleEventDiffSuppressedExample

View the replaying VCR build log


Step 2: Recording Mode

Recording Mode Replaying Rerun Test Name
✅ Log TestAccChronicleRuleDeployment_chronicleRuledeploymentLegacyRunFrequencyDiffSuppressedExample
✅ Log TestAccChronicleRuleDeployment_chronicleRuledeploymentSingleEventDiffSuppressedExample
❌ Error · Log - TestAccChronicleRuleDeployment_chronicleRuledeploymentScheduleCustomizationsExample

Caution

Issues requiring attention before PR completion

🔴 Initial Recording Failed: Some tests failed during the recording step. See the table above for details.

Please address these issues to complete your PR. If you believe these detections are incorrect or unrelated to your change, please raise the concern with your reviewer.

View the recording VCR build log or the debug logs folder for detailed results.

@rzalog, @ankitgoyal0301 VCR tests complete for 1ad0c1f!

@modular-magician

modular-magician commented Aug 3, 2026

Copy link
Copy Markdown
Collaborator

Hi there, I'm the Modular magician. I've detected the following information about your changes for commit 27cf147:

Diff report

Your PR generated the following diffs in downstream repositories:

Repository Diff Link Changes
google provider View Diff 5 files changed, 645 insertions(+), 21 deletions(-)
google-beta provider View Diff 5 files changed, 645 insertions(+), 21 deletions(-)
terraform-google-conversion View Diff 1 file changed, 61 insertions(+)

Test report

Analytics

Total Tests Passed Skipped Affected
58 54 1 3
Affected Service Packages
  • chronicle

Learn how VCR tests work


Step 1: Replaying Mode

Action taken

Found 3 affected test(s) by replaying old test recordings. Starting RECORDING based on the most recent commit.

Click here to see the affected tests
  • TestAccChronicleRuleDeployment_chronicleRuledeploymentLegacyRunFrequencyDiffSuppressedExample
  • TestAccChronicleRuleDeployment_chronicleRuledeploymentScheduleCustomizationsExample
  • TestAccChronicleRuleDeployment_chronicleRuledeploymentSingleEventDiffSuppressedExample

View the replaying VCR build log


Step 2: Recording Mode

Recording Mode Replaying Rerun Test Name
✅ Log TestAccChronicleRuleDeployment_chronicleRuledeploymentLegacyRunFrequencyDiffSuppressedExample
✅ Log TestAccChronicleRuleDeployment_chronicleRuledeploymentSingleEventDiffSuppressedExample
❌ Error · Log - TestAccChronicleRuleDeployment_chronicleRuledeploymentScheduleCustomizationsExample

Caution

Issues requiring attention before PR completion

🔴 Initial Recording Failed: Some tests failed during the recording step. See the table above for details.

Please address these issues to complete your PR. If you believe these detections are incorrect or unrelated to your change, please raise the concern with your reviewer.

View the recording VCR build log or the debug logs folder for detailed results.

@rzalog, @ankitgoyal0301 VCR tests complete for 27cf147!

@modular-magician

modular-magician commented Aug 3, 2026

Copy link
Copy Markdown
Collaborator

Hi there, I'm the Modular magician. I've detected the following information about your changes for commit 8c530e2:

Diff report

Your PR generated the following diffs in downstream repositories:

Repository Diff Link Changes
google provider View Diff 5 files changed, 645 insertions(+), 21 deletions(-)
google-beta provider View Diff 5 files changed, 645 insertions(+), 21 deletions(-)
terraform-google-conversion View Diff 1 file changed, 61 insertions(+)

Test report

Analytics

Total Tests Passed Skipped Affected
58 56 1 1
Affected Service Packages
  • chronicle

Learn how VCR tests work


Step 1: Replaying Mode

Action taken

Found 1 affected test(s) by replaying old test recordings. Starting RECORDING based on the most recent commit.

Click here to see the affected tests
  • TestAccChronicleRuleDeployment_chronicleRuledeploymentScheduleCustomizationsExample

View the replaying VCR build log


Step 2: Recording Mode

Recording Mode Replaying Rerun Test Name
✅ Log TestAccChronicleRuleDeployment_chronicleRuledeploymentScheduleCustomizationsExample

🟢 All tests passed!

View the recording VCR build log or the debug logs folder for detailed results.

@rzalog, @ankitgoyal0301 VCR tests complete for 8c530e2!

@rzalog
rzalog force-pushed the chronicle-rule-deployment-rzalog-customizable-schedules-updates branch from 8c530e2 to 1ad0c1f Compare August 3, 2026 20:08
@modular-magician

modular-magician commented Aug 3, 2026

Copy link
Copy Markdown
Collaborator

Hi there, I'm the Modular magician. I've detected the following information about your changes for commit 1ad0c1f:

Diff report

Your PR generated the following diffs in downstream repositories:

Repository Diff Link Changes
google provider View Diff 5 files changed, 645 insertions(+), 21 deletions(-)
google-beta provider View Diff 5 files changed, 645 insertions(+), 21 deletions(-)
terraform-google-conversion View Diff 1 file changed, 61 insertions(+)

Test report

Analytics

Total Tests Passed Skipped Affected
58 57 1 0
Affected Service Packages
  • chronicle

Learn how VCR tests work


Step 1: Replaying Mode

🟢 All tests passed in Replaying mode! No Recording was needed.

View the replaying VCR build log

@rzalog, @ankitgoyal0301 VCR tests complete for 1ad0c1f!

@rzalog
rzalog marked this pull request as ready for review August 3, 2026 21:17
@github-actions
github-actions Bot requested a review from SirGitsalot August 3, 2026 21:18
@github-actions

github-actions Bot commented Aug 3, 2026

Copy link
Copy Markdown

Googlers: For automatic test runs see go/terraform-auto-test-runs.

@SirGitsalot, a repository maintainer, has been assigned to review your changes. If you have not received review feedback within 2 business days, please leave a comment on this PR asking them to take a look.

You can help make sure that review is quick by doing a self-review and by running impacted tests locally.

Comment thread mmv1/products/chronicle/RuleDeployment.yaml Outdated
Comment thread mmv1/products/chronicle/RuleDeployment.yaml Outdated
Comment thread mmv1/templates/terraform/constants/chronicle_rule_deployment.go.tmpl Outdated
@modular-magician

modular-magician commented Aug 4, 2026

Copy link
Copy Markdown
Collaborator

Hi there, I'm the Modular magician. I've detected the following information about your changes for commit 1d876b1:

Diff report

Your PR generated the following diffs in downstream repositories:

Repository Diff Link Changes
google provider View Diff 5 files changed, 713 insertions(+), 21 deletions(-)
google-beta provider View Diff 5 files changed, 713 insertions(+), 21 deletions(-)
terraform-google-conversion View Diff 1 file changed, 62 insertions(+)

Test report

Analytics

Total Tests Passed Skipped Affected
59 57 1 1
Affected Service Packages
  • chronicle

Learn how VCR tests work


Step 1: Replaying Mode

Action taken

Found 1 affected test(s) by replaying old test recordings. Starting RECORDING based on the most recent commit.

Click here to see the affected tests
  • TestAccChronicleRuleDeployment_chronicleRuledeploymentDailyDiffSuppressedExample

View the replaying VCR build log


Step 2: Recording Mode

Recording Mode Replaying Rerun Test Name
❌ Error · Log - TestAccChronicleRuleDeployment_chronicleRuledeploymentDailyDiffSuppressedExample

Caution

Issues requiring attention before PR completion

🔴 Initial Recording Failed: Some tests failed during the recording step. See the table above for details.

Please address these issues to complete your PR. If you believe these detections are incorrect or unrelated to your change, please raise the concern with your reviewer.

View the recording VCR build log or the debug logs folder for detailed results.

@rzalog, @SirGitsalot, @ankitgoyal0301 VCR tests complete for 1d876b1!

@rzalog
rzalog force-pushed the chronicle-rule-deployment-rzalog-customizable-schedules-updates branch from 1d876b1 to 87ad968 Compare August 4, 2026 17:45
@rzalog
rzalog force-pushed the chronicle-rule-deployment-rzalog-customizable-schedules-updates branch from 87ad968 to 29f088c Compare August 4, 2026 17:54
@modular-magician

modular-magician commented Aug 4, 2026

Copy link
Copy Markdown
Collaborator

Hi there, I'm the Modular magician. I've detected the following information about your changes for commit 87ad968:

Diff report

Your PR generated the following diffs in downstream repositories:

Repository Diff Link Changes
google provider View Diff 5 files changed, 719 insertions(+), 21 deletions(-)
google-beta provider View Diff 5 files changed, 719 insertions(+), 21 deletions(-)
terraform-google-conversion View Diff 1 file changed, 62 insertions(+)

Test report

Analytics

Total Tests Passed Skipped Affected
59 57 1 1
Affected Service Packages
  • chronicle

Learn how VCR tests work


Step 1: Replaying Mode

Action taken

Found 1 affected test(s) by replaying old test recordings. Starting RECORDING based on the most recent commit.

Click here to see the affected tests
  • TestAccChronicleRuleDeployment_chronicleRuledeploymentDailyDiffSuppressedExample

View the replaying VCR build log


Step 2: Recording Mode

Recording Mode Replaying Rerun Test Name
❌ Error · Log - TestAccChronicleRuleDeployment_chronicleRuledeploymentDailyDiffSuppressedExample

Caution

Issues requiring attention before PR completion

🔴 Initial Recording Failed: Some tests failed during the recording step. See the table above for details.

Please address these issues to complete your PR. If you believe these detections are incorrect or unrelated to your change, please raise the concern with your reviewer.

View the recording VCR build log or the debug logs folder for detailed results.

@rzalog, @SirGitsalot, @ankitgoyal0301 VCR tests complete for 87ad968!

@modular-magician

modular-magician commented Aug 4, 2026

Copy link
Copy Markdown
Collaborator

Hi there, I'm the Modular magician. I've detected the following information about your changes for commit 29f088c:

Diff report

Your PR generated the following diffs in downstream repositories:

Repository Diff Link Changes
google provider View Diff 5 files changed, 652 insertions(+), 21 deletions(-)
google-beta provider View Diff 5 files changed, 652 insertions(+), 21 deletions(-)
terraform-google-conversion View Diff 1 file changed, 62 insertions(+)

Test report

Analytics

Total Tests Passed Skipped Affected
58 57 1 0
Affected Service Packages
  • chronicle

Learn how VCR tests work


Step 1: Replaying Mode

🟢 All tests passed in Replaying mode! No Recording was needed.

View the replaying VCR build log

@rzalog, @SirGitsalot, @ankitgoyal0301 VCR tests complete for 29f088c!

@rzalog
rzalog force-pushed the chronicle-rule-deployment-rzalog-customizable-schedules-updates branch from 29f088c to 8bea50b Compare August 4, 2026 18:33
@modular-magician

modular-magician commented Aug 4, 2026

Copy link
Copy Markdown
Collaborator

Hi there, I'm the Modular magician. I've detected the following information about your changes for commit 8bea50b:

Diff report

Your PR generated the following diffs in downstream repositories:

Repository Diff Link Changes
google provider View Diff 5 files changed, 652 insertions(+), 21 deletions(-)
google-beta provider View Diff 5 files changed, 652 insertions(+), 21 deletions(-)
terraform-google-conversion View Diff 1 file changed, 62 insertions(+)

Test report

Analytics

Total Tests Passed Skipped Affected
58 57 1 0
Affected Service Packages
  • chronicle

Learn how VCR tests work


Step 1: Replaying Mode

🟢 All tests passed in Replaying mode! No Recording was needed.

View the replaying VCR build log

@rzalog, @SirGitsalot, @ankitgoyal0301 VCR tests complete for 8bea50b!

@github-actions

github-actions Bot commented Aug 6, 2026

Copy link
Copy Markdown

@SirGitsalot This PR has been waiting for review for 3 weekdays. Please take a look! Use the label disable-review-reminders to disable these notifications.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants