Skip to content

Commit 81c3af0

Browse files
committed
Rename 'nestedStacks' to 'includeNestedStacks' for consistency.
1 parent 094d843 commit 81c3af0

File tree

5 files changed

+37
-37
lines changed

5 files changed

+37
-37
lines changed

packages/@aws-cdk/cloudformation-include/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,7 @@ and the nested stack in your CDK application as follows:
274274
```typescript
275275
const parentTemplate = new inc.CfnInclude(this, 'ParentStack', {
276276
templateFile: 'path/to/my-parent-template.json',
277-
nestedStacks: {
277+
includeNestedStacks: {
278278
'ChildStack': {
279279
templateFile: 'path/to/my-nested-template.json',
280280
},

packages/@aws-cdk/cloudformation-include/lib/cfn-include.ts

+6-6
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ export interface CfnIncludeProps {
4040
*
4141
* @default - no nested stacks will be included
4242
*/
43-
readonly nestedStacks?: { [stackName: string]: CfnIncludeProps };
43+
readonly includeNestedStacks?: { [stackName: string]: CfnIncludeProps };
4444

4545
/**
4646
* Specifies parameters to be replaced by the values in this mapping.
@@ -134,13 +134,13 @@ export class CfnInclude extends core.CfnElement {
134134
this.createRule(ruleName);
135135
}
136136

137-
this.nestedStacksToInclude = props.nestedStacks || {};
137+
this.nestedStacksToInclude = props.includeNestedStacks || {};
138138
// instantiate all resources as CDK L1 objects
139139
for (const logicalId of Object.keys(this.template.Resources || {})) {
140140
this.getOrCreateResource(logicalId);
141141
}
142142
// verify that all nestedStacks have been instantiated
143-
for (const nestedStackId of Object.keys(props.nestedStacks || {})) {
143+
for (const nestedStackId of Object.keys(props.includeNestedStacks || {})) {
144144
if (!(nestedStackId in this.resources)) {
145145
throw new Error(`Nested Stack with logical ID '${nestedStackId}' was not found in the template`);
146146
}
@@ -293,7 +293,7 @@ export class CfnInclude extends core.CfnElement {
293293
* Includes a template for a child stack inside of this parent template.
294294
* A child with this logical ID must exist in the template,
295295
* and be of type AWS::CloudFormation::Stack.
296-
* This is equivalent to specifying the value in the {@link CfnIncludeProps.nestedStacks}
296+
* This is equivalent to specifying the value in the {@link CfnIncludeProps.includeNestedStacks}
297297
* property on object construction.
298298
*
299299
* @param logicalId the ID of the stack to retrieve, as it appears in the template
@@ -343,7 +343,7 @@ export class CfnInclude extends core.CfnElement {
343343
/**
344344
* Returns the NestedStack with name logicalId.
345345
* For a nested stack to be returned by this method,
346-
* it must be specified either in the {@link CfnIncludeProps.nestedStacks} property,
346+
* it must be specified either in the {@link CfnIncludeProps.includeNestedStacks} property,
347347
* or through the {@link includeNestedStack} method.
348348
*
349349
* @param logicalId the ID of the stack to retrieve, as it appears in the template
@@ -355,7 +355,7 @@ export class CfnInclude extends core.CfnElement {
355355
} else if (this.template.Resources[logicalId].Type !== 'AWS::CloudFormation::Stack') {
356356
throw new Error(`Resource with logical ID '${logicalId}' is not a CloudFormation Stack`);
357357
} else {
358-
throw new Error(`Nested Stack '${logicalId}' was not included in the nestedStacks property when including the parent template`);
358+
throw new Error(`Nested Stack '${logicalId}' was not included in the includeNestedStacks property when including the parent template`);
359359
}
360360
}
361361
return this.nestedStacks[logicalId];

packages/@aws-cdk/cloudformation-include/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -332,7 +332,7 @@
332332
},
333333
"awslint": {
334334
"exclude": [
335-
"props-no-cfn-types:@aws-cdk/cloudformation-include.CfnIncludeProps.nestedStacks"
335+
"props-no-cfn-types:@aws-cdk/cloudformation-include.CfnIncludeProps.includeNestedStacks"
336336
]
337337
},
338338
"stability": "experimental",

packages/@aws-cdk/cloudformation-include/test/integ.nested-stacks.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ const stack = new core.Stack(app, 'ParentStack');
77

88
new inc.CfnInclude(stack, 'ParentStack', {
99
templateFile: 'test-templates/nested/parent-one-child.json',
10-
nestedStacks: {
10+
includeNestedStacks: {
1111
ChildStack: {
1212
templateFile: 'test-templates/nested/grandchild-import-stack.json',
1313
},

packages/@aws-cdk/cloudformation-include/test/nested-stacks.test.ts

+28-28
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ describe('CDK Include for nested stacks', () => {
1919
test('can ingest a template with one child', () => {
2020
const parentTemplate = new inc.CfnInclude(stack, 'ParentStack', {
2121
templateFile: testTemplateFilePath('parent-one-child.json'),
22-
nestedStacks: {
22+
includeNestedStacks: {
2323
'ChildStack': {
2424
templateFile: testTemplateFilePath('grandchild-import-stack.json'),
2525
},
@@ -35,7 +35,7 @@ describe('CDK Include for nested stacks', () => {
3535
test('can ingest a template with two children', () => {
3636
const parentTemplate = new inc.CfnInclude(stack, 'ParentStack', {
3737
templateFile: testTemplateFilePath('parent-two-children.json'),
38-
nestedStacks: {
38+
includeNestedStacks: {
3939
'ChildStack': {
4040
templateFile: testTemplateFilePath('grandchild-import-stack.json'),
4141
},
@@ -59,10 +59,10 @@ describe('CDK Include for nested stacks', () => {
5959
test('can ingest a template with one child and one grandchild', () => {
6060
const parentTemplate = new inc.CfnInclude(stack, 'ParentStack', {
6161
templateFile: testTemplateFilePath('parent-two-children.json'),
62-
nestedStacks: {
62+
includeNestedStacks: {
6363
'ChildStack': {
6464
templateFile: testTemplateFilePath('child-import-stack.json'),
65-
nestedStacks: {
65+
includeNestedStacks: {
6666
'GrandChildStack': {
6767
templateFile: testTemplateFilePath('grandchild-import-stack.json'),
6868
},
@@ -86,7 +86,7 @@ describe('CDK Include for nested stacks', () => {
8686
expect(() => {
8787
new inc.CfnInclude(stack, 'ParentStack', {
8888
templateFile: testTemplateFilePath('parent-two-children.json'),
89-
nestedStacks: {
89+
includeNestedStacks: {
9090
'FakeStack': {
9191
templateFile: testTemplateFilePath('child-import-stack.json'),
9292
},
@@ -99,7 +99,7 @@ describe('CDK Include for nested stacks', () => {
9999
expect(() => {
100100
new inc.CfnInclude(stack, 'ParentStack', {
101101
templateFile: testTemplateFilePath('child-import-stack.json'),
102-
nestedStacks: {
102+
includeNestedStacks: {
103103
'BucketImport': {
104104
templateFile: testTemplateFilePath('grandchild-import-stack.json'),
105105
},
@@ -112,7 +112,7 @@ describe('CDK Include for nested stacks', () => {
112112
expect(() => {
113113
new inc.CfnInclude(stack, 'ParentStack', {
114114
templateFile: testTemplateFilePath('parent-creation-policy.json'),
115-
nestedStacks: {
115+
includeNestedStacks: {
116116
'ChildStack': {
117117
templateFile: testTemplateFilePath('grandchild-import-stack.json'),
118118
},
@@ -125,7 +125,7 @@ describe('CDK Include for nested stacks', () => {
125125
expect(() => {
126126
new inc.CfnInclude(stack, 'ParentStack', {
127127
templateFile: testTemplateFilePath('parent-update-policy.json'),
128-
nestedStacks: {
128+
includeNestedStacks: {
129129
'ChildStack': {
130130
templateFile: testTemplateFilePath('grandchild-import-stack.json'),
131131
},
@@ -138,7 +138,7 @@ describe('CDK Include for nested stacks', () => {
138138
expect(() => {
139139
new inc.CfnInclude(stack, 'ParentStack', {
140140
templateFile: testTemplateFilePath('parent-invalid-condition.json'),
141-
nestedStacks: {
141+
includeNestedStacks: {
142142
'ChildStack': {
143143
templateFile: testTemplateFilePath('grandchild-import-stack.json'),
144144
},
@@ -151,7 +151,7 @@ describe('CDK Include for nested stacks', () => {
151151
expect(() => {
152152
new inc.CfnInclude(stack, 'ParentStack', {
153153
templateFile: testTemplateFilePath('parent-bad-depends-on.json'),
154-
nestedStacks: {
154+
includeNestedStacks: {
155155
'ChildStack': {
156156
templateFile: testTemplateFilePath('child-import-stack.json'),
157157
},
@@ -160,11 +160,11 @@ describe('CDK Include for nested stacks', () => {
160160
}).toThrow(/Resource 'ChildStack' depends on 'AFakeResource' that doesn't exist/);
161161
});
162162

163-
test('throws an exception when an ID was passed in nestedStacks that is a resource type not in the CloudFormation schema', () => {
163+
test('throws an exception when an ID was passed in includeNestedStacks that is a resource type not in the CloudFormation schema', () => {
164164
expect(() => {
165165
new inc.CfnInclude(stack, 'Template', {
166166
templateFile: testTemplateFilePath('custom-resource.json'),
167-
nestedStacks: {
167+
includeNestedStacks: {
168168
'CustomResource': {
169169
templateFile: testTemplateFilePath('whatever.json'),
170170
},
@@ -176,7 +176,7 @@ describe('CDK Include for nested stacks', () => {
176176
test('can modify resources in nested stacks', () => {
177177
const parent = new inc.CfnInclude(stack, 'ParentStack', {
178178
templateFile: testTemplateFilePath('child-import-stack.json'),
179-
nestedStacks: {
179+
includeNestedStacks: {
180180
'GrandChildStack': {
181181
templateFile: testTemplateFilePath('grandchild-import-stack.json'),
182182
},
@@ -194,7 +194,7 @@ describe('CDK Include for nested stacks', () => {
194194
test('can use a condition', () => {
195195
const parent = new inc.CfnInclude(stack, 'ParentStack', {
196196
templateFile: testTemplateFilePath('parent-valid-condition.json'),
197-
nestedStacks: {
197+
includeNestedStacks: {
198198
'ChildStack': {
199199
templateFile: testTemplateFilePath('grandchild-import-stack.json'),
200200
},
@@ -209,7 +209,7 @@ describe('CDK Include for nested stacks', () => {
209209
test('asset parameters generated in parent and child are identical', () => {
210210
new inc.CfnInclude(stack, 'ParentStack', {
211211
templateFile: testTemplateFilePath('parent-one-child.json'),
212-
nestedStacks: {
212+
includeNestedStacks: {
213213
'ChildStack': {
214214
templateFile: testTemplateFilePath('grandchild-import-stack.json'),
215215
},
@@ -279,7 +279,7 @@ describe('CDK Include for nested stacks', () => {
279279
});
280280
});
281281

282-
test('templates with nested stacks that were not provided in the nestedStacks property are left unmodified', () => {
282+
test('templates with nested stacks that were not provided in the includeNestedStacks property are left unmodified', () => {
283283
new inc.CfnInclude(stack, 'ParentStack', {
284284
templateFile: testTemplateFilePath('parent-two-children.json'),
285285
});
@@ -290,7 +290,7 @@ describe('CDK Include for nested stacks', () => {
290290
test('getNestedStack() throws an exception when getting a resource that does not exist in the template', () => {
291291
const parentTemplate = new inc.CfnInclude(stack, 'ParentStack', {
292292
templateFile: testTemplateFilePath('parent-two-children.json'),
293-
nestedStacks: {
293+
includeNestedStacks: {
294294
'ChildStack': {
295295
templateFile: testTemplateFilePath('child-import-stack.json'),
296296
},
@@ -305,7 +305,7 @@ describe('CDK Include for nested stacks', () => {
305305
test('getNestedStack() throws an exception when getting a resource that exists in the template, but is not a Stack', () => {
306306
const parentTemplate = new inc.CfnInclude(stack, 'ParentStack', {
307307
templateFile: testTemplateFilePath('parent-two-children.json'),
308-
nestedStacks: {
308+
includeNestedStacks: {
309309
'ChildStack': {
310310
templateFile: testTemplateFilePath('child-import-stack.json'),
311311
},
@@ -322,7 +322,7 @@ describe('CDK Include for nested stacks', () => {
322322
test('getNestedStack() throws an exception when getting a resource that exists in the template, but was not specified in the props', () => {
323323
const parentTemplate = new inc.CfnInclude(stack, 'ParentStack', {
324324
templateFile: testTemplateFilePath('parent-two-children.json'),
325-
nestedStacks: {
325+
includeNestedStacks: {
326326
'ChildStack': {
327327
templateFile: testTemplateFilePath('child-import-stack.json'),
328328
},
@@ -331,13 +331,13 @@ describe('CDK Include for nested stacks', () => {
331331

332332
expect(() => {
333333
parentTemplate.getNestedStack('AnotherChildStack');
334-
}).toThrow(/Nested Stack 'AnotherChildStack' was not included in the nestedStacks property when including the parent template/);
334+
}).toThrow(/Nested Stack 'AnotherChildStack' was not included in the includeNestedStacks property when including the parent template/);
335335
});
336336

337337
test('correctly handles renaming of references across nested stacks', () => {
338338
const parentTemplate = new inc.CfnInclude(stack, 'ParentStack', {
339339
templateFile: testTemplateFilePath('cross-stack-refs.json'),
340-
nestedStacks: {
340+
includeNestedStacks: {
341341
'ChildStack': {
342342
templateFile: testTemplateFilePath('child-import-stack.json'),
343343
},
@@ -360,7 +360,7 @@ describe('CDK Include for nested stacks', () => {
360360
});
361361
});
362362

363-
test('returns the CfnStack object from getResource() for a nested stack that was not in the nestedStacks property', () => {
363+
test('returns the CfnStack object from getResource() for a nested stack that was not in the includeNestedStacks property', () => {
364364
const cfnTemplate = new inc.CfnInclude(stack, 'ParentStack', {
365365
templateFile: testTemplateFilePath('parent-two-children.json'),
366366
});
@@ -370,10 +370,10 @@ describe('CDK Include for nested stacks', () => {
370370
expect(childStack1).toBeInstanceOf(core.CfnStack);
371371
});
372372

373-
test('returns the CfnStack object from getResource() for a nested stack that was in the nestedStacks property', () => {
373+
test('returns the CfnStack object from getResource() for a nested stack that was in the includeNestedStacks property', () => {
374374
const cfnTemplate = new inc.CfnInclude(stack, 'ParentStack', {
375375
templateFile: testTemplateFilePath('parent-one-child.json'),
376-
nestedStacks: {
376+
includeNestedStacks: {
377377
'ChildStack': {
378378
templateFile: testTemplateFilePath('child-import-stack.json'),
379379
},
@@ -388,7 +388,7 @@ describe('CDK Include for nested stacks', () => {
388388
test("handles Metadata, DeletionPolicy, and UpdateReplacePolicy attributes of the nested stack's resource", () => {
389389
const cfnTemplate = new inc.CfnInclude(stack, 'ParentStack', {
390390
templateFile: testTemplateFilePath('parent-with-attributes.json'),
391-
nestedStacks: {
391+
includeNestedStacks: {
392392
'ChildStack': {
393393
templateFile: testTemplateFilePath('child-import-stack.json'),
394394
},
@@ -456,10 +456,10 @@ describe('CDK Include for nested stacks', () => {
456456
assetStack = new core.Stack();
457457
parentTemplate = new inc.CfnInclude(assetStack, 'ParentStack', {
458458
templateFile: testTemplateFilePath('parent-one-child.json'),
459-
nestedStacks: {
459+
includeNestedStacks: {
460460
'ChildStack': {
461461
templateFile: testTemplateFilePath('child-no-bucket.json'),
462-
nestedStacks: {
462+
includeNestedStacks: {
463463
'GrandChildStack': {
464464
templateFile: testTemplateFilePath('grandchild-import-stack.json'),
465465
},
@@ -635,7 +635,7 @@ describe('CDK Include for nested stacks', () => {
635635
parentStack = new core.Stack();
636636
const parentTemplate = new inc.CfnInclude(parentStack, 'ParentStack', {
637637
templateFile: testTemplateFilePath('parent-two-parameters.json'),
638-
nestedStacks: {
638+
includeNestedStacks: {
639639
'ChildStack': {
640640
templateFile: testTemplateFilePath('child-two-parameters.json'),
641641
parameters: {

0 commit comments

Comments
 (0)