terraform-provider-google
terraform-provider-google copied to clipboard
Terraform support to deploy GCS using custom dual-region
Community Note
- Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
- Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritize the request
- If you are interested in working on this issue or have submitted a pull request, please leave a comment. If the issue is assigned to the "modular-magician" user, it is either in the process of being autogenerated, or is planned to be autogenerated soon. If the issue is assigned to a user, that user is claiming responsibility for the issue. If the issue is assigned to "hashibot", a community member has claimed the issue already.
Description
Current Terraform provider is NOT supporting to create a custom dual-region GCS bucket using location field. It works just fine with Google's predefined dual-regions - NAM4, ASIA1, EUR4. When you create a custom-dual region with a location field as US-CENTRAL1+US-EAST1, the terraform state stores the location as US. When we make an update to the bucket next time, there is a mismatch between code and state file, which forces the deployment to be recreated like force replacement.
However, both console and gcloud work fine without any issues. Google handles dual-regions something like this in gcloud-gsutil.
gsutil mb -l MULTI-REGION --placement REGION_1,REGION_2 gs://BUCKET_NAME/
There is an option / switch called "placement" where you can specify the dual-region info. Once the bucket has created, the backend data has been stored as below.
gs://my-bucket/ : Storage class: STANDARD Location type: dual-region Location constraint: US Placement locations: [US-CENTRAL1, US-WEST1]
GCS Terraform is not offering this switch "placement" to specify 2 regions to create a bucket. Therefore, we pass dual-region info like this,
location = US-CENTRAL1+US-EAST1
New or Affected Resource(s)
Google Cloud Storage (GCS) storage.googleapis.com
Potential Terraform Configuration
When we create a bucket, there should be an option to say the placement locations info in terraform resource. Something like below.
resource "google_storage_bucket" "auto-expire" {
name = "auto-expiring-bucket"
location = "US"
placement = [US-CENTRAL1, US-WEST1]
}
References
https://github.com/hashicorp/terraform-provider-google/issues/1229 https://github.com/terraform-google-modules/terraform-google-cloud-storage/issues/182
- #0000
This is possible via the customPlacementConfig field.
b/249089097
I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.