-
Notifications
You must be signed in to change notification settings - Fork 1.9k
fixing permadiff create_without_validation #14543
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
fixing permadiff create_without_validation #14543
Conversation
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.
|
Tests analyticsTotal tests: 9 Click here to see the affected service packages
View the build log |
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.
|
Tests analyticsTotal tests: 9 Click here to see the affected service packages
View the build log |
// If the old value was "false" and the new value is now unset (empty string), | ||
// return true to suppress the diff. | ||
if (old == "" && new == "false") || (old == "false" && new == "") { | ||
d.Set("create_without_validation", "false") |
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.
This is what's causing the panic, because terraform expects a boolean. I would try putting
d.Set("create_without_validation", false)
in a post_import
.
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.
|
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.
|
Tests analyticsTotal tests: 15 Click here to see the affected service packages
Found 4 affected test(s) by replaying old test recordings. Starting RECORDING based on the most recent commit. Click here to see the affected tests
|
1 similar comment
Tests analyticsTotal tests: 15 Click here to see the affected service packages
Found 4 affected test(s) by replaying old test recordings. Starting RECORDING based on the most recent commit. Click here to see the affected tests
|
🔴 Tests failed during RECORDING mode: 🔴 Errors occurred during RECORDING mode. Please fix them to complete your PR. |
🔴 Tests failed during RECORDING mode: 🔴 Errors occurred during RECORDING mode. Please fix them to complete your PR. |
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.
|
Tests analyticsTotal tests: 15 Click here to see the affected service packages
View the build log |
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.
|
Tests analyticsTotal tests: 15 Click here to see the affected service packages
View the build log |
// If the old value was "false" and the new value is now unset (empty string), | ||
// return true to suppress the diff. |
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.
This describes what the conditional does, but the important thing to explain here is why we need to do it. You can either link the issue in the comment or summarize it.
_, exists := d.GetOk("create_without_validation") | ||
if !exists { | ||
url += "false" | ||
d.Set("create_without_validation", false) | ||
} |
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.
Sorry for the back and forth here, but after reviewing a discussion about GetOkExists
I think our best approach is actually to get the url parameters out of the base URL entirely.
So that would mean deleting &force={{create_without_validation}}
from the create_url
and calling transport.AddQueryParams
here with something like map[string]string{"force": "true"}
only if d.Get("create_without_validation")
returns true
.
We might also want to make sure there's at least one test that creates the resource with the field set to false or unspecified.
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.
would this not be a breaking change?
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.
Is the force
url parameter required in the API endpoint?
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.
It would also be a breaking change if force=false
has different behavior than omitting force
altogether. Keeping it as is should be safest.
url, err = transport_tpg.AddQueryParams(url, map[string]string{"force": "true"}) | ||
} else { | ||
url, err = transport_tpg.AddQueryParams(url, map[string]string{"force": "false"}) | ||
} |
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.
nit: the indentation is looking weird to me, although it should be fine as long as gofmt still works on it.
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.
|
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.
|
Tests analyticsTotal tests: 15 Click here to see the affected service packages
View the build log |
Tests analyticsTotal tests: 15 Click here to see the affected service packages
View the build log |
326baa9
Fixes hashicorp/terraform-provider-google#21780 - a permadiff regarding the create_without_validation field within datastream
Release Note Template for Downstream PRs (will be copied)
See Write release notes for guidance.