Skip to content

Commit

Permalink
fix(ec2): networkAclName property for NetworkAcl does not work (#26898)
Browse files Browse the repository at this point in the history
Currently, networkAclName property for NetworkAcl L2 is never referred in generated CloudFormation template. This PR solves the issue by adding Name tag with the value of networkAclName property. This fix is similar to #26371

Closes #26897

----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
  • Loading branch information
tam0ri authored Aug 29, 2023
1 parent 1cead3b commit 7f31da8
Show file tree
Hide file tree
Showing 9 changed files with 290 additions and 240 deletions.
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
{
"version": "20.0.0",
"version": "34.0.0",
"files": {
"04eb43593fbbe54e6eadc94dac3e2388aa1e9ef1bac4156293e7b6e2363b5bb4": {
"deb6adbcfa8931cee9545cb210604a66e240d637bdf67fca383fe3f17d220ae1": {
"source": {
"path": "aws-cdk-ec2-vpc.template.json",
"packaging": "file"
},
"destinations": {
"current_account-current_region": {
"bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}",
"objectKey": "04eb43593fbbe54e6eadc94dac3e2388aa1e9ef1bac4156293e7b6e2363b5bb4.json",
"objectKey": "deb6adbcfa8931cee9545cb210604a66e240d637bdf67fca383fe3f17d220ae1.json",
"assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}"
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,6 @@
"MyVpcPublicSubnet1SubnetF6608456": {
"Type": "AWS::EC2::Subnet",
"Properties": {
"VpcId": {
"Ref": "MyVpcF9F0CA6F"
},
"AvailabilityZone": {
"Fn::Select": [
0,
Expand All @@ -44,21 +41,24 @@
"Key": "Name",
"Value": "aws-cdk-ec2-vpc/MyVpc/PublicSubnet1"
}
]
],
"VpcId": {
"Ref": "MyVpcF9F0CA6F"
}
}
},
"MyVpcPublicSubnet1RouteTableC46AB2F4": {
"Type": "AWS::EC2::RouteTable",
"Properties": {
"VpcId": {
"Ref": "MyVpcF9F0CA6F"
},
"Tags": [
{
"Key": "Name",
"Value": "aws-cdk-ec2-vpc/MyVpc/PublicSubnet1"
}
]
],
"VpcId": {
"Ref": "MyVpcF9F0CA6F"
}
}
},
"MyVpcPublicSubnet1RouteTableAssociation2ECEE1CB": {
Expand All @@ -75,12 +75,12 @@
"MyVpcPublicSubnet1DefaultRoute95FDF9EB": {
"Type": "AWS::EC2::Route",
"Properties": {
"RouteTableId": {
"Ref": "MyVpcPublicSubnet1RouteTableC46AB2F4"
},
"DestinationCidrBlock": "0.0.0.0/0",
"GatewayId": {
"Ref": "MyVpcIGW5C4A4F63"
},
"RouteTableId": {
"Ref": "MyVpcPublicSubnet1RouteTableC46AB2F4"
}
},
"DependsOn": [
Expand All @@ -102,15 +102,15 @@
"MyVpcPublicSubnet1NATGatewayAD3400C1": {
"Type": "AWS::EC2::NatGateway",
"Properties": {
"SubnetId": {
"Ref": "MyVpcPublicSubnet1SubnetF6608456"
},
"AllocationId": {
"Fn::GetAtt": [
"MyVpcPublicSubnet1EIP096967CB",
"AllocationId"
]
},
"SubnetId": {
"Ref": "MyVpcPublicSubnet1SubnetF6608456"
},
"Tags": [
{
"Key": "Name",
Expand All @@ -126,9 +126,6 @@
"MyVpcPublicSubnet2Subnet492B6BFB": {
"Type": "AWS::EC2::Subnet",
"Properties": {
"VpcId": {
"Ref": "MyVpcF9F0CA6F"
},
"AvailabilityZone": {
"Fn::Select": [
1,
Expand All @@ -152,21 +149,24 @@
"Key": "Name",
"Value": "aws-cdk-ec2-vpc/MyVpc/PublicSubnet2"
}
]
],
"VpcId": {
"Ref": "MyVpcF9F0CA6F"
}
}
},
"MyVpcPublicSubnet2RouteTable1DF17386": {
"Type": "AWS::EC2::RouteTable",
"Properties": {
"VpcId": {
"Ref": "MyVpcF9F0CA6F"
},
"Tags": [
{
"Key": "Name",
"Value": "aws-cdk-ec2-vpc/MyVpc/PublicSubnet2"
}
]
],
"VpcId": {
"Ref": "MyVpcF9F0CA6F"
}
}
},
"MyVpcPublicSubnet2RouteTableAssociation227DE78D": {
Expand All @@ -183,12 +183,12 @@
"MyVpcPublicSubnet2DefaultRoute052936F6": {
"Type": "AWS::EC2::Route",
"Properties": {
"RouteTableId": {
"Ref": "MyVpcPublicSubnet2RouteTable1DF17386"
},
"DestinationCidrBlock": "0.0.0.0/0",
"GatewayId": {
"Ref": "MyVpcIGW5C4A4F63"
},
"RouteTableId": {
"Ref": "MyVpcPublicSubnet2RouteTable1DF17386"
}
},
"DependsOn": [
Expand All @@ -210,15 +210,15 @@
"MyVpcPublicSubnet2NATGateway91BFBEC9": {
"Type": "AWS::EC2::NatGateway",
"Properties": {
"SubnetId": {
"Ref": "MyVpcPublicSubnet2Subnet492B6BFB"
},
"AllocationId": {
"Fn::GetAtt": [
"MyVpcPublicSubnet2EIP8CCBA239",
"AllocationId"
]
},
"SubnetId": {
"Ref": "MyVpcPublicSubnet2Subnet492B6BFB"
},
"Tags": [
{
"Key": "Name",
Expand All @@ -234,9 +234,6 @@
"MyVpcPrivateSubnet1Subnet5057CF7E": {
"Type": "AWS::EC2::Subnet",
"Properties": {
"VpcId": {
"Ref": "MyVpcF9F0CA6F"
},
"AvailabilityZone": {
"Fn::Select": [
0,
Expand All @@ -260,21 +257,24 @@
"Key": "Name",
"Value": "aws-cdk-ec2-vpc/MyVpc/PrivateSubnet1"
}
]
],
"VpcId": {
"Ref": "MyVpcF9F0CA6F"
}
}
},
"MyVpcPrivateSubnet1RouteTable8819E6E2": {
"Type": "AWS::EC2::RouteTable",
"Properties": {
"VpcId": {
"Ref": "MyVpcF9F0CA6F"
},
"Tags": [
{
"Key": "Name",
"Value": "aws-cdk-ec2-vpc/MyVpc/PrivateSubnet1"
}
]
],
"VpcId": {
"Ref": "MyVpcF9F0CA6F"
}
}
},
"MyVpcPrivateSubnet1RouteTableAssociation56D38C7E": {
Expand All @@ -291,21 +291,18 @@
"MyVpcPrivateSubnet1DefaultRouteA8CDE2FA": {
"Type": "AWS::EC2::Route",
"Properties": {
"RouteTableId": {
"Ref": "MyVpcPrivateSubnet1RouteTable8819E6E2"
},
"DestinationCidrBlock": "0.0.0.0/0",
"NatGatewayId": {
"Ref": "MyVpcPublicSubnet1NATGatewayAD3400C1"
},
"RouteTableId": {
"Ref": "MyVpcPrivateSubnet1RouteTable8819E6E2"
}
}
},
"MyVpcPrivateSubnet2Subnet0040C983": {
"Type": "AWS::EC2::Subnet",
"Properties": {
"VpcId": {
"Ref": "MyVpcF9F0CA6F"
},
"AvailabilityZone": {
"Fn::Select": [
1,
Expand All @@ -329,21 +326,24 @@
"Key": "Name",
"Value": "aws-cdk-ec2-vpc/MyVpc/PrivateSubnet2"
}
]
],
"VpcId": {
"Ref": "MyVpcF9F0CA6F"
}
}
},
"MyVpcPrivateSubnet2RouteTableCEDCEECE": {
"Type": "AWS::EC2::RouteTable",
"Properties": {
"VpcId": {
"Ref": "MyVpcF9F0CA6F"
},
"Tags": [
{
"Key": "Name",
"Value": "aws-cdk-ec2-vpc/MyVpc/PrivateSubnet2"
}
]
],
"VpcId": {
"Ref": "MyVpcF9F0CA6F"
}
}
},
"MyVpcPrivateSubnet2RouteTableAssociation86A610DA": {
Expand All @@ -360,12 +360,12 @@
"MyVpcPrivateSubnet2DefaultRoute9CE96294": {
"Type": "AWS::EC2::Route",
"Properties": {
"RouteTableId": {
"Ref": "MyVpcPrivateSubnet2RouteTableCEDCEECE"
},
"DestinationCidrBlock": "0.0.0.0/0",
"NatGatewayId": {
"Ref": "MyVpcPublicSubnet2NATGateway91BFBEC9"
},
"RouteTableId": {
"Ref": "MyVpcPrivateSubnet2RouteTableCEDCEECE"
}
}
},
Expand All @@ -383,17 +383,23 @@
"MyVpcVPCGW488ACE0D": {
"Type": "AWS::EC2::VPCGatewayAttachment",
"Properties": {
"VpcId": {
"Ref": "MyVpcF9F0CA6F"
},
"InternetGatewayId": {
"Ref": "MyVpcIGW5C4A4F63"
},
"VpcId": {
"Ref": "MyVpcF9F0CA6F"
}
}
},
"myNACL198AF6597": {
"Type": "AWS::EC2::NetworkAcl",
"Properties": {
"Tags": [
{
"Key": "Name",
"Value": "CustomNetworkAclName"
}
],
"VpcId": {
"Ref": "MyVpcF9F0CA6F"
}
Expand Down Expand Up @@ -424,35 +430,35 @@
"myNACL1AllowDNSEgressD49F54D3": {
"Type": "AWS::EC2::NetworkAclEntry",
"Properties": {
"CidrBlock": "172.16.0.0/24",
"Egress": true,
"NetworkAclId": {
"Ref": "myNACL198AF6597"
},
"Protocol": 17,
"RuleAction": "allow",
"RuleNumber": 100,
"CidrBlock": "172.16.0.0/24",
"Egress": true,
"PortRange": {
"From": 53,
"To": 53
}
},
"Protocol": 17,
"RuleAction": "allow",
"RuleNumber": 100
}
},
"myNACL1AllowDNSIngress3030B2C3": {
"Type": "AWS::EC2::NetworkAclEntry",
"Properties": {
"CidrBlock": "0.0.0.0/0",
"Egress": false,
"NetworkAclId": {
"Ref": "myNACL198AF6597"
},
"Protocol": 17,
"RuleAction": "allow",
"RuleNumber": 100,
"CidrBlock": "0.0.0.0/0",
"Egress": false,
"PortRange": {
"From": 53,
"To": 53
}
},
"Protocol": 17,
"RuleAction": "allow",
"RuleNumber": 100
}
}
},
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"version":"21.0.0"}
{"version":"34.0.0"}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "20.0.0",
"version": "34.0.0",
"testCases": {
"integ.vpc-networkacl": {
"stacks": [
Expand Down
Loading

0 comments on commit 7f31da8

Please sign in to comment.