gpt4 book ai didi

google-cloud-platform - 无法在区域中创建谷歌云存储桶[terraform]

转载 作者:行者123 更新时间:2023-12-02 20:42:13 25 4
gpt4 key购买 nike

我正在尝试使用 terraform 在 us-west1-a 区域创建一个 gcs 存储桶,并将 storage-class 设为 REGIONAL。但这样做时我收到此错误

* google_storage_bucket.terraform-state: 1 error(s) occurred:

* google_storage_bucket.terraform-state: googleapi: Error 400: The combination of locationConstraint and storageClass you provided is not supported for your project, invalid

这是我现在拥有的 .tf 文件

resource "google_storage_bucket" "terraform-state" {
name = "terraform-state"
storage_class = "${var.storage-class}"
}

provider "google" {
credentials = "${file("${path.module}/../credentials/account.json")}"
project = "${var.project-name}"
region = "${var.region}"
}

variable "region" {
default = "us-west1" # Oregon
}

variable "project-name" {
default = "my-project"
}

variable "location" {
default = "US"
}

variable "storage-class" {
default = "REGIONAL"
}

文档

最佳答案

CreateBucket 请求中指定的位置是区域,而不是区域(请参阅 https://cloud.google.com/compute/docs/regions-zones/regions-zones 中的定义)。 “us-west1-a”是一个区域。请尝试使用“us-west1”(包含 us-west1-a 区域的区域)来请求。

关于google-cloud-platform - 无法在区域中创建谷歌云存储桶[terraform],我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45781840/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com