Skip to content

Commit 85346df

Browse files
committed
Fix more cfn_nag issues
1 parent b89382e commit 85346df

File tree

4 files changed

+36
-26
lines changed

4 files changed

+36
-26
lines changed

source/patterns/@aws-solutions-constructs/aws-route53-alb/test/integ.deployPrivateApiExistingZone.expected.json

+29-19
Original file line numberDiff line numberDiff line change
@@ -666,7 +666,7 @@
666666
]
667667
}
668668
},
669-
"testroute53albtestroute53albalb7C171F50": {
669+
"existingzonestackexistingzonestackalbCFB3D7E4": {
670670
"Type": "AWS::ElasticLoadBalancingV2::LoadBalancer",
671671
"Properties": {
672672
"LoadBalancerAttributes": [
@@ -681,7 +681,7 @@
681681
{
682682
"Key": "access_logs.s3.bucket",
683683
"Value": {
684-
"Ref": "testroute53albAC463A50"
684+
"Ref": "existingzonestackEFB9F5B3"
685685
}
686686
},
687687
{
@@ -693,7 +693,7 @@
693693
"SecurityGroups": [
694694
{
695695
"Fn::GetAtt": [
696-
"testroute53albtestroute53albalbSecurityGroupC3716E02",
696+
"existingzonestackexistingzonestackalbSecurityGroup6F32DCA5",
697697
"GroupId"
698698
]
699699
}
@@ -712,14 +712,14 @@
712712
"Type": "application"
713713
},
714714
"DependsOn": [
715-
"testroute53albPolicy478FC0AF",
716-
"testroute53albAC463A50"
715+
"existingzonestackPolicyFEC9C88E",
716+
"existingzonestackEFB9F5B3"
717717
]
718718
},
719-
"testroute53albtestroute53albalbSecurityGroupC3716E02": {
719+
"existingzonestackexistingzonestackalbSecurityGroup6F32DCA5": {
720720
"Type": "AWS::EC2::SecurityGroup",
721721
"Properties": {
722-
"GroupDescription": "Automatically created Security Group for ELB deployPrivateApiExistingZonetestroute53albtestroute53albalb73DF0A20",
722+
"GroupDescription": "Automatically created Security Group for ELB deployPrivateApiExistingZoneexistingzonestackexistingzonestackalbFBEA12EB",
723723
"SecurityGroupEgress": [
724724
{
725725
"CidrIp": "255.255.255.255/32",
@@ -734,11 +734,21 @@
734734
}
735735
},
736736
"DependsOn": [
737-
"testroute53albPolicy478FC0AF",
738-
"testroute53albAC463A50"
739-
]
737+
"existingzonestackPolicyFEC9C88E",
738+
"existingzonestackEFB9F5B3"
739+
],
740+
"Metadata": {
741+
"cfn_nag": {
742+
"rules_to_suppress": [
743+
{
744+
"id": "W29",
745+
"reason": "CDK created rule that blocks all traffic."
746+
}
747+
]
748+
}
749+
}
740750
},
741-
"testroute53albAC463A50": {
751+
"existingzonestackEFB9F5B3": {
742752
"Type": "AWS::S3::Bucket",
743753
"Properties": {
744754
"BucketEncryption": {
@@ -773,11 +783,11 @@
773783
}
774784
}
775785
},
776-
"testroute53albPolicy478FC0AF": {
786+
"existingzonestackPolicyFEC9C88E": {
777787
"Type": "AWS::S3::BucketPolicy",
778788
"Properties": {
779789
"Bucket": {
780-
"Ref": "testroute53albAC463A50"
790+
"Ref": "existingzonestackEFB9F5B3"
781791
},
782792
"PolicyDocument": {
783793
"Statement": [
@@ -799,7 +809,7 @@
799809
[
800810
{
801811
"Fn::GetAtt": [
802-
"testroute53albAC463A50",
812+
"existingzonestackEFB9F5B3",
803813
"Arn"
804814
]
805815
},
@@ -809,7 +819,7 @@
809819
},
810820
{
811821
"Fn::GetAtt": [
812-
"testroute53albAC463A50",
822+
"existingzonestackEFB9F5B3",
813823
"Arn"
814824
]
815825
}
@@ -842,7 +852,7 @@
842852
[
843853
{
844854
"Fn::GetAtt": [
845-
"testroute53albAC463A50",
855+
"existingzonestackEFB9F5B3",
846856
"Arn"
847857
]
848858
},
@@ -860,7 +870,7 @@
860870
}
861871
}
862872
},
863-
"testroute53albtestroute53albaliasCCC6DDF3": {
873+
"existingzonestackexistingzonestackalias77D2E65D": {
864874
"Type": "AWS::Route53::RecordSet",
865875
"Properties": {
866876
"Name": "www.test-example.com.",
@@ -873,7 +883,7 @@
873883
"dualstack.",
874884
{
875885
"Fn::GetAtt": [
876-
"testroute53albtestroute53albalb7C171F50",
886+
"existingzonestackexistingzonestackalbCFB3D7E4",
877887
"DNSName"
878888
]
879889
}
@@ -882,7 +892,7 @@
882892
},
883893
"HostedZoneId": {
884894
"Fn::GetAtt": [
885-
"testroute53albtestroute53albalb7C171F50",
895+
"existingzonestackexistingzonestackalbCFB3D7E4",
886896
"CanonicalHostedZoneID"
887897
]
888898
}

source/patterns/@aws-solutions-constructs/aws-route53-alb/test/integ.deployPrivateApiExistingZone.ts

+7-3
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,11 @@ import { App, Stack, Aws } from "@aws-cdk/core";
1616
import * as defaults from '@aws-solutions-constructs/core';
1717
import { PrivateHostedZone } from "@aws-cdk/aws-route53";
1818
import { Route53ToAlb, Route53ToAlbProps } from "../lib";
19-
import { generateIntegStackName } from '@aws-solutions-constructs/core';
19+
import { CfnSecurityGroup } from "@aws-cdk/aws-ec2";
2020

2121
// Setup
2222
const app = new App();
23-
const stack = new Stack(app, generateIntegStackName(__filename), {
23+
const stack = new Stack(app, defaults.generateIntegStackName(__filename), {
2424
env: { account: Aws.ACCOUNT_ID, region: 'us-east-1' },
2525
});
2626
stack.templateOptions.description = 'Integration Test for aws-route53-alb';
@@ -46,7 +46,11 @@ const props: Route53ToAlbProps = {
4646
existingVpc: newVpc,
4747
};
4848

49-
new Route53ToAlb(stack, 'test-route53-alb', props);
49+
const testConstruct = new Route53ToAlb(stack, 'existing-zone-stack', props);
50+
51+
const newSecurityGroup = testConstruct.loadBalancer.connections.securityGroups[0].node.defaultChild as CfnSecurityGroup;
52+
defaults.addCfnSuppressRules(newSecurityGroup, [{ id: 'W29', reason: 'CDK created rule that blocks all traffic.'}]);
53+
5054

5155
// Synth
5256
app.synth();

source/patterns/@aws-solutions-constructs/aws-route53-alb/test/integ.deployPublicApiNewAlb.expected.json

-1
Original file line numberDiff line numberDiff line change
@@ -681,7 +681,6 @@
681681
"Value": ""
682682
}
683683
],
684-
"Name": "new-alb",
685684
"Scheme": "internet-facing",
686685
"SecurityGroups": [
687686
{

source/patterns/@aws-solutions-constructs/aws-route53-alb/test/integ.deployPublicApiNewAlb.ts

-3
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,6 @@ const props: Route53ToAlbProps = {
4343
publicApi: true,
4444
existingHostedZoneInterface: newZone,
4545
existingVpc: newVpc,
46-
loadBalancerProps: {
47-
loadBalancerName: 'new-alb',
48-
}
4946
};
5047

5148
const testConstruct = new Route53ToAlb(stack, 'new-alb-stack', props);

0 commit comments

Comments
 (0)