-
Notifications
You must be signed in to change notification settings - Fork 9.3k
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
Cannot create S3 buckets in multiple regions #8853
Comments
Needing multiple providers is especially a pain when your provider configuration is non-trivial, because there isn't a way to inherit provider configuration, so you have to copy-paste all of your provider configuration for each region, and then make changes to each region instead of just one place. |
I just ran into a case where this causes quite a bit of pain for me. I have a module where I want to optionally create a backup s3 bucket in another region. Something like this: My first attempt was just to use the
but then it complains that the provider configuration reference is invalid:
So I tried changing the provider to "aws.backup" all the time, but then I need to provide the aws.backup provider to the module, even if I don't create the bucket (count is zero). Otherwise I get an error that the provider configuration is not present for aws.backupj. If I could just specify a region from a module variable this would be a lot simpler. See https://stackoverflow.com/questions/57577536/terraform-optional-provider-for-optional-resource |
I just ran into this but there were no errors reported. I had initially created 4 S3 buckets without specifying the region so they were all created in us-east-1. My requirements changed so they each had to go into separate regions (us-east-1, us-east-2, us-west-1, us-west-2). I changed the templates to include the region value. Terraform correctly reported that 3 of 4 would have their region changed and that they would be updated in-place (which surprised me). It then looked like the changes were applied successfully (no errors). However when I output the bucket regions they were unchanged. Repeated runs resulted in the same proposed changes and results.
This is made particularly difficult since |
I'm having a similar issue here I think.. I want to create a Config rule involving CloudFront that is only available in us-east-1 (CloudFront is a global service). The rest of my resources are in eu-west-1 and are part of the same module. I need a way of specifying the region for a particular resource without having to replicate the provider block for all resources in the module. |
I'm also facing a similar issue. I have multiple regions I'd like to create buckets in. Ideally I would like to use |
Please see #27758 (comment) for the proposed solution to this issue. |
Community Note
Terraform Version
Affected Resource(s)
Terraform Configuration Files
Debug Output
https://gist.github.com/ryaninvents/978df245050a0726580a4a4ae59f16f3
Panic Output
No panic encountered.
Expected Behavior
Terraform should have used the
region
field to correctly create one bucket in each of two regions. Thes3_bucket
documentation states:region
- (Optional) If specified, the AWS region this bucket should reside in. Otherwise, the region used by the callee.This implies that it is possible to choose a region other than the one chosen by the provider. Unfortunately I am
import
ing existing buckets which is why I am not free to place them both in the same region.Actual Behavior
Steps to Reproduce
terraform init
terraform apply
References
region
attribute in thes3_bucket
resource, I think it is a bug in the provider to require separate providers for each region.The text was updated successfully, but these errors were encountered: