使用Terraform创建GCP项目及存储桶时遇400错误:位置约束无效
解决GCP存储桶Terraform部署时的"指定位置约束无效"错误
问题出在存储桶的区域名称拼写错误:你配置的location = "us-center1"里的center是错误写法,GCP的有效区域名应为**us-central1**(正确拼写是central)。
修正后的存储桶代码:
resource "google_storage_bucket" "project-data" { depends_on = [google_project_service.storage-component_api] project = google_project.project.project_id name = join("", [google_project.project.project_id, "-project-data"]) location = "us-central1" # 修正区域名称拼写 storage_class = "REGIONAL" }
如果需要确认其他可用区域,可通过GCP CLI命令查看所有有效存储区域:
gcloud storage locations list
内容的提问来源于stack exchange,提问作者Kristian
相关产品推荐
相关产品推荐

