From 0b6a0af4b7f44c8cf06b787237416b04aec16ae0 Mon Sep 17 00:00:00 2001 From: James Kwon Date: Wed, 3 Apr 2024 18:26:17 -0400 Subject: [PATCH] condition to allow multi region list only to us-west-2 --- aws/resources/s3_multi_region_access_point.go | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/aws/resources/s3_multi_region_access_point.go b/aws/resources/s3_multi_region_access_point.go index 272b5a303..af6e605e8 100644 --- a/aws/resources/s3_multi_region_access_point.go +++ b/aws/resources/s3_multi_region_access_point.go @@ -14,6 +14,16 @@ import ( ) func (ap *S3MultiRegionAccessPoint) getAll(c context.Context, configObj config.Config) ([]*string, error) { + // NOTE: All control plane requests to create or maintain Multi-Region Access Points must be routed to the US West (Oregon) Region. + // Reference: https://docs.aws.amazon.com/AmazonS3/latest/userguide/MultiRegionAccessPointRestrictions.html + // + // To avoid receiving the error `PermanentRedirect: This API operation is only available in the following Regions: us-west-2. Make sure to send all future requests to a supported Region`, + // we must ensure that the region is set to us-west-2. + if ap.Region != "us-west-2" { + logging.Debugf("Listing Multi-Region Access Points is only available in the following Region: us-west-2.") + return nil, nil + } + accountID, ok := c.Value(util.AccountIdKey).(string) if !ok { logging.Errorf("unable to read the account-id from context") @@ -37,6 +47,7 @@ func (ap *S3MultiRegionAccessPoint) getAll(c context.Context, configObj config.C } return !lastPage }) + if err != nil { logging.Errorf("[FAILED] Multi region access point listing - %v", err) }