From e4498a68be5a513dd81435f3646cf38a7abb7172 Mon Sep 17 00:00:00 2001 From: Kit Ewbank Date: Mon, 14 Mar 2022 14:41:13 -0400 Subject: [PATCH 1/3] Route 53 Domains is only available in us-east-1. --- internal/conns/conns.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/internal/conns/conns.go b/internal/conns/conns.go index 356e90b5341..528d9a79cbe 100644 --- a/internal/conns/conns.go +++ b/internal/conns/conns.go @@ -1524,6 +1524,8 @@ 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 { + o.Region = endpoints.UsEast1RegionID } }), Route53RecoveryControlConfigConn: route53recoverycontrolconfig.New(sess.Copy(&aws.Config{Endpoint: aws.String(c.Endpoints[Route53RecoveryControlConfig])})), From 4098987088c7b5c1088f37d77c9327a57b84f403 Mon Sep 17 00:00:00 2001 From: Kit Ewbank Date: Mon, 14 Mar 2022 14:48:21 -0400 Subject: [PATCH 2/3] Ensure that partition is AWS Commercial when setting Route 53 Domains Region to us-east-1. --- internal/conns/conns.go | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/internal/conns/conns.go b/internal/conns/conns.go index 528d9a79cbe..50e63124034 100644 --- a/internal/conns/conns.go +++ b/internal/conns/conns.go @@ -1265,7 +1265,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) } @@ -1496,7 +1496,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])})), @@ -1524,7 +1524,8 @@ 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 { + } else if partition == endpoints.AwsPartitionID { + // Route 53 Domains is only available in AWS Commercial us-east-1 Region. o.Region = endpoints.UsEast1RegionID } }), @@ -1624,7 +1625,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) From 4243f4a2b8da148945275a269de9555df47941f0 Mon Sep 17 00:00:00 2001 From: Kit Ewbank Date: Mon, 14 Mar 2022 14:52:10 -0400 Subject: [PATCH 3/3] Add CHANGELOG entry. --- .changelog/23672.txt | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 .changelog/23672.txt diff --git a/.changelog/23672.txt b/.changelog/23672.txt new file mode 100644 index 00000000000..99834f58fa2 --- /dev/null +++ b/.changelog/23672.txt @@ -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 +``` \ No newline at end of file