Skip to content
This repository was archived by the owner on Apr 22, 2025. It is now read-only.
Closed
Show file tree
Hide file tree
Changes from all commits
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
30 changes: 30 additions & 0 deletions packages/@aws-cdk-testing/cli-integ/resources/cdk-apps/app/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -830,6 +830,33 @@ class MetadataStack extends cdk.Stack {
}
}

class LookupDummyStack extends cdk.Stack {
constructor(parent, id, props) {
super(parent, id, props);
const response = cdk.ContextProvider.getValue(this, {
provider: 'cc-api-provider',
props: {
typeName: 'AWS::IAM::Role',
exactIdentifier: 'DUMMY_ID',
propertiesToReturn: [
'Arn',
],
},
ignoreErrorOnMissingContext: true,
dummyValue: [
{
Arn: 'arn:aws:iam::123456789012:role/DUMMY_ARN',
},
],
}).value;

const dummy = response[0];
new cdk.CfnOutput(this, 'Dummy', {
value: dummy.Arn,
});
}
}

const app = new cdk.App({
context: {
'@aws-cdk/core:assetHashSalt': process.env.CODEBUILD_BUILD_ID ?? process.env.GITHUB_RUN_ID, // Force all assets to be unique, but consistent in one build
Expand Down Expand Up @@ -931,6 +958,9 @@ switch (stackSet) {
new BundlingStage(app, `${stackPrefix}-bundling-stage`);

new MetadataStack(app, `${stackPrefix}-metadata`);

const env = { account: process.env.CDK_DEFAULT_ACCOUNT, region: process.env.CDK_DEFAULT_REGION };
new LookupDummyStack(app, `${stackPrefix}-lookup-dummy`, { env });
break;

case 'stage-using-context':
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2967,3 +2967,19 @@ integTest('requests go through a proxy when configured',
}
}),
);

integTest(
'can return dummy value from lookup',
withDefaultFixture(async (fixture) => {
await fixture.cdk(['synth', fixture.fullStackName('lookup-dummy')]);
expect(fixture.template('lookup-dummy')).toEqual(
expect.objectContaining({
Outputs: {
Dummy: {
Value: 'arn:aws:iam::123456789012:role/DUMMY_ARN',
},
},
}),
);
}),
);
Loading