-
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
Add project_number
field to google_storage_bucket resource and datasource, enable providing project
argument to data source
#10312
Add project_number
field to google_storage_bucket resource and datasource, enable providing project
argument to data source
#10312
Conversation
This does not impact the data source retrieving data about the bucket. Providing this argument only serves to prevent a call to the Compute API to populate that field after reading the bucket's data. Storage API only returns the project number, so Compute API is used to get the project id in the absence of a user-supplied value.
… project argument can be provided and is non-functional (therefore can be set to "foobar" without negatice impact)
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: 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 testsTestAccDataSourceGoogleStorageBucket_avoidComputeAPI |
|
Instead of adding the project field to data source, maybe we can consider creating a new function for data source, similar to setStorageBucket, but without the project checking code. It will avoid the incorrect project provided by the users for the data source. |
Yeah that's another option & I'm happy to pursue it. That function is trying to cover a lot of scenarios! I'll probably pick that up next week, as I'm OOO Friday-Monday |
Ah, I just thought. A change like that would be a breaking change for all users who are happy with the resource interacting with the Compute API. I'm opening this PR for a small minority of users who don't want Compute API to be used inside this data source but there may be users out there relying on this behaviour |
I see. I didn't realize that. We can go with the current change. Can we also add note for providing the correct project to the data source documentation ? Thanks. |
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.
|
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.
LGTM if all of the checks pass.
Tests analyticsTotal tests: Click here to see the affected service packages
|
Thanks! |
…source, enable providing `project` argument to data source (GoogleCloudPlatform#10312)
…source, enable providing `project` argument to data source (GoogleCloudPlatform#10312)
…source, enable providing `project` argument to data source (GoogleCloudPlatform#10312)
…source, enable providing `project` argument to data source (GoogleCloudPlatform#10312)
…source, enable providing `project` argument to data source (GoogleCloudPlatform#10312)
…source, enable providing `project` argument to data source (GoogleCloudPlatform#10312)
…source, enable providing `project` argument to data source (GoogleCloudPlatform#10312)
…source, enable providing `project` argument to data source (GoogleCloudPlatform#10312)
…source, enable providing `project` argument to data source (GoogleCloudPlatform#10312)
…source, enable providing `project` argument to data source (GoogleCloudPlatform#10312)
Closes hashicorp/terraform-provider-google#17166
This PR aims to address an edge case where users do not want to give the identity/service account used by Terraform permissions on the Compute API and want to provision GCS buckets. Previously if a project name was not supplied to the data source via provider defaults then the data source would:
project
fieldBy letting users set the project field on the data source they can avoid that call to the Compute API. There is a chance that the project id they supply doesn't match the project number linked to the GCS bucket. This isn't ideal, but was OK'd during triage as it matches the existing behaviour on import.
This PR also adds a new field, project_number, to surface the information returned from the Storage API which is guaranteed to be accurate. This enables users to perform any checks etc to verify the project id and number are a correct pairing.
Release Note Template for Downstream PRs (will be copied)