From af57b3db69cc3a2e0bc686ca81f4f1026866fddd Mon Sep 17 00:00:00 2001 From: Clint Shryock Date: Mon, 2 Mar 2015 11:13:19 -0600 Subject: [PATCH] provider/aws: Special case us-east-1 for S3 bucket creation. --- builtin/providers/aws/resource_aws_s3_bucket.go | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/builtin/providers/aws/resource_aws_s3_bucket.go b/builtin/providers/aws/resource_aws_s3_bucket.go index 7e1b6ccbb..d832190b0 100644 --- a/builtin/providers/aws/resource_aws_s3_bucket.go +++ b/builtin/providers/aws/resource_aws_s3_bucket.go @@ -46,9 +46,14 @@ func resourceAwsS3BucketCreate(d *schema.ResourceData, meta interface{}) error { req := &s3.CreateBucketRequest{ Bucket: aws.String(bucket), ACL: aws.String(acl), - CreateBucketConfiguration: &s3.CreateBucketConfiguration{ + } + + // Special case us-east-1 region and do not set the LocationConstraint. + // See "Request Elements: http://docs.aws.amazon.com/AmazonS3/latest/API/RESTBucketPUT.html + if awsRegion != "us-east-1" { + req.CreateBucketConfiguration = &s3.CreateBucketConfiguration{ LocationConstraint: aws.String(awsRegion), - }, + } } _, err := s3conn.CreateBucket(req)