You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

使用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

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.10 13:30:47