Merge pull request #1092 from hashicorp/aws-go-s3-fix-region-bug
provider/aws: Special case us-east-1 for S3 bucket creation
This commit is contained in:
commit
23d90c0c02
|
@ -46,9 +46,14 @@ func resourceAwsS3BucketCreate(d *schema.ResourceData, meta interface{}) error {
|
||||||
req := &s3.CreateBucketRequest{
|
req := &s3.CreateBucketRequest{
|
||||||
Bucket: aws.String(bucket),
|
Bucket: aws.String(bucket),
|
||||||
ACL: aws.String(acl),
|
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),
|
LocationConstraint: aws.String(awsRegion),
|
||||||
},
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
_, err := s3conn.CreateBucket(req)
|
_, err := s3conn.CreateBucket(req)
|
||||||
|
|
Loading…
Reference in New Issue