Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

provider attribute is ignored #4

Open
shiimaxx opened this issue Jun 3, 2022 · 0 comments
Open

provider attribute is ignored #4

shiimaxx opened this issue Jun 3, 2022 · 0 comments

Comments

@shiimaxx
Copy link
Contributor

shiimaxx commented Jun 3, 2022

Terraform can override the default provider with the provider attribute in the resource block.

e.g.

resource "aws_s3_bucket" "example-bucket" {
  bucket   = "example-bucket"
  provider = aws.us-east-1

  versioning {
    enabled = true
  }
}

In the above, tfrefactor will migrate from the versioning attribute to the aws_s3_bucket_versioning resource but the provider attribute is ignored.

resource "aws_s3_bucket" "example-bucket" {
  bucket   = "example-bucket"
  provider = aws.us-east-1

}

resource "aws_s3_bucket_versioning" "example-bucket_versioning" {
  bucket = aws_s3_bucket.example-bucket.id
  versioning_configuration {
    status = "Enabled"
  }
}

aws_s3_bucket.example-bucket is a resource in the aws.us-east-1 provider but terraform takes that as the default region resource (In this case ap-northeast-1) in aws_s3_bucket_versioning.example-bucket_versioning and occurs following error.

Error: error waiting for S3 Bucket Versioning status for bucket (example-bucket): BucketRegionError: incorrect region, the bucket is not in 'ap-northeast-1' region at endpoint ''
	status code: 301, request id: , host id: 
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant