Skip to content

Commit

Permalink
condition to allow multi region list only to us-west-2
Browse files Browse the repository at this point in the history
  • Loading branch information
james03160927 committed Apr 5, 2024
1 parent 97c6f91 commit 0b6a0af
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions aws/resources/s3_multi_region_access_point.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand All @@ -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)
}
Expand Down

0 comments on commit 0b6a0af

Please sign in to comment.