创建 s3 存储桶时传递附加参数

Passing additional parameters while creating s3 bucket

有没有办法在创建 aws_s3_bucket 资源时将附加参数传递给 AWS API,即 CreateBucketConfiguration/LocationConstraint

您不能直接这样做,但是您可以通过provider alias 设置给定区域来获得相同的效果:

provider "aws" {  
   alias  = "west"  
   region = "us-west-2"
}


resource "aws_s3_bucket" "mybucket" {  
   provider = aws.west
   #...
}