Terraform: providers/aws: add aws_s3_bucket resource region argument

Created on 6 Apr 2016  ยท  8Comments  ยท  Source: hashicorp/terraform

The current version of aws_s3_bucket doesn't support the region argument. It accepts input and will show it in planning / apply, but it doesn't apply it and throws no errors.

Having this as a feature would be useful for defining resources outside your default region (which is often us-east-1, due to some global resources not being available in every region).

Terraform v0.6.15-dev (aef5bcf98227b0ac964657a29ef2a1ebeed19a51)

enhancement provideaws

Most helpful comment

Yep looks like we read the region from the client, but don't fetch the value from the config to override it. Should be a pretty easy fix!

All 8 comments

In v0.6.16 you can specify the region for an aws_s3_bucket, but it seems the attribute was left out from the documentation.

@marcoamorales It's looks visible in the code, but if you test it, you'll see it doesn't work:

resource "aws_s3_bucket" "b" {
    bucket = "terraform-test-delete-me"
    region = "us-west-2"
    tags {
        Name = "terraform-test-delete-me"
    }
}

The above says it applies successfully, but instead uses the global region used by terraform. (from ENV or the provider aws block.)

The reason is that Terraform uses helpers to initiate the golang SDK for every possible resource when it starts up, I wasn't able to think of a clean (non-hacky) way of re-initiating the helper each time a new S3 resource is requested.

Of note, I found that it's kind of mute since you can specify the region on a per module basis.

Also interested in region support for s3 buckets.

We have a use case where a single module needs to create an S3 buckets in multiple regions. In fact, they're being created in the same aws_s3_bucket resource; driven by a map variable containing bucket names and their desired region (which does not work).

Between this issue and #3072 / #1819, there's no way to do this in a generic way driven by vars.

Yep looks like we read the region from the client, but don't fetch the value from the config to override it. Should be a pretty easy fix!

Hi guys,

Just worked on this in #10482 . Hope it will fit!

I am still experiencing this error. I shouldn't have to define another provider to access another region. It's not respecting region flag inside the bucket.

I'm going to lock this issue because it has been closed for _30 days_ โณ. This helps our maintainers find and focus on the active issues.

If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

atkinchris picture atkinchris  ยท  68Comments

kforsthoevel picture kforsthoevel  ยท  86Comments

jszwedko picture jszwedko  ยท  77Comments

glenjamin picture glenjamin  ยท  112Comments

gwagner picture gwagner  ยท  81Comments