aws-cdk: incorrect region resolution for explicitly passed profiles #28294
Labels
bug
This issue is a bug.
needs-triage
This issue or PR still needs to be triaged.
package/tools
Related to AWS CDK Tools or CLI
Describe the bug
Following the documentation:
However, despite specifying the profile using the --profile option, a different AWS region is selected, which happened to be (accidentally) exposed by our CI runners, which are running in a different region.
We could of course fall back on setting the region using alternate manners, but the profile resolution allows us to centralize the configuration relatively low in effort.
Expected Behavior
We expected the ini configuration files to be read, based on the explicitly passed profile.
CDK_DEFAULT_ACCOUNT
andCDK_DEFAULT_REGION
would then be set according to these.Current Behavior
CDK_DEFAULT_ACCOUNT
is correctly based on the passed profile, butCDK_DEFAULT_REGION
is taken from a pre-existingAWS_REGION
.Reproduction Steps
Reproduction repository, with instructions available at:
https://github.com/wuhkuh/aws-cdk-repro
Possible Solution
Something like this would resolve it (please excuse the automatic linter, sorry!):
packages/aws-cdk/lib/api/aws-auth/awscli-compatible.ts
Additional Information/Context
No response
CDK CLI Version
2.114.1
Framework Version
No response
Node.js Version
20.10.0
OS
Manjaro Linux (64-bit)
Language
TypeScript
Language Version
TypeScript (5.3.2)
Other information
No response
The text was updated successfully, but these errors were encountered: