When running terraform plan getting below error. my S3 bucket is available / visible at https://s3.console.aws.amazon.com/s3/home?region=us-west-2.
ERROR
data.terraform_remote_state.networking: Refreshing state…
data.aws_ami.ubuntu: Refreshing state…
Error: BucketRegionError: incorrect region, the bucket is not in ‘us-west-2’ region at endpoint ''
** status code: 301, request id: , host id:**
CODE
data “terraform_remote_state” “networking” {
backend = “s3”
config = {
key = terraform.workspace == "default" ? var.network_remote_state_key : local.workspace_key
bucket = var.network_remote_state_bucket
region = "us-west-2"
profile = var.aws_profile
}
}
data “aws_ami” “ubuntu” {
most_recent = true
owners = [“099720109477”]
filter {
name = "name"
values = ["ubuntu/images/hvm-ssd/ubuntu-xenial-16.04-amd64-server*"]
}
filter {
name = "architecture"
values = ["x86_64"]
}
filter {
name = "virtualization-type"
values = ["hvm"]
}
filter {
name = "root-device-type"
values = ["ebs"]
}
}