[aws-ssm] StringParameter.valueFromLookup() WithDecryption support
- Dominant language
- TypeScript
- Stars
- 12.9k
- Forks
- 4.6k
- Avg merge
- 2d 3h
- Merged PRs (30d)
- 83
Description
The `StringParameter.valueFromLookup()` allows looking up and injecting an SSM Parameter Value to the deployed stack, which is useful for configuring applications that cannot perform the parameter lookup at runtime. However, valueFromLookup() does not have a way to specify the `WithDecryption: true` option for encrypted values. This results in an encrypted, encoded value being injected instead of the desired actual value.
The [SSMContextProviderPlugin](https://github.com/aws/aws-cdk/blob/87860cac6cc8b57eca29cb32c986331e5d62e883/packages/aws-cdk/lib/context-providers/ssm-parameters.ts) is hard-coded to omit the WithDecryption option when getting the parameter value.
I propose to add optional support for specifying `WithDecyption: true` , so that also encrypted parameter values can be injected in to the stack when necessary.
### Use Case
My own use case is running WordPress in a Lambda function and injecting the database password from an encrypted SSM parameter to the Lambda environment. The password is not a critically secure string since the database runs in a private VPC, so I am okay with having it in the Lambda environment settings. But I prefer to keep it in SSM Parameter Store instead of putting it in Git / source code.
### Proposed Solution
I would propose to add an optional withDecryption option to valueFromLookup() and corresponding support to SSMContextProviderPlugin.
### Other
---
This is a :rocket: Feature Request
Contributor guide
Research direction
Start with valueFromLookup() and the SSMContextProviderPlugin in packages/aws-cdk/lib/context-providers/ssm-parameters.ts. Trace how the lookup options reach parameter retrieval, then verify that an optional withDecryption setting allows encrypted SSM values to be injected as their decrypted value without changing existing lookups.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- aws, typescript
- Domain
- cloud, infrastructure
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 45/100