-
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
existing Data Sources now return errors on 404s #8858
existing Data Sources now return errors on 404s #8858
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. Terraform GA: Diff ( 75 files changed, 519 insertions(+), 113 deletions(-)) |
Tests analyticsTotal tests: 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 testsTestAccSpannerDatabaseIamPolicy |
Rerun these tests in REPLAYING mode to catch issues
|
@@ -84,7 +84,7 @@ func dataSourceGoogleCloudIdentityGroupsRead(d *schema.ResourceData, meta interf | |||
return nil | |||
}) | |||
if err != nil { | |||
return transport_tpg.HandleNotFoundError(err, d, fmt.Sprintf("CloudIdentityGroups %q", d.Id())) | |||
return transport_tpg.HandleDataSourceNotFoundError(err, d, fmt.Sprintf("CloudIdentityGroups %q", d.Id()), "") |
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.
We don't have a usable ID or URL to send as the last parameter here, but what do you think about at least "Groups" or something?
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.
The reason nothing is passed is this error is never actually a 404 -- it returns a different web error, which means the argument is unused downstream. That said, since I updated it to use the new function (was primarily meant to ensure the lack of breaking change should it need updating in the future), I'll update it to use "Groups" in case the 404 is hit in the future due to updates on Cloud Identity's end
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.
That makes sense, thanks for the explanation!
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.
Shouldn't there be a changelog note for this?
Yes, I started writing one for this and the Default Values but got waylayed by the larger DCL release, I'll hold off the merge until thats ready |
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 ( 75 files changed, 519 insertions(+), 113 deletions(-)) |
Tests analyticsTotal tests:
|
df9725a
into
GoogleCloudPlatform:FEATURE-BRANCH-major-release-5.0.0
Fixes hashicorp/terraform-provider-google#12873
This does not guarantee all data sources will return errors if empty -- there are some for which this is intended functionality such as data sources filtering for what data they would have displayed, or if an endpoint is successfully reached due to actually existing but simply containing no information for the data source to display, as their lack of data is intentional.
Local testing entailed doing trial runs of data sources that had more unusual configurations (e.g. 1), and verifying functionality for a few different resources that the more universal configurations (e.g. 1 and 2) that involved either replacing references to
transport_tpg.HandleNotFoundError
withtransport_tpg.HandleDataSourceNotFoundError
or wrapping standard resource read functions with a check for an empty ID, as this would be returned by these resource reads usingtransport_tpg.HandleNotFoundError
.Should not result in false-positives as the two main functionality changes due the following:
If using the
transport_tpg.HandleDataSourceNotFoundError
return an error on 404 directly, maintains logic for returning non 404 errorsIf using the
d.Id == ""
check, the d.SetId("") would be passed up via thetransport_tpg.HandleNotFoundError
function, in which case this is the Error we directly are intending to add (the example functionality previously added via Container Cluster per parent issue)Release Note Template for Downstream PRs (will be copied)