Skip to content

Commit 8e66733

Browse files
fixed failing test
1 parent afaf9a3 commit 8e66733

File tree

3 files changed

+14
-3
lines changed

3 files changed

+14
-3
lines changed

Diff for: source/patterns/@aws-solutions-constructs/aws-lambda-secretsmanager/lib/index.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ export class LambdaToSecretsmanager extends Construct {
144144
// Enable read permissions for the Lambda function by default
145145
this.secret.grantRead(this.lambdaFunction);
146146

147-
if (props.grantWriteAccess) {
147+
if (props.grantWriteAccess === 'ReadWrite') {
148148
this.secret.grantWrite(this.lambdaFunction);
149149
}
150150
}

Diff for: source/patterns/@aws-solutions-constructs/aws-lambda-secretsmanager/test/__snapshots__/lambda-secretsmanager.test.js.snap

+10-2
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,6 @@ Object {
8181
},
8282
"Environment": Object {
8383
"Variables": Object {
84-
"AWS_NODEJS_CONNECTION_REUSE_ENABLED": "1",
8584
"SECRET_NAME": Object {
8685
"Fn::Select": Array [
8786
6,
@@ -301,7 +300,6 @@ Object {
301300
},
302301
"Environment": Object {
303302
"Variables": Object {
304-
"AWS_NODEJS_CONNECTION_REUSE_ENABLED": "1",
305303
"SECRET_NAME": Object {
306304
"Fn::Select": Array [
307305
6,
@@ -432,6 +430,16 @@ Object {
432430
},
433431
"lambdatosecretsmanagerstacksecretBA684E34": Object {
434432
"DeletionPolicy": "Retain",
433+
"Metadata": Object {
434+
"cfn_nag": Object {
435+
"rules_to_suppress": Array [
436+
Object {
437+
"id": "W77",
438+
"reason": "Secrets Manager Secret should explicitly specify KmsKeyId. Besides control of the key this will allow the secret to be shared cross-account",
439+
},
440+
],
441+
},
442+
},
435443
"Properties": Object {
436444
"GenerateSecretString": Object {},
437445
},

Diff for: source/patterns/@aws-solutions-constructs/aws-lambda-secretsmanager/test/lambda-secretsmanager.test.ts

+3
Original file line numberDiff line numberDiff line change
@@ -301,6 +301,9 @@ test('Test lambda function custom environment variable', () => {
301301
runtime: lambda.Runtime.NODEJS_14_X,
302302
handler: 'index.handler',
303303
code: lambda.Code.fromAsset(`${__dirname}/lambda`),
304+
environment: {
305+
AWS_NODEJS_CONNECTION_REUSE_ENABLED: '1',
306+
}
304307
},
305308
secretEnvironmentVariableName: 'CUSTOM_SECRET_NAME'
306309
});

0 commit comments

Comments
 (0)