Skip to content

Commit

Permalink
Merge pull request #9429 from hashicorp/f-aws-new-region
Browse files Browse the repository at this point in the history
aws: Add missing metadata for us-east-2
  • Loading branch information
jen20 authored Oct 18, 2016
2 parents 7c2f62c + 4b36bc3 commit 0c4b4a1
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ var elbAccountIdPerRegionMap = map[string]string{
"eu-west-1": "156460612806",
"sa-east-1": "507241528517",
"us-east-1": "127311923021",
"us-east-2": "033677994240",
"us-gov-west": "048591011584",
"us-west-1": "027434742980",
"us-west-2": "797873946194",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
// See http://docs.aws.amazon.com/redshift/latest/mgmt/db-auditing.html#db-auditing-enable-logging
var redshiftServiceAccountPerRegionMap = map[string]string{
"us-east-1": "193672423079",
"us-east-2": "391106570357",
"us-west-1": "262260360010",
"us-west-2": "902366379725",
"ap-south-1": "865932855811",
Expand Down
1 change: 1 addition & 0 deletions builtin/providers/aws/hosted_zones.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ package aws
// It currently cannot be generated from the API json.
var hostedZoneIDsMap = map[string]string{
"us-east-1": "Z3AQBSTGFYJSTF",
"us-east-2": "Z2O1EMRO9K5GLX",
"us-west-2": "Z3BJ6K6RIION7M",
"us-west-1": "Z2F56UZL2M1ACD",
"eu-west-1": "Z1BKCTXD74EZPE",
Expand Down
25 changes: 22 additions & 3 deletions builtin/providers/aws/resource_aws_s3_bucket.go
Original file line number Diff line number Diff line change
Expand Up @@ -1107,11 +1107,30 @@ func WebsiteDomainUrl(region string) string {

// New regions uses different syntax for website endpoints
// http://docs.aws.amazon.com/AmazonS3/latest/dev/WebsiteEndpoints.html
if region == "eu-central-1" || region == "ap-south-1" || region == "ap-northeast-2" {
return fmt.Sprintf("s3-website.%s.amazonaws.com", region)
if isOldRegion(region) {
return fmt.Sprintf("s3-website-%s.amazonaws.com", region)
}
return fmt.Sprintf("s3-website.%s.amazonaws.com", region)
}

return fmt.Sprintf("s3-website-%s.amazonaws.com", region)
func isOldRegion(region string) bool {
oldRegions := []string{
"ap-northeast-1",
"ap-southeast-1",
"ap-southeast-2",
"eu-west-1",
"sa-east-1",
"us-east-1",
"us-gov-west-1",
"us-west-1",
"us-west-2",
}
for _, r := range oldRegions {
if region == r {
return true
}
}
return false
}

func resourceAwsS3BucketAclUpdate(s3conn *s3.S3, d *schema.ResourceData) error {
Expand Down

0 comments on commit 0c4b4a1

Please sign in to comment.