UNPKG

@aws-cdk-testing/cli-integ

Version:

Integration tests for the AWS CDK CLI

66 lines (55 loc) 1.68 kB
if (process.env.PACKAGE_LAYOUT_VERSION === '1') { var cfn = require('@aws-cdk/aws-cloudformation'); var sns = require('@aws-cdk/aws-sns'); var { Stack, CfnParameter } = require('@aws-cdk/core'); } else { var { aws_cloudformation: cfn, aws_sns: sns, } = require('aws-cdk-lib'); var { Stack, CfnParameter } = require('aws-cdk-lib'); } class StackWithNestedStack extends Stack { constructor(scope, id) { super(scope, id); new MyNestedStack(this, 'MyNested'); } } class MyNestedStack extends cfn.NestedStack { constructor(scope, id) { super(scope, id); new sns.Topic(this, 'MyTopic'); } } class DoublyNestedStack extends cfn.NestedStack { constructor(scope, id) { super(scope, id); new MyNestedStack(this, 'Nestor'); } } class StackWithDoublyNestedStack extends Stack { constructor(scope, id) { super(scope, id); new DoublyNestedStack(this, 'DoubleDouble'); } } class StackWithNestedStackUsingParameters extends Stack { constructor(scope, id) { super(scope, id); const topicNameParam = new CfnParameter(this, 'MyTopicParam'); new MyNestedStackUsingParameters(this, 'MyNested', { parameters: {'MyTopicParam': topicNameParam.valueAsString} }); } } class MyNestedStackUsingParameters extends cfn.NestedStack { constructor(scope, id, props) { super(scope, id, props); new sns.Topic(this, 'MyTopic', { topicName: new CfnParameter(this, 'MyTopicParam') }); } } exports.StackWithNestedStack = StackWithNestedStack; exports.StackWithNestedStackUsingParameters = StackWithNestedStackUsingParameters; exports.StackWithDoublyNestedStack = StackWithDoublyNestedStack;