Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(core): correctly reference versionless secure parameters #18730

Merged
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions packages/@aws-cdk/core/lib/secret-value.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,9 @@ export class SecretValue extends Intrinsic {
* latest version of the parameter.
*/
public static ssmSecure(parameterName: string, version?: string): SecretValue {
const parts = [parameterName, version ?? ''];
return this.cfnDynamicReference(new CfnDynamicReference(CfnDynamicReferenceService.SSM_SECURE, parts.join(':')));
return this.cfnDynamicReference(
new CfnDynamicReference(CfnDynamicReferenceService.SSM_SECURE,
version ? `${parameterName}:${version}` : parameterName));
}

/**
Expand Down
2 changes: 1 addition & 1 deletion packages/@aws-cdk/core/test/secret-value.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ describe('secret value', () => {
const v = SecretValue.ssmSecure('param-name');

// THEN
expect(stack.resolve(v)).toEqual('{{resolve:ssm-secure:param-name:}}');
expect(stack.resolve(v)).toEqual('{{resolve:ssm-secure:param-name}}');
});

test('cfnDynamicReference', () => {
Expand Down