terraform-aws-control_tower_account_factory
terraform-aws-control_tower_account_factory copied to clipboard
AuthFailure in new region
AFT Version: 1.6.3
Bug Description
With a global customizations i can't access to "new" AWS regions like af-south-1 or me-south-1 (inside the account, the region is already activated and i can launch the command)
For example (in codepipeline with global customizations in post-api) with :
aws ec2 describe-subnets --region af-south-1
i get
An error occurred (AuthFailure) when calling the DescribeVpcs operation: AWS was not able to validate the provided access credentials
and directly in the account with the credentials it's working
Any idea how it's possible ?
Thanks
AWS Control Tower is not available in these regions. Please see, https://docs.aws.amazon.com/controltower/latest/userguide/region-how.html
Thanks @hanafya for the answer but i don't understand how Control Tower intervene here, it's only AFT with CodePipeline/CodeBuild & Assume role no ?
AWS Control Tower is not supported in af-south-1 or me-south-1. Some functionality, such as EnabledControls, will not work in these regions. As such, it is possible that you may experience errors using AFT in these regions.
Specifically addressing your AuthFailure
error, this is due to AWS CLI version that ships with the CodeBuild container image used in the customization pipelines. In v1 of the AWS CLI, STS Tokens generate default to using the global STS endpoint which fail in opt-in regions.
For more information, please see: https://docs.aws.amazon.com/sdkref/latest/guide/feature-sts-regionalized-endpoints.html
I've created a backlog to address this with the team.
Hi @Menahem1,
As of AFT 1.11.0, AFT uses the aws/codebuild/amazonlinux2-x86_64-standard:5.0
container image for CodeBuild jobs, which ships with the AWS CLI v2 by default.
The AWS CLI v2 uses regional endpoints by default so this issue should be resolved for AFT versions 1.11.0+ when using the AWS CLI.
When using AWS SDKs, note that you must set the AWS_STS_REGIONAL_ENDPOINTS=regional
envvar for this behavior. See: https://docs.aws.amazon.com/sdkref/latest/guide/feature-sts-regionalized-endpoints.html