-
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
Make google_compute_instance_guest_attributes
return empty results when queried for nonexistent values
#12487
Make google_compute_instance_guest_attributes
return empty results when queried for nonexistent values
#12487
Conversation
Hello! I am a robot. Tests will require approval from a repository maintainer to run. @roaks3, 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. |
@roaks3 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.
Could you add a test to confirm the behavior?
I'm also a little unsure about the solution here. It looks like this data source does not represent a list, so I would generally expect it to follow hashicorp/terraform-provider-google#12873 and return an error. For example, I think that would be the expected behavior when variable_key
is used.
However, this datasource has a query_path
parameter that makes it a bit weird, and I'm not clear on what behavior we would want. The error the users sees now is obviously not clear, but it seems like technically we would still want an error returned. Could you share more about the use case, and why the user would be purposefully querying for infrastructure that doesn't exist?
The unclear error is due to the HandleDataSourceNotFound func. I can fix the errors on this resource if that's what we want, and just have clear error messages. In this PR we only throw an error when an instance doesn't exist, but we can use the upstream code and just fix the errors there.
The guest attributes can only be added via |
@roaks3 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.
Oh I see, I misunderstood the query_value
field. This does actually look more like a plural datasource, and I don't think a 404 would make sense when the list is empty.
Same comment as before though, we should be able to add a test with an instance that does not have any guest attributes. This would confirm the error with the old behavior, and that it is fixed with this change.
23adb11
to
9897eaa
Compare
Added test cases for |
@roaks3 This PR has been waiting for review for 3 weekdays. Please take a look! Use the label |
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: 1077 Click here to see the affected service packages
Action takenFound 1 affected test(s) by replaying old test recordings. Starting RECORDING based on the most recent commit. Click here to see the affected tests
|
closes hashicorp/terraform-provider-google#20346
Release Note Template for Downstream PRs (will be copied)
See Write release notes for guidance.