Skip to content
This repository has been archived by the owner on Nov 27, 2023. It is now read-only.

Commit

Permalink
ECS: supporting x-aws-assign_public_ip
Browse files Browse the repository at this point in the history
Allowing users to choose whether their instances should get a public IP address or not.
Defaulting to "no".

Signed-off-by: Nitzan Raz <[email protected]>
  • Loading branch information
BackSlasher committed Jan 11, 2023
1 parent bd636e0 commit c308a67
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 3 deletions.
5 changes: 4 additions & 1 deletion ecs/cloudformation.go
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,10 @@ func (b *ecsAPIService) createService(project *types.Project, service types.Serv
return err
}

assignPublicIP := ecsapi.AssignPublicIpEnabled
assignPublicIP := "DISABLED"
if assignPublicIPSetting, ok := service.Extensions[extensionAssignPublicIP]; ok && assignPublicIPSetting.(bool) {
assignPublicIP = ecsapi.AssignPublicIpEnabled
}
launchType := ecsapi.LaunchTypeFargate
platformVersion := "1.4.0" // LATEST which is set to 1.3.0 (?) which doesn’t allow efs volumes.
if requireEC2(service) {
Expand Down
1 change: 1 addition & 0 deletions ecs/testdata/input/slightly-complex-service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ services:
image: nginx
ports:
- "80:80"
x-aws-assign_public_ip: true

sensitive:
image: httpd
2 changes: 1 addition & 1 deletion ecs/testdata/simple-cloudformation-conversion.golden
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ Resources:
Ref: SimpleTCP80TargetGroup
NetworkConfiguration:
AwsvpcConfiguration:
AssignPublicIp: ENABLED
AssignPublicIp: DISABLED
SecurityGroups:
- Ref: DefaultNetwork
Subnets:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ Resources:
LaunchType: FARGATE
NetworkConfiguration:
AwsvpcConfiguration:
AssignPublicIp: ENABLED
AssignPublicIp: DISABLED
SecurityGroups:
- Ref: DefaultNetwork
Subnets:
Expand Down
1 change: 1 addition & 0 deletions ecs/x.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,5 @@ const (
extensionManagedPolicies = "x-aws-policies"
extensionAutoScaling = "x-aws-autoscaling"
extensionCloudFormation = "x-aws-cloudformation"
extensionAssignPublicIP = "x-aws-assign_public_ip"
)

0 comments on commit c308a67

Please sign in to comment.