Skip to content
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

Fix partial risk behavior configuration bug #3463

Conversation

inanna-malick
Copy link

Previously, if a user's account supported risk behaviors A, B and C but only behaviors A and B were configured, a 'provider produced inconsistent results after apply' error occurred.

This is because the cloudflare API call for user risk behaviors returns the status of all behaviors.

This PR changes the user risk behavior terraform provider to - on read, create and update calls - prune the API call results to only include the behaviors the terraform config includes

A test confirming that the fix works has been included

Copy link
Contributor

github-actions bot commented Jul 15, 2024

changelog detected ✅

@inanna-malick inanna-malick force-pushed the inanna/DLP-2043-user-risk-scoring-bugfix branch from e12317e to b9dccf1 Compare July 15, 2024 18:45
Previously, if a user's account supported risk behaviors A, B and C but
only behaviors A and B were configured, a 'provider produced inconsistient results after apply' error occured.

This is because the cloudflare API call for user risk behaviors returns the status of all behaviors.

This PR changes the user risk behavior terraform provider to - on read, create and update calls -
prune the API call results to only include the behaviors the terraform config includes

A test confirming that the fix works has been included
@inanna-malick inanna-malick force-pushed the inanna/DLP-2043-user-risk-scoring-bugfix branch from b9dccf1 to 4e2cc28 Compare July 15, 2024 18:46
@jacobbednarz
Copy link
Member

this seems like a case where someone is only partially managing the resource in terraform. is that the case?

@inanna-malick
Copy link
Author

inanna-malick commented Jul 22, 2024

this seems like a case where someone is only partially managing the resource in terraform. is that the case?

Yes, but even in the case where someone is fully managing the resource in terraform, we sometimes add new risk behavior types, which would put them in a partially-managed state (which we want to handle gracefully).

(sorry for the delayed response btw, I was out with covid for a bit)

@jacobbednarz
Copy link
Member

acceptance tests passing

TF_ACC=1 go test ./internal/framework/service/risk_behavior/ -v -run "^TestAccCloudflareRiskBehavior_" -count 1 -timeout 120m -parallel 1
=== RUN   TestAccCloudflareRiskBehavior_Partial
=== PAUSE TestAccCloudflareRiskBehavior_Partial
=== RUN   TestAccCloudflareRiskBehavior_Basic
=== PAUSE TestAccCloudflareRiskBehavior_Basic
=== CONT  TestAccCloudflareRiskBehavior_Partial
--- PASS: TestAccCloudflareRiskBehavior_Partial (2.82s)
=== CONT  TestAccCloudflareRiskBehavior_Basic
--- PASS: TestAccCloudflareRiskBehavior_Basic (1.97s)
PASS
ok  	github.com/cloudflare/terraform-provider-cloudflare/internal/framework/service/risk_behavior	6.140s

@jacobbednarz jacobbednarz merged commit 1fc4b5d into cloudflare:master Jul 29, 2024
8 checks passed
@github-actions github-actions bot added this to the v4.39.0 milestone Jul 29, 2024
Copy link
Contributor

github-actions bot commented Aug 7, 2024

This functionality has been released in v4.39.0 of the Terraform Cloudflare Provider.

Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading.

For further feature requests or bug reports with this functionality, please create a new GitHub issue following the template. Thank you!

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 7, 2024
@inanna-malick inanna-malick deleted the inanna/DLP-2043-user-risk-scoring-bugfix branch August 7, 2024 17:35
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants