[cli] CDK_DEFAULT_ACCOUNT not set when using MFA and --profile specified #10048
Labels
bug
This issue is a bug.
closed-for-staleness
This issue was automatically closed because it hadn't received any attention in a while.
effort/medium
Medium work item – several days of effort
p1
package/tools
Related to AWS CDK Tools or CLI
It looks like #6510 has caused a regression when using profiles with MFA on the cli. It seems when
--profile
is specified and the profile contains anmfa_serial
then--verbose
shows a message sayingUnable to determine the default AWS account
after entering a valid MFA code. When synth runs the value of theCDK_DEFAULT_ACCOUNT
environment variable is blank.This is a breaking change for us. We were successfully using
aws-mfa
with profiles before1.60.0
as a workaround to not having official mfa support. I have confirmed1.59.0
does not have this issue. I couldn't quite getaws-mfa
to work with1.60.0
either to see if I could still work around this, so probably can't take this version until this is resolved.Reproduction Steps
Set up a profile in
~/.aws/credentials
Set up a minimal stack and at the beginning of the program try to load the default account and error out if it's not present.
Run
cdk synth --profile cool-guy
What did you expect to happen?
I expect given I'm invoking a cdk command with a
--profile
when I enter my MFA code it correctly sets the value ofCDK_DEFAULT_ACCOUNT
What actually happened?
--verbose
shows an error messageUnable to determine the default AWS account
and the value of the environment variableCDK_DEFAULT_ACCOUNT
is empty when my cdk code is executing.Environment
This is 🐛 Bug Report
The text was updated successfully, but these errors were encountered: