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

Add support for provider attribute #3

Closed
wants to merge 1 commit into from

Conversation

shiimaxx
Copy link
Contributor

When configured for override default provider in aws_s3_bucket resource block, should add the same provider attribute to each standalone resource.

@shiimaxx
Copy link
Contributor Author

shiimaxx commented Apr 22, 2022

The issue of background for this PR:

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: 

@shiimaxx
Copy link
Contributor Author

shiimaxx commented Jun 3, 2022

Convert to Issue #4

@shiimaxx shiimaxx closed this Jun 3, 2022
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

Successfully merging this pull request may close these issues.

1 participant