Skip to content

Commit

Permalink
Merge pull request #23672 from hashicorp/b-route53domains-us-east-1-only
Browse files Browse the repository at this point in the history
Route 53 Domains available only in `us-east-1`
  • Loading branch information
ewbankkit authored Mar 15, 2022
2 parents 78db4b6 + 4243f4a commit deaf250
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
3 changes: 3 additions & 0 deletions .changelog/23672.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:bug
resource/aws_route53domains_registered_domain: Redirect all Route 53 Domains AWS API calls to the `us-east-1` Region
```
9 changes: 6 additions & 3 deletions internal/conns/conns.go
Original file line number Diff line number Diff line change
Expand Up @@ -1266,7 +1266,7 @@ func (c *Config) Client(ctx context.Context) (interface{}, diag.Diagnostics) {
return nil, diag.Errorf("error creating AWS SDK v1 session: %s", err)
}

accountID, Partition, err := awsbase.GetAwsAccountIDAndPartition(ctx, cfg, &awsbaseConfig)
accountID, partition, err := awsbase.GetAwsAccountIDAndPartition(ctx, cfg, &awsbaseConfig)
if err != nil {
return nil, diag.Errorf("error retrieving account details: %s", err)
}
Expand Down Expand Up @@ -1497,7 +1497,7 @@ func (c *Config) Client(ctx context.Context) (interface{}, diag.Diagnostics) {
OpsWorksConn: opsworks.New(sess.Copy(&aws.Config{Endpoint: aws.String(c.Endpoints[OpsWorks])})),
OrganizationsConn: organizations.New(sess.Copy(&aws.Config{Endpoint: aws.String(c.Endpoints[Organizations])})),
OutpostsConn: outposts.New(sess.Copy(&aws.Config{Endpoint: aws.String(c.Endpoints[Outposts])})),
Partition: Partition,
Partition: partition,
PersonalizeConn: personalize.New(sess.Copy(&aws.Config{Endpoint: aws.String(c.Endpoints[Personalize])})),
PersonalizeEventsConn: personalizeevents.New(sess.Copy(&aws.Config{Endpoint: aws.String(c.Endpoints[PersonalizeEvents])})),
PersonalizeRuntimeConn: personalizeruntime.New(sess.Copy(&aws.Config{Endpoint: aws.String(c.Endpoints[PersonalizeRuntime])})),
Expand Down Expand Up @@ -1525,6 +1525,9 @@ func (c *Config) Client(ctx context.Context) (interface{}, diag.Diagnostics) {
Route53DomainsConn: route53domains.NewFromConfig(cfg, func(o *route53domains.Options) {
if endpoint := c.Endpoints[Route53Domains]; endpoint != "" {
o.EndpointResolver = route53domains.EndpointResolverFromURL(endpoint)
} else if partition == endpoints.AwsPartitionID {
// Route 53 Domains is only available in AWS Commercial us-east-1 Region.
o.Region = endpoints.UsEast1RegionID
}
}),
Route53RecoveryControlConfigConn: route53recoverycontrolconfig.New(sess.Copy(&aws.Config{Endpoint: aws.String(c.Endpoints[Route53RecoveryControlConfig])})),
Expand Down Expand Up @@ -1624,7 +1627,7 @@ func (c *Config) Client(ctx context.Context) (interface{}, diag.Diagnostics) {
client.S3ConnURICleaningDisabled = s3.New(sess.Copy(s3Config))

// Force "global" services to correct regions
switch Partition {
switch partition {
case endpoints.AwsPartitionID:
globalAcceleratorConfig.Region = aws.String(endpoints.UsWest2RegionID)
route53Config.Region = aws.String(endpoints.UsEast1RegionID)
Expand Down

0 comments on commit deaf250

Please sign in to comment.