@@ -387,7 +387,7 @@ export class EvaluateCloudFormationTemplate {
387
387
388
388
if ( foundResource . ResourceType == 'AWS::CloudFormation::Stack' && attribute ?. startsWith ( 'Outputs.' ) ) {
389
389
// need to resolve attributes from another stack's Output section
390
- const dependantStackName = this . nestedStackNames [ logicalId ] ?. nestedStackPhysicalName ;
390
+ const dependantStackName = this . findNestedStack ( logicalId , this . nestedStackNames ) ;
391
391
if ( ! dependantStackName ) {
392
392
//this is a newly created nested stack and cannot be hotswapped
393
393
return undefined ;
@@ -406,6 +406,19 @@ export class EvaluateCloudFormationTemplate {
406
406
return this . formatResourceAttribute ( foundResource , attribute ) ;
407
407
}
408
408
409
+ private findNestedStack ( logicalId : string , nestedStackNames : {
410
+ [ nestedStackLogicalId : string ] : NestedStackNames ;
411
+ } ) : string | undefined {
412
+ for ( const [ nestedStackLogicalId , { nestedChildStackNames, nestedStackPhysicalName } ] of Object . entries ( nestedStackNames ) ) {
413
+ if ( nestedStackLogicalId === logicalId ) {
414
+ return nestedStackPhysicalName ;
415
+ }
416
+ const checkInNestedChildStacks = this . findNestedStack ( logicalId , nestedChildStackNames ) ;
417
+ if ( checkInNestedChildStacks ) return checkInNestedChildStacks ;
418
+ }
419
+ return undefined ;
420
+ }
421
+
409
422
private formatResourceAttribute ( resource : AWS . CloudFormation . StackResourceSummary , attribute : string | undefined ) : string | undefined {
410
423
const physicalId = resource . PhysicalResourceId ;
411
424
0 commit comments