#38424·aws-cdk

core: CloudFormation-Validate::W9007 false positive when subnet id is Fn::GetStackOutput

Author: TietewCreated Jul 28, 2026Updated Sep 17, 2026
Labelsbugp2@aws-cdk/core

Describe the bug

CloudFormation-Validate::W9007 is reported on Application Load Balancer, ElastiCache SubnetGroup, and RDS SubnetGroup when subnets are imported from another stack using Fn::GetStackOutput.

Feature flag @aws-cdk/core:defaultCrossStackReferences is weak.

typescript
new elbv2.ApplicationLoadBalancer(stack, 'ALB', {
  vpc: anotherStack.vpc,
  ...
});

Template:

json5
{
 "Resource": {
  "ALBXXXX": {
   "Type": "ElasticLoadBalancingV2::LoadBalancer",
   "Properties": {
    // ...
    "Subnets": [
     {
      "Fn::GetStackOutput": {
       "StackName": "XXX",
       "Region": "ap-northeast-1",
       "OutputName": "PublishOutputRefVpcIsolatedSubnet1SubnetXXX"
      }
     },
     {
      "Fn::GetStackOutput": {
       "StackName": "XXX",
       "Region": "ap-northeast-1",
       "OutputName": "PublishOutputRefVpcIsolatedSubnet2SubnetXXX"
      }
     },
     {
      "Fn::GetStackOutput": {
       "StackName": "XXX",
       "Region": "ap-northeast-1",
       "OutputName": "PublishOutputRefVpcIsolatedSubnet3SubnetXXX"
      }
     }
    ],
    "Type": "application"
   }
  }
 }
}

WARNING Subnets: Array property 'Subnets' contains duplicate values (CloudFormation Validate) aws-cdk-lib.aws_elasticloadbalancingv2.CfnLoadBalancer Acknowledge with 'CloudFormation-Validate::W9007'

Same issue on aws-cdk-lib.aws_elasticache.CfnSubnetGroup and aws-cdk-lib.aws_rds.CfnDBSubnetGroup.

Regression Issue

  • Select this option if this issue appears to be a regression.

Last Known Working CDK Library Version

No response

Expected Behavior

No warnigns are reported.

Current Behavior

See description above.

Reproduction Steps

See description above.

Possible Solution

No response

Additional Information/Context

No response

AWS CDK Library version (aws-cdk-lib)

2.262.1

AWS CDK CLI version

2.1133.0 (build 712d792)

Node.js Version

v24.18.0

OS

Linux

Language

TypeScript

Language Version

No response

Other information

No response