aws / aws/aws-cdk

SSM Secure Parameter Version ignored in ARN

Open
#8,405 7 comments 10 reactions 0 assignees View on GitHub
@aws-cdk/aws-ecs @aws-cdk/aws-ssm blocked bug effort/medium needs-cfn p2
Dominant language
TypeScript
Stars
12.9k
Forks
4.6k
Avg merge
2d 3h
Merged PRs (30d)
83

Description

We create a secure string parameter in SSM and pass it down to an ECS service via a TaskDefinition (inside a ContainerDefinition) as Secret.
However, the version of the secure string seems to be ignored when the CloudFormation ARN for the secret in the ECS task definition is created.

### Reproduction Steps

```ts
const param = StringParameter.fromSecureStringParameterAttributes(construct, "SecretParameterForEcsTaskDefinition" {
simpleName: false,
parameterName: "some-name",
version: 2,
});

const secret = Secret.fromSsmParameter(param);
// pass the secret to ECS task definition via secrets property
...
const options: ContainerDefinitionOptions = {
...
secrets: {
"some-key": secret,
}
}
```

### Error Log

Not an error, but the parameter version is not pinned. The ECS task definition contains the following:

```json
...
"secrets": [
{
"valueFrom": "arn:aws:ssm:eu-central-1:xxxxxxxxxx:parameter/some-name",
"name": "some-key"
}
]
```

I would expect the ARN to end with: `some-name:2`.

### Environment

- **CLI Version :** 1.39.0 (build 5d727c1)
- **Framework Version:** 1.39.0
- **Node.js Version:** v12.16.3
- **OS :** Linux
- **Language (Version):** TypeScript

---

This is :bug: Bug Report

Contributor guide

Open the contributing guide

Research direction

Start with StringParameter.fromSecureStringParameterAttributes and Secret.fromSsmParameter, then follow how the secret is represented in the ECS ContainerDefinition secrets property. Reproduce the generated task definition and verify that a versioned parameter produces an ARN ending in :2.

Written by the indexing model from the issue text.

Assessment

Tech stack
aws, typescript
Domain
cloud, devops
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.