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(cloudfront): EdgeFunction us-east-1 stack created in different account #13055

Merged
merged 3 commits into from
Feb 15, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,10 @@ export class EdgeFunction extends Resource implements lambda.IVersion {
let edgeStack = stage.node.tryFindChild(edgeStackId) as Stack;
if (!edgeStack) {
edgeStack = new Stack(stage, edgeStackId, {
env: { region: EdgeFunction.EDGE_REGION },
env: {
region: EdgeFunction.EDGE_REGION,
account: Stack.of(this).account,
},
});
}
this.stack.addDependency(edgeStack);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,14 @@ describe('stacks', () => {
});
});

test('us-east-1 stack inherits account of parent stack', () => {
njlynch marked this conversation as resolved.
Show resolved Hide resolved
new cloudfront.experimental.EdgeFunction(stack, 'MyFn', defaultEdgeFunctionProps());

const fnStack = getFnStack();

expect(fnStack.account).toEqual('111111111111');
});

test('creates minimal constructs if scope region is us-east-1', () => {
app = new cdk.App();
stack = new cdk.Stack(app, 'Stack', {
Expand Down