-
Notifications
You must be signed in to change notification settings - Fork 3.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CDK_DEFAULT_ACCOUNT Environment variable not respected #3289
Comments
Obviously, I've obfuscated the account ID. I'v verified that when using my active profile the session is valid and as identified in the bug report, when explicitly defining the account ID and region in the |
I was having a similar problem yesterday, and found a resolution here: #3083 Hope that helps! |
Hi @cynicaljoy, @sjschmidt44 provided what should be a helpful link in resolving this problem (thank you for the assist!). Let me know if the information helped resolve this problem, and I will close out the issue, otherwise I will investigate further. |
That worked, however I'd say some documentation about the use of CDK_DEFAULT_REGION and CDK_DEFAULT_ACCOUNT could be added.
This indicates to me that these environment variables are integrated into the cdk.StackProps -- not that I have to explicitly define the |
@cynicaljoy glad to hear that worked for you, and I really appreciate the input! I will definitely pass it along for consideration for the next docs rev. Please let us know if you run into any other problems! |
We have recently updated this topic. Can you read through it and let us know if it explains this behavior properly? |
I am wondering if this should be re-opened. I am running synth and deploy fine, with my credentials specified in the ~/.aws/config and an an existing ~/.aws/credentials. As soon as I include a lookup, I get the behaviour described above and I can fix it by providing an env in code. While I understand that synth needs credentials for the lookup, I do not see why it cannot work in the same way as deploy, which obviously finds the correct account information, even when not given in code. |
Agree with the above ^ |
I'm submitting a ...
What is the current behavior?
If the current behavior is a πͺ²bugπͺ²: Please provide the steps to reproduce
When using a Stack that contains:
ec2.Vpc.fromLookup
I'm unable to use the CDK_ACCOUNT_DEFAULT environment variable to complete a lookup. If I specify the region & account ID in the cdk.StackProps then it works, but that isn't going to work for my use case. We promote stacks to an Integration account before moving to our Production account. Stacks need to be account agnostic.CDK_ACCOUNT_DEFAULT=555555555555 cdk list --verbose
Result
Should be able to define the desired account ID with the CDK_ACCOUNT_DEFAULT variable. Really, I would vote for CDK to respect the AWS_PROFILE environment variable.
What is the motivation / use case for changing the behavior or adding this feature?
Please tell us about your environment:
Other information
We're using AWS SSO and credentials for given accounts are managed through aws-cli profiles. Default profile is meaningless, we move between accounts using named profiles and updating the AWS_PROFILE environment variable.
The text was updated successfully, but these errors were encountered: