Skip to content

Fixes issue #21346 related to google_chronicle_rule_deployment resource #13080

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conversation

ankitgoyal0301
Copy link
Contributor

@ankitgoyal0301 ankitgoyal0301 commented Feb 14, 2025

Release Note Template for Downstream PRs (will be copied)

See Write release notes for guidance.

chronicle: fixed bug setting `enabled` on creation in `google_chronicle_rule_deployment`

Copy link

Hello! I am a robot. Tests will require approval from a repository maintainer to run.

@slevenick, 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.

@modular-magician
Copy link
Collaborator

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

Diff report

Your PR generated some diffs in downstreams - here they are.

google provider: Diff ( 1 file changed, 22 insertions(+))
google-beta provider: Diff ( 3 files changed, 186 insertions(+), 39 deletions(-))

@ankitgoyal0301
Copy link
Contributor Author

Some more context on the PR:
The problem here was that ruledeployment is singleton and created along with the rules resource (even before we actually make ruledeployment call via terraform). And we don't have a create method for that explicitly.

Currently, for terraform to know about it, we make a PATCH call (underneath what we call the terraform's create call - first call made by terraform for ruledeployment resource). This makes terraform aware of what the state of resource is. So the issues addressed in the attached github issue were due to this reason.

As a fix, I have added custom create code to it, which basically reads the ruledeployment resource first (before the PATCH call), and then compares the user terraform code with the current state of the resource, and hence only sends PATCH calls for the updates that the user makes. This resolves the issue specified in the issue (enabled is already false, OR run_frequency is already LIVE) because we only make the PATCH call for the differences between the user terraform code and ruledeployment state.

@modular-magician
Copy link
Collaborator

Tests analytics

Total tests: 21
Passed tests: 17
Skipped tests: 1
Affected tests: 3

Click here to see the affected service packages
  • chronicle

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_chronicleRuledeploymentDisabledExample

Get to know how VCR tests work

@modular-magician
Copy link
Collaborator

🟢 Tests passed during RECORDING mode:
TestAccChronicleRuleDeployment_chronicleRuledeploymentBasicExample [Debug log]
TestAccChronicleRuleDeployment_chronicleRuledeploymentBasicExample_update [Debug log]
TestAccChronicleRuleDeployment_chronicleRuledeploymentDisabledExample [Debug log]

🟢 No issues found for passed tests after REPLAYING rerun.


🟢 All tests passed!

View the build log or the debug log for each test

@ankitgoyal0301
Copy link
Contributor Author

ankitgoyal0301 commented Feb 14, 2025

The failed unit tests seem to be unrelated to my change to chronicle resource: https://screenshot.googleplex.com/3BU33jRCz8PBpm6

@modular-magician
Copy link
Collaborator

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

Diff report

Your PR generated some diffs in downstreams - here they are.

google provider: Diff ( 1 file changed, 22 insertions(+))
google-beta provider: Diff ( 3 files changed, 186 insertions(+), 39 deletions(-))

@modular-magician
Copy link
Collaborator

Tests analytics

Total tests: 21
Passed tests: 20
Skipped tests: 1
Affected tests: 0

Click here to see the affected service packages
  • chronicle

🟢 All tests passed!

View the build log

@ankitgoyal0301
Copy link
Contributor Author

The failed unit tests seem to be unrelated to my change to chronicle resource: https://screenshot.googleplex.com/3BU33jRCz8PBpm6

@slevenick Tagging this for visibility.

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