-
Notifications
You must be signed in to change notification settings - Fork 3.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(secretsmanager): create secret with secretObjectValue (#21091)
A common use case is to create key/value secrets where the values could be either strings _or_ other secret values. Currently this is possible, but the user experience is not great. This PR introduces a new input prop `secretObjectValue` which is of type `{ [key: string]: SecretValue }`. For example, you can now create a JSON secret: ```ts new secretsmanager.Secret(stack, 'JSONSecret', { secretObjectValue: { username: SecretValue.unsafePlainText(user.userName), // intrinsic reference, not exposed as plaintext database: SecretValue.unsafePlainText('foo'), // rendered as plain text, but not a secret password: accessKey.secretAccessKey, // SecretValue }, }); ``` I've also updated the docs to better reflect what `unsafe` means given this new context. fixes #20461 ---- ### All Submissions: * [x] Have you followed the guidelines in our [Contributing guide?](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) ### Adding new Unconventional Dependencies: * [ ] This PR adds new unconventional dependencies following the process described [here](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md/#adding-new-unconventional-dependencies) ### New Features * [x] Have you added the new feature to an [integration test](https://github.com/aws/aws-cdk/blob/main/INTEGRATION_TESTS.md)? * [x] Did you use `yarn integ` to deploy the infrastructure and generate the snapshot (i.e. `yarn integ` without `--dry-run`)? *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
- Loading branch information
Showing
13 changed files
with
291 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 0 additions & 19 deletions
19
...aws-secretsmanager/test/secret.lit.integ.snapshot/Integ-SecretsManager-Secret.assets.json
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
...er/test/secret.lit.integ.snapshot/SecretTestDefaultTestDeployAssert519F6A06.template.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{} |
2 changes: 1 addition & 1 deletion
2
packages/@aws-cdk/aws-secretsmanager/test/secret.lit.integ.snapshot/cdk.out
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
{"version":"17.0.0"} | ||
{"version":"20.0.0"} |
11 changes: 4 additions & 7 deletions
11
packages/@aws-cdk/aws-secretsmanager/test/secret.lit.integ.snapshot/integ.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,11 @@ | ||
{ | ||
"version": "18.0.0", | ||
"version": "20.0.0", | ||
"testCases": { | ||
"aws-secretsmanager/test/integ.secret.lit": { | ||
"SecretTest/DefaultTest": { | ||
"stacks": [ | ||
"Integ-SecretsManager-Secret" | ||
], | ||
"diffAssets": false, | ||
"stackUpdateWorkflow": true | ||
"assertionStack": "SecretTestDefaultTestDeployAssert519F6A06" | ||
} | ||
}, | ||
"synthContext": {}, | ||
"enableLookups": false | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.