-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Add diff suppress for time format to google_compute_resource_policies
#11486
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
Add diff suppress for time format to google_compute_resource_policies
#11486
Conversation
Hello! I am a robot. Tests will require approval from a repository maintainer to run. @SarahFrench, 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. |
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: 982 Click here to see the affected service packages
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 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.
Hi, thanks for your PR!
My understanding of the problem is that currently if a user was to use "1:00" in their configuration Terraform will identify a permadiff because the API will return "01:00" and there's a mismatch as a result.
The new regex for validating input looks correct to me, but you're also correct that this would be a breaking change for some users - e.g. some might have used ignore_changes on this field to navigate the permadiff.
Another approach is to add diff suppression to the field so that the provider regards "1:00" and "01:00" (for example) as equivalent and doesn't raise a diff in this situation. Would you consider this alternative instead, as it's non-breaking?
ok i wasn't aware that the Google API actually translated the given value from H:MM to HH:MM. If that happens then the suppress diff seems like a better solution
|
@SarahFrench This PR has been waiting for review for 3 weekdays. Please take a look! Use the label |
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.
@SarahFrench This PR has been waiting for review for 3 weekdays. Please take a look!
I'm OOO and will review this on Tuesday
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 looks good to me, thanks for the testing of the diff suppression function! Before merging I'd like there to be an acceptance test that contains a start_time
value in H:mm format and shows that there aren't errors.
An approach for this could be to update this example file, which is referenced here in ResourcePolicy.yaml , so that the start_time
value can be passed in from the YAML as a variable (similar to what you see for name
). After doing this, you could add another entry to the examples
list in ResourcePolicy.yaml but set the value for start_time
in the H:mm format. You'd also want to include skip_docs: true
in that block, so that the example is only used to generate a test and doesn't accidentally promote using H:mm format format in the official provider documentation
Using the same
|
Ah, of course name collision would happen 🤦 . In that case I'm afraid that the route forward is to create a new example file with a different name that has the start_time value set in H:mm. Because of this having the time set via a variable wouldn't be necessary. Sorry for leading you down an incorrect path! |
Done here |
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: 990 Click here to see the affected service packages
Tests were added that are skipped in VCR:
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 tests
|
Tests failed due to non-determinism or randomness when the VCR replayed the response after the HTTP request was made. Please fix these to complete your PR. If you believe these test failures to be incorrect or unrelated to your change, or if you have any questions, please raise the concern with your reviewer. |
resource_compute_resource_policies
google_compute_resource_policies
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.
Thanks, and sorry again! The new generated test passes so I'll merge. The TestAccComputeInstanceTemplate_withNamePrefix
failure is unrelated to this PR.
closes issue #8460
This is probably a breaking change because some
terraform apply
commands won't go through if they have a wrong format. The regex will throw an error. But it also ensures that it's the correct format for the API.Will write a test case for this into the PR if it's an approved solution.
Release Note Template for Downstream PRs (will be copied)