Add project_number
field to google_storage_bucket resource and datasource, enable providing project
argument to data source
#7164
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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)
Derived from GoogleCloudPlatform/magic-modules#10312