Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(secretsmanager): adds grantWrite to Secret (aws#7858)
### Commit Message feat(secretsmanager): adds grantWrite to Secret ### End Commit Message Implements: aws#7682 #### Testing I deployed the following: ``` #!/usr/bin/env node import * as cdk from '@aws-cdk/core'; import * as kms from '@aws-cdk/aws-kms'; import * as secretsmanager from '@aws-cdk/aws-secretsmanager'; import * as ec2 from '@aws-cdk/aws-ec2'; const app = new cdk.App(); const stack = new cdk.Stack(app, 'Stack', {}); const key = new kms.Key(stack, 'KMS'); const secret = new secretsmanager.Secret(stack, 'Secret', { encryptionKey: key }); const secret2 = new secretsmanager.Secret(stack, 'Secret2', {}); const vpc = ec2.Vpc.fromVpcAttributes(stack, 'Vpc', { vpcId: "vpc-XXXX", availabilityZones: [ "us-west-2a" ], publicSubnetIds: [ "subnet-XXXX" ], }); const instance = new ec2.BastionHostLinux(stack, 'Bastion', { vpc: vpc }); secret.grantRead(instance); secret.grantWrite(instance); secret2.grantRead(instance); secret2.grantWrite(instance); app.synth(); ``` Then, once the stack is deployed I used ssm to connect to the bastion and ran: ``` for secret in <secret name 1> <secret name 2> do aws --region us-west-2 secretsmanager put-secret-value --secret-id ${secret} --secret-string "FooValue" aws --region us-west-2 secretsmanager get-secret-value --secret-id ${secret} done ``` Finally, I verified the contents of the two secrets in the SecretsManager console. ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
- Loading branch information