aws / aws/aws-cdk

(ssm): Add property/method that creates a dynamic reference

Open
#20,326 1 comment 2 reactions 0 assignees View on GitHub
@aws-cdk/aws-ssm effort/small feature-request p2
Dominant language
TypeScript
Stars
12.9k
Forks
4.6k
Avg merge
2d 3h
Merged PRs (30d)
83

Description

### Describe the feature

For my CDK pipeline-managed application, I am migrating some configuration values to SSM parameters. I would like any changes to these values in SSM to be reflected in my application stack the next time my pipeline runs. I got this behavior using the L1 construct for dynamic references, but it would be awesome to have this as an easily available property or method on the `StringParameter`, `StringListParameter`, and `Secret` constructs.

### Use Case

I would like to store application configuration information in SSM and Secrets Manager and have my stack pick up changes to those values on each pipeline deployment.

### Proposed Solution

```typescript
export class StringParameter extends ParameterBase implements IStringParameter {
public dynamicReference(): string {
// Return type needs to pretend be a string so that other components will accept it.
// Either that, or a lot of input values need to accept CfnDynamicReference as well as string.
return new CfnDynamicReference(
CfnDynamicReferenceService.SSM,
this.parameterName,
) as unknown as string;
}
}
```

### Other Information

When I initially tried to set up this sort of reference in my application, I assumed that this is what `stringParameter.stringValue` would do, but knowing that `Value` is a CloudFormation return value for `AWS::SSM::Parameter`, it makes sense that it does not.

### Acknowledgements

- [X] I may be able to implement this feature request
- [ ] This feature might incur a breaking change

### CDK version used

8.3.0

### Environment details (OS name and version, etc.)

MacOS/Linux

Contributor guide

Open the contributing guide

Research direction

Start by inspecting the StringParameter, StringListParameter, and Secret construct APIs, then compare them with the referenced L1 CfnDynamicReference usage. Check how existing construct values are typed and consumed. Done means the three constructs expose an easily usable dynamic reference that resolves updated SSM or Secrets Manager values during the next pipeline deployment.

Written by the indexing model from the issue text.

Assessment

Tech stack
aws, typescript
Domain
cloud, infrastructure
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.