Skip to content
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

fix: populate custom resources CDK stacks with region and account (#12575) #13316

Open
wants to merge 3 commits into
base: dev
Choose a base branch
from

Conversation

bombguy
Copy link
Contributor

@bombguy bombguy commented Oct 9, 2023

Description of changes

Custom resource should populate with region and account from CDK default variables.

https://docs.aws.amazon.com/cdk/v2/guide/environments.html

Issue #, if available

#12575

Description of how you validated changes

Manual testing, unit test & e2e tests added

Checklist

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@bombguy bombguy requested a review from a team as a code owner October 9, 2023 15:02
Comment on lines +148 to +151
// should pickup to default cdk env vars and build cfn stack.
process.env.CDK_DEFAULT_ACCOUNT = 'some_id';
process.env.CDK_DEFAULT_REGION = process.env.CLI_REGION;
await amplifyPushAuth(projRoot);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this lacks assertion.
we have developed the following mechanism in override tests to assert that injected values actually work

if (amplifyProjectInfo.envName != '##EXPECTED_ENV_NAME') {
throw new Error(`Unexpected envName: ${amplifyProjectInfo.envName}`);
}
if (amplifyProjectInfo.projectName != '##EXPECTED_PROJECT_NAME') {
throw new Error(`Unexpected envName: ${amplifyProjectInfo.envName}`);
}

Can we please use similar pattern in barebone-cdk-stack.ts ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants