New: [AEA-6258] - Add SSM Parameter construct#619
Conversation
…, and the policy to read them
|
This PR is linked to a ticket in an NHS Digital JIRA Project. Here's a handy link to the ticket: AEA-6258 |
There was a problem hiding this comment.
Pull request overview
This PR introduces a new CDK construct for defining multiple SSM parameters in a single place, automatically generating the corresponding StringParameter resources, an IAM managed policy granting read access, and CloudFormation outputs/exports for downstream consumption.
Changes:
- Added
SsmParametersConstructto create a bundle of SSM parameters + a read managed policy + outputs. - Exported the new construct from the
@nhsdigital/eps-cdk-constructsentrypoint. - Added Vitest coverage validating parameter creation, policy generation, and output exports.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| packages/cdkConstructs/src/constructs/SsmParametersConstruct.ts | New construct that synthesizes SSM parameters, an IAM read policy, and CFN outputs/exports. |
| packages/cdkConstructs/src/index.ts | Re-export the new construct from the package entrypoint. |
| packages/cdkConstructs/tests/constructs/ssmParametersConstruct.test.ts | New unit tests covering the synthesized resources/outputs for the construct. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
| */ | ||
| export const stateMachineRequestTemplate = (stateMachineArn: string) => { | ||
| return `## Velocity Template used for API Gateway request mapping template | ||
| return `## Velocity Template used for API Gateway request mapping template |
There was a problem hiding this comment.
I think this one was correct before? 2 space indent
| export function getConfigFromEnvVar( | ||
| varName: string, | ||
| prefix: string = "CDK_CONFIG_", | ||
| defaultValue: string | undefined = undefined |
There was a problem hiding this comment.
I know the idiomatic way to do this would be to use an options object, but that would break downstream things and for this I don't want to mess about with that if we can avoid it...
There was a problem hiding this comment.
| defaultValue: string | undefined = undefined | |
| defaultValue: string | undefined |
explicitly initialising to undefined feels a bit excessive.
There a couple of these
| export function getConfigFromEnvVar( | ||
| varName: string, | ||
| prefix: string = "CDK_CONFIG_", | ||
| defaultValue: string | undefined = undefined |
There was a problem hiding this comment.
| defaultValue: string | undefined = undefined | |
| defaultValue: string | undefined |
explicitly initialising to undefined feels a bit excessive.
There a couple of these
packages/cdkConstructs/src/constructs/RestApiGateway/StateMachineEndpoint.ts
Show resolved
Hide resolved
|



Summary
Details
CDK exposes a
StringParameterwhich builds an SSM parameter. I've added anSsmParametersConstructwhich takes an array of parameter definitions, and handles making theStringParameterfor each, creates a policy to read the parameters, and produces relevant outputs.