Skip to content

Commit

Permalink
fixed failing test
Browse files Browse the repository at this point in the history
  • Loading branch information
allen-moheimani-aws committed Apr 26, 2021
1 parent afaf9a3 commit 8e66733
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ export class LambdaToSecretsmanager extends Construct {
// Enable read permissions for the Lambda function by default
this.secret.grantRead(this.lambdaFunction);

if (props.grantWriteAccess) {
if (props.grantWriteAccess === 'ReadWrite') {
this.secret.grantWrite(this.lambdaFunction);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,6 @@ Object {
},
"Environment": Object {
"Variables": Object {
"AWS_NODEJS_CONNECTION_REUSE_ENABLED": "1",
"SECRET_NAME": Object {
"Fn::Select": Array [
6,
Expand Down Expand Up @@ -301,7 +300,6 @@ Object {
},
"Environment": Object {
"Variables": Object {
"AWS_NODEJS_CONNECTION_REUSE_ENABLED": "1",
"SECRET_NAME": Object {
"Fn::Select": Array [
6,
Expand Down Expand Up @@ -432,6 +430,16 @@ Object {
},
"lambdatosecretsmanagerstacksecretBA684E34": Object {
"DeletionPolicy": "Retain",
"Metadata": Object {
"cfn_nag": Object {
"rules_to_suppress": Array [
Object {
"id": "W77",
"reason": "Secrets Manager Secret should explicitly specify KmsKeyId. Besides control of the key this will allow the secret to be shared cross-account",
},
],
},
},
"Properties": Object {
"GenerateSecretString": Object {},
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,9 @@ test('Test lambda function custom environment variable', () => {
runtime: lambda.Runtime.NODEJS_14_X,
handler: 'index.handler',
code: lambda.Code.fromAsset(`${__dirname}/lambda`),
environment: {
AWS_NODEJS_CONNECTION_REUSE_ENABLED: '1',
}
},
secretEnvironmentVariableName: 'CUSTOM_SECRET_NAME'
});
Expand Down

0 comments on commit 8e66733

Please sign in to comment.