Skip to content

Commit

Permalink
cfn_nag on test resources
Browse files Browse the repository at this point in the history
  • Loading branch information
biffgaut committed May 4, 2022
1 parent 5d1cb53 commit d350a31
Showing 1 changed file with 12 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -15,20 +15,31 @@
import { App, Stack } from "@aws-cdk/core";
import { LambdaToElasticachememcached, LambdaToElasticachememcachedProps } from "../lib";
import * as lambda from '@aws-cdk/aws-lambda';
import { generateIntegStackName, getTestVpc, CreateTestCache } from '@aws-solutions-constructs/core';
import * as ec2 from '@aws-cdk/aws-ec2';
import { generateIntegStackName, getTestVpc, CreateTestCache, addCfnSuppressRules } from '@aws-solutions-constructs/core';
import { CfnEC2Fleet } from "@aws-cdk/aws-ec2";

// Setup
const app = new App();
const stack = new Stack(app, generateIntegStackName(__filename));
stack.templateOptions.description = 'Integration Test with new resourcesfor aws-lambda-elasticachememcached';

const testVpc = getTestVpc(stack, false);

const testSG = new ec2.SecurityGroup(stack, 'test-sg', {
vpc: testVpc,
});

const testFunction = new lambda.Function(stack, 'test-function', {
runtime: lambda.Runtime.NODEJS_14_X,
handler: 'index.handler',
code: lambda.Code.fromAsset(`${__dirname}/lambda`),
vpc: testVpc,
securityGroups: [testSG],
});
addCfnSuppressRules(testFunction, [{ id: "W58", reason: "Test Resource" }]);
addCfnSuppressRules(testFunction, [{ id: "W92", reason: "Test Resource" }]);

const testCache = CreateTestCache(stack, 'test-cache', testVpc);

// Definitions
Expand Down

0 comments on commit d350a31

Please sign in to comment.