aws / aws/aws-cdk

core: CloudFormation-Validate::W2001 false positive

Open
#38,396 2 comments 0 reactions 0 assignees Claimed by @rix0rrr View on GitHub
@aws-cdk/aws-ssm @aws-cdk/core bug p2 potential-regression
Dominant language
TypeScript
Stars
12.9k
Forks
4.6k
Avg merge
1d 19h
Merged PRs (30d)
74

Description

### Describe the bug

SSM parameter used for ECS task secret generates false positive W2001 warning.

eg:
```
task.add_container(
...
secrets={
"MONGO_URI": ecs.Secret.from_ssm_parameter(
ssm.StringParameter.from_string_parameter_name(
self,
"mongodb-uri",
string_parameter_name=f"/path-to/mongodb-uri",
)
),
)
```

Would generate a warning:
WARNING Parameter 'mongodburiParameter' is not referenced anywhere in the template (CloudFormation Validate)
...
Acknowledge with 'CloudFormation-Validate::W2001'

### Regression Issue

- [x] Select this option if this issue appears to be a regression.

### Last Known Working CDK Library Version

v2.261.0

### Expected Behavior

No warning.

### Current Behavior

WARNING Parameter 'mongodburiParameter' is not referenced anywhere in the template (CloudFormation Validate)
...
Acknowledge with 'CloudFormation-Validate::W2001'

### Reproduction Steps

See above.

### Possible Solution

_No response_

### Additional Information/Context

_No response_

### AWS CDK Library version (aws-cdk-lib)

v2.262.0

### AWS CDK CLI version

2.1133.0 (build 712d792)

### Node.js Version

v24.18.0

### OS

Linux

### Language

Python

### Language Version

Python 3.12.3

### Other information

_No response_

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the reported ECS task secret example with aws-cdk-lib v2.262.0 and inspect where the CloudFormation-Validate::W2001 warning is produced. Compare the result with v2.261.0 and add a regression test for the SSM-backed ECS secret; done means the generated template no longer reports the parameter as unreferenced.

Written by the indexing model from the issue text.

Assessment

Tech stack
aws, python, typescript
Domain
cloud, infrastructure
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.