-
Notifications
You must be signed in to change notification settings - Fork 4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(ssm): allow referencing "latest" version of SSM parameter (#1768)
There are many requests from people to integrate with SSM parameter store in same way, and in particular to get the latest version of a parameter. The mechanisms to get a specific version or the latest version at deployment time are very different, but both are now supported by and hidden in the ssm.ParameterStoreString class. Make the naming around properties that return a (potentially tokenized) value consistent. All properties of objects that return a string value are `stringValue`, all properties of objects that return a list value are `stringListValue`. Fixes #1587. BREAKING CHANGE: Rename `parameter.valueAsString` => `parameter.stringValue`, rename `parameter.valueAsList` => `parameter.stringListValue`, rename `ssmParameter.parameterValue` => `ssmParameter.stringValue` or `ssmParameter.stringListValue` depending on type, rename `secretString.value` => `secretString.stringValue`, rename `secret.toSecretString()` =>`secret.secretString`
- Loading branch information
Showing
23 changed files
with
299 additions
and
85 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
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
28 changes: 19 additions & 9 deletions
28
packages/@aws-cdk/aws-secretsmanager/test/example.app-with-secret.lit.ts
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,16 +1,26 @@ | ||
import iam = require('@aws-cdk/aws-iam'); | ||
import cdk = require('@aws-cdk/cdk'); | ||
import secretsmanager = require('../lib'); | ||
|
||
const app = new cdk.App(); | ||
const stack = new cdk.Stack(app, 'aws-cdk-rds-integ'); | ||
class ExampleStack extends cdk.Stack { | ||
constructor(scope: cdk.App, id: string) { | ||
super(scope, id); | ||
|
||
/// !show | ||
const loginSecret = new secretsmanager.SecretString(this, 'Secret', { | ||
secretId: 'SomeLogin' | ||
}); | ||
|
||
/// !show | ||
const loginSecret = new secretsmanager.SecretString(stack, 'Secret', { secretId: 'SomeLogin', }); | ||
new iam.User(this, 'User', { | ||
// Get the 'password' field from the secret that looks like | ||
// { "username": "XXXX", "password": "YYYY" } | ||
password: loginSecret.jsonFieldValue('password') | ||
}); | ||
/// !hide | ||
|
||
// DO NOT ACTUALLY DO THIS, as this will expose your secret. | ||
// This code only exists to show how the secret would be used. | ||
new cdk.Output(stack, 'SecretUsername', { value: loginSecret.jsonFieldValue('username') }); | ||
new cdk.Output(stack, 'SecretPassword', { value: loginSecret.jsonFieldValue('password') }); | ||
/// !hide | ||
} | ||
} | ||
|
||
const app = new cdk.App(); | ||
new ExampleStack(app, 'aws-cdk-secret-integ'); | ||
app.run(); |
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
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.