terraform多个提供程序无法使用s3存储桶

时间:2018-11-01 23:37:05

标签: amazon-web-services amazon-s3 terraform

我正在尝试这样做:

terraform {
  backend "s3" {
    bucket = "resources"
    region = "us-east-1"
    key = "resources"
  }
}

// the default region
provider "aws" {
  region = "us-west-2"
}

//for creating buckets in other regions- region param broken stupid issue with aws_s3_bucket resource...
provider "aws" {
  alias  = "east1"
  region = "us-east-1"
}

resource "aws_s3_bucket" "zzzzz" {
  provider = "aws.east1"
  bucket = "zzzzz"
  acl    = "private"
  force_destroy = true
}

出错了

 Error creating S3 bucket: AuthorizationHeaderMalformed: The authorization header is malformed; the region 'us-east-1' is wrong; expecting 'us-west-2'

2 个答案:

答案 0 :(得分:0)

我只需要等待1个小时以上,因为我在不同区域重新创建了存储桶

答案 1 :(得分:0)

如果您的存储桶名称不是全局唯一的(仅在您的帐户中),这也可能发生。尝试使用其他名称(通常更长)会有所帮助