bonfy / problems

record problems I have met and solved
2 stars 1 forks source link

Terrafrom S3 bucket issue #20

Open bonfy opened 2 years ago

bonfy commented 2 years ago

问题描述: AWS 的 s3 bucket 其实是 global的,但是 terraform 的 provider 会在生成的 state 文件里 随机分配一个 region, 但是你再去用会发生

Error refreshing state: BucketRegionError: incorrect region, the bucket is not in 'ap-southeast-2' region at endpoint ''

https://github.com/hashicorp/terraform-provider-aws/issues/14544

解决方案:

设置成 us-east-1 就行了

UdhavPawar commented 2 years ago

Facing the same issue. Verified provider.tf, backend.tf and S3 bucket is using required us-west-1 region but getting same error as BucketRegionError: incorrect region, the bucket is not in 'us-west-1' region at endpoint ''

mearistizabal commented 1 year ago

In my case, I needed to create a bucket in another region for a DR scenario. Then I found CloudFront has to be created in us-east-1 so I had to switch the main/DR regions. Even though I made a Destroy it seems there were some left records of the previous S3 locations and that was creating the problem. Deleting .terraform worked for me too. Thank you.