-
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
Marked preview as Computed: true #4472
Marked preview as Computed: true #4472
Conversation
I have triggered VCR tests based on this PR's diffs. See the results here: "https://ci-oss.hashicorp.engineering/viewQueued.html?itemId=171151" |
Oops! It looks like you're using an unknown release-note type in your changelog entries:
Please only use the types listed in https://github.com/GoogleCloudPlatform/magic-modules/blob/master/.ci/RELEASE_NOTES_GUIDE.md. |
/gcbrun |
I have triggered VCR tests based on this PR's diffs. See the results here: "https://ci-oss.hashicorp.engineering/viewQueued.html?itemId=171235" |
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 analysis makes sense to me! :)
gonna add @slevenick for a quick second pass. I don't know if it would be better to have a diff suppress? I think this is fine |
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.
Quick sanity check, can a user go from setting preview = true
to preview = false
and have the value actually update? Optional+Computed has some issues in these cases, but I might be thinking of objects rather than primitive values like booleans
I don't seem to have any problems doing that in local testing. |
Partially resolved hashicorp/terraform-provider-google#8251.
I think the issue is that "preview" is optional; if it wasn't provided, it would be tracked as nil by the provider and "false" by the state. When the user goes to make a plan, terraform detects that "preview" will be updated from false -> null, which changes the hash of the object (which looks like a delete/recreate.) Changing to Computed fixes this by setting the provider's value from the API as well as the state.
There is a separate issue where changes are still erroneously detected if a match uses expr instead of config - I'm having some trouble figuring out the best solution in that case but wanted to get the first part out there at least :-)
If this PR is for Terraform, I acknowledge that I have:
make test
andmake lint
to ensure it passes unit and linter tests.Release Note Template for Downstream PRs (will be copied)