I get the below error while doing a tf init. The bucket is already created in a separate config file & is in us-west-2 (verified). But when I want to initialize the S3 backend from a different config folder, I get the below error.
Initializing the backend…
Successfully configured the backend “s3”! Terraform will automatically
use this backend unless the backend configuration changes.
Error refreshing state: BucketRegionError: incorrect region, the bucket is not in ‘us-west-2’ region at endpoint ‘’, bucket is in ‘us-west-1’ region
my provider block looks like this :
terraform {
required_providers {
aws = {
source = “hashicorp/aws”
version = “>= 4.14”
}
}
backend “s3” {
bucket = “my-s3-bucket-name”
key = “terraform.tfstate”
region = “us-west-2”
dynamodb_table = “terraform_state”
}