-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
cloud_tasks_queue: supress permadiffs on backoff settings #8359
cloud_tasks_queue: supress permadiffs on backoff settings #8359
Conversation
Hello! I am a robot who works on Magic Modules PRs. I've detected that you're a community contributor. @slevenick, a repository maintainer, has been assigned to assist you and help review your changes. ❓ First time contributing? Click here for more detailsYour assigned reviewer will help review your code by:
You can help make sure that review is quick by running local tests and ensuring they're passing in between each push you make to your PR's branch. Also, try to leave a comment with each push you make, as pushes generally don't generate emails. If your reviewer doesn't get back to you within a week after your most recent change, please feel free to leave a comment on the issue asking them to take a look! In the absence of a dedicated review dashboard most maintainers manage their pending reviews through email, and those will sometimes get lost in their inbox. |
95a3e17
to
2c5a22d
Compare
So far, adding |
It should cause a change in the provider, I'd guess you don't have the local environment set up correctly. I've triggered the run so it should show the diff here in ~15 minutes |
Hi there, I'm the Modular magician. I've detected the following information about your changes: Diff reportYour PR generated some diffs in downstreams - here they are. Terraform GA: Diff ( 2 files changed, 48 insertions(+), 6 deletions(-)) |
Tests analyticsTotal tests:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Your test config function doesn't match up to what is being called.
testAccCloudtasksQueueTimeUnitDiff vs testAccCloudtasksQueueRetryTimeUnitDiff
2c5a22d
to
311d46b
Compare
Derp, yeah, sorry, updated in one place but not the other. updated. Thoughts on whether we need to solve this in |
Judging by the name that looks to solve a different problem. Do you see this same problem on maxRetryDuration? The existing code in that DSF just equalizes |
Yeah, possible. I was generating some diffs, just not the expected ones. (the test diffs got created as expected, though) I have successfully done this before, and have run through all the setup docs in the past, and reviewed them again. The doctor script didn't report any problems. Still dealing with some go dependency issues for running vet / lint / etc., but this should be happening before that, I think. Anyway, I'll get it working again, esp. when I next dig into anything trickier than this. |
That's right - the existing custom code (and test) seems to be handling the situation where it's 0. Since it accepts time units, I guess I was expecting that the same issue would likely affect I am not suggesting that we remove the existing custom function for it, just that we might also ideally want to incorporate the behavior of |
Yeah, we could incorporate the behavior in there by calling the duration DSF. I'd make sure we actually see the problem before implementing that fix though |
Yes, as you'd guess, the same behavior affects resource "google_cloud_tasks_queue" "foobarbaz" {
name = "foobarbaz"
location = "us-west2"
rate_limits {
max_dispatches_per_second = 8
max_concurrent_dispatches = 2
}
retry_config {
max_attempts = 2
max_backoff = "2.5s"
min_backoff = "2.000s"
max_doublings = 5
max_retry_duration = "10.0s"
}
} will result in this permadiff ~ retry_config {
~ max_backoff = "2.500s" -> "2.5s"
~ max_retry_duration = "10s" -> "10.0s"
~ min_backoff = "2s" -> "2.000s" |
Hi there, I'm the Modular magician. I've detected the following information about your changes: Diff reportYour PR generated some diffs in downstreams - here they are. Terraform GA: Diff ( 2 files changed, 48 insertions(+), 6 deletions(-)) |
Tests analyticsTotal tests: Action takenFound 3 affected test(s) by replaying old test recordings. Starting RECORDING based on the most recent commit. Click here to see the affected testsTestAccContainerAwsNodePool_BetaBasicHandWritten|TestAccComputeFirewallPolicyRule_multipleRules|TestAccCloudTasksQueue_TimeUnitDiff |
Rerun these tests in REPLAYING mode to catch issues
|
The test as written will already check that there's no drift after apply, right? Or do I have to do the thing where it does it a second time?
I can add |
The test should check there's no diff after apply. You can test that out by changing the max_retry_duration to a value that causes the issue. I think you should be able to call the DurationDiffSuppress from within the existing handwritten diff suppress that field is using, just by replacing:
with
|
4e65c91
to
e691cd9
Compare
Sounds good. I can't run the integration tests locally, so I'll push up the change with the presumably breaking test. Assuming that looks good (bad), I'll push up the change with your suggestion for calling the additional suppression function; thanks for the example. |
So like this? diff --git a/mmv1/templates/terraform/constants/cloud_tasks_retry_config_custom_diff.go b/mmv1/templates/terraform/constants/cloud_tasks_retry_config_custom_diff.go
index cba219445..9f65d60e8 100644
--- a/mmv1/templates/terraform/constants/cloud_tasks_retry_config_custom_diff.go
+++ b/mmv1/templates/terraform/constants/cloud_tasks_retry_config_custom_diff.go
@@ -1,7 +1,11 @@
+import (
+ "github.com/GoogleCloudPlatform/terraform-google-conversion/v2/tfplan2cai/converters/google/resources/tpgresource"
+)
+
func suppressOmittedMaxDuration(_, old, new string, _ *schema.ResourceData) bool {
if old == "" && new == "0s" {
log.Printf("[INFO] max retry is 0s and api omitted field, suppressing diff")
return true
}
- return false
+ return tpgresource.DurationDiffSuppress(old, new)
} |
e691cd9
to
88e6007
Compare
@slevenick ok, I had to pass the other two parameters too, but seems to work (and confirmed that the import is already there / not needed)! 🎉 I fixed the local build and confirms that this works locally to resolve the issue. |
Hi there, I'm the Modular magician. I've detected the following information about your changes: Diff reportYour PR generated some diffs in downstreams - here they are. Terraform GA: Diff ( 2 files changed, 50 insertions(+), 8 deletions(-)) |
Add `tpgresource.DurationDiffSuppress` to min / max backoff Fixes https://github.com/hashicorp/terraform-provider-google/issues/15166x
88e6007
to
c161955
Compare
Tests analyticsTotal tests: Action takenFound 3 affected test(s) by replaying old test recordings. Starting RECORDING based on the most recent commit. Click here to see the affected testsTestAccCloudTasksQueue_TimeUnitDiff|TestAccComputeFirewallPolicyRule_multipleRules|TestAccContainerAwsNodePool_BetaBasicHandWritten |
Rerun these tests in REPLAYING mode to catch issues
|
Hi there, I'm the Modular magician. I've detected the following information about your changes: Diff reportYour PR generated some diffs in downstreams - here they are. Terraform GA: Diff ( 2 files changed, 50 insertions(+), 8 deletions(-)) |
Tests analyticsTotal tests: Action takenFound 2 affected test(s) by replaying old test recordings. Starting RECORDING based on the most recent commit. Click here to see the affected testsTestAccContainerAwsNodePool_BetaBasicHandWritten|TestAccComputeFirewallPolicyRule_multipleRules |
|
@slevenick let me know how this looks now I can rebase the branch if you'd like, though sometimes that slows things down, so I will leave it as-is unless you want me to. |
Add `tpgresource.DurationDiffSuppress` to min / max backoff Fixes https://github.com/hashicorp/terraform-provider-google/issues/15166x
…dPlatform#8359) Add `tpgresource.DurationDiffSuppress` to min / max backoff Fixes https://github.com/hashicorp/terraform-provider-google/issues/15166x
…dPlatform#8359) Add `tpgresource.DurationDiffSuppress` to min / max backoff Fixes https://github.com/hashicorp/terraform-provider-google/issues/15166x
…dPlatform#8359) Add `tpgresource.DurationDiffSuppress` to min / max backoff Fixes https://github.com/hashicorp/terraform-provider-google/issues/15166x
Add `tpgresource.DurationDiffSuppress` to min / max backoff Fixes https://github.com/hashicorp/terraform-provider-google/issues/15166x
…dPlatform#8359) Add `tpgresource.DurationDiffSuppress` to min / max backoff Fixes https://github.com/hashicorp/terraform-provider-google/issues/15166x
Add
tpgresource.DurationDiffSuppress
to min / max backoffFixes hashicorp/terraform-provider-google#15166
h/t to @edwardmedia for the pointer
Note:
maxRetryDuration
already has a custom diff function:suppressOmittedMaxDuration()
- for now, I didn't touch that oneIf this PR is for Terraform, I acknowledge that I have:
make test
andmake lint
in the generated providers to ensure it passes unit and linter tests.Release Note Template for Downstream PRs (will be copied)