我正在尝试使用区域us-west1-a中的terraform创建一个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"
}文档
发布于 2017-08-21 22:46:21
CreateBucket请求中指定的位置是区域,而不是区域(参见https://cloud.google.com/compute/docs/regions-zones/regions-zones中的定义)。“我们-西部-a”是一个区域。请尝试使用“request 1”(这是包含美国西部1-a区域)的请求。
发布于 2017-08-27 00:15:45
看起来您实际上还没有在资源中指定一个位置,所以它默认为"us“,这是无效的,因为它不是一个区域。尝试:
resource "google_storage_bucket" "terraform-state" {
name = "terraform-state"
storage_class = "${var.storage-class}"
location = "${var.location}"
}
variable "location" {
default = "us-west1"
}
variable "storage-class" {
default = "REGIONAL"
}注意,我已经将" location“添加到资源中,并将location变量设置为实际所需的GCS位置。
https://stackoverflow.com/questions/45781840
复制相似问题