Skip to content

Commit

Permalink
Fix VPC endpoint IDs
Browse files Browse the repository at this point in the history
Their IDs must be prefixed by the name of the VPC to make it possible
to deploy multiple VPCs with endpoints for the same services in the same
stack.
  • Loading branch information
pierretr committed Sep 28, 2023
1 parent 08715bf commit 2094dfc
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion src/e3/aws/troposphere/ec2/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ def interface_vpc_endpoints(self) -> list[ec2.VPCEndpoint]:

endpoints.append(
ec2.VPCEndpoint(
name_to_id(f"{service_name}Endpoint"),
name_to_id(f"{self.vpc.name}-{service_name}Endpoint"),
PrivateDnsEnabled="true",
SecurityGroupIds=[security_group_id],
ServiceName=f"com.amazonaws.{self.region}.{service_name}",
Expand Down
12 changes: 6 additions & 6 deletions tests/tests_e3_aws/troposphere/ec2/vpc.json
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@
},
"Type": "AWS::EC2::SecurityGroupIngress"
},
"LogsEndpoint": {
"TestVPCLogsEndpoint": {
"Properties": {
"PrivateDnsEnabled": true,
"SecurityGroupIds": [
Expand Down Expand Up @@ -278,7 +278,7 @@
},
"Type": "AWS::EC2::VPCEndpoint"
},
"EcrapiEndpoint": {
"TestVPCEcrapiEndpoint": {
"Properties": {
"PrivateDnsEnabled": true,
"SecurityGroupIds": [
Expand Down Expand Up @@ -314,7 +314,7 @@
},
"Type": "AWS::EC2::VPCEndpoint"
},
"EcrdkrEndpoint": {
"TestVPCEcrdkrEndpoint": {
"Properties": {
"PrivateDnsEnabled": true,
"SecurityGroupIds": [
Expand Down Expand Up @@ -350,7 +350,7 @@
},
"Type": "AWS::EC2::VPCEndpoint"
},
"StsEndpoint": {
"TestVPCStsEndpoint": {
"Properties": {
"PrivateDnsEnabled": true,
"SecurityGroupIds": [
Expand All @@ -371,7 +371,7 @@
},
"Type": "AWS::EC2::VPCEndpoint"
},
"SecretsmanagerEndpoint": {
"TestVPCSecretsmanagerEndpoint": {
"Properties": {
"PrivateDnsEnabled": true,
"SecurityGroupIds": [
Expand Down Expand Up @@ -501,4 +501,4 @@
},
"Type": "AWS::EC2::SecurityGroup"
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@
},
"Type": "AWS::EC2::SecurityGroupIngress"
},
"EmailSmtpEndpoint": {
"TestVPCEmailSmtpEndpoint": {
"Properties": {
"PrivateDnsEnabled": true,
"SecurityGroupIds": [
Expand All @@ -263,7 +263,7 @@
},
"Type": "AWS::EC2::VPCEndpoint"
},
"LogsEndpoint": {
"TestVPCLogsEndpoint": {
"Properties": {
"PrivateDnsEnabled": true,
"SecurityGroupIds": [
Expand All @@ -284,7 +284,7 @@
},
"Type": "AWS::EC2::VPCEndpoint"
},
"StsEndpoint": {
"TestVPCStsEndpoint": {
"Properties": {
"PrivateDnsEnabled": true,
"SecurityGroupIds": [
Expand Down
2 changes: 1 addition & 1 deletion tests/tests_e3_aws/troposphere/ec2/vpc_ses_endpoint.json
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@
},
"Type": "AWS::EC2::SecurityGroupIngress"
},
"EmailSmtpEndpoint": {
"TestVPCEmailSmtpEndpoint": {
"Properties": {
"PrivateDnsEnabled": true,
"SecurityGroupIds": [
Expand Down

0 comments on commit 2094dfc

Please sign in to comment.