From 34a0a526b0fb0edad16cd4848248463ef3800dbe Mon Sep 17 00:00:00 2001 From: wlggraham Date: Wed, 20 May 2026 13:00:58 -0600 Subject: [PATCH] feat(ecs): support assign_public_ip in vpc_config for public Fargate clusters Add AssignPublicIp field to vpcConfig so clusters can opt in to public IP assignment via assign_public_ip: true in their cluster context. Defaults to disabled to preserve existing behavior. Co-Authored-By: Claude Sonnet 4.6 --- internal/pkg/object/command/ecs/ecs.go | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/internal/pkg/object/command/ecs/ecs.go b/internal/pkg/object/command/ecs/ecs.go index b2750b7..8ecbe3e 100644 --- a/internal/pkg/object/command/ecs/ecs.go +++ b/internal/pkg/object/command/ecs/ecs.go @@ -57,6 +57,7 @@ type clusterContext struct { type vpcConfig struct { Subnets []string `yaml:"subnets,omitempty" json:"subnets,omitempty"` SecurityGroups []string `yaml:"security_groups,omitempty" json:"security_groups,omitempty"` + AssignPublicIp bool `yaml:"assign_public_ip,omitempty" json:"assign_public_ip,omitempty"` } // Task definition wrapper with pre-computed essential containers map @@ -649,7 +650,7 @@ func runTask(ctx context.Context, execCtx *executionContext, startedBy string, t AwsvpcConfiguration: &types.AwsVpcConfiguration{ Subnets: execCtx.ClusterConfig.VPCConfig.Subnets, SecurityGroups: execCtx.ClusterConfig.VPCConfig.SecurityGroups, - AssignPublicIp: types.AssignPublicIpDisabled, + AssignPublicIp: assignPublicIp(execCtx.ClusterConfig.VPCConfig.AssignPublicIp), }, }, } @@ -841,6 +842,14 @@ func retryWithBackoff(ctx context.Context, maxRetries int, op func() error) erro return err } +// assignPublicIp converts a bool to the ECS AssignPublicIp enum value. +func assignPublicIp(enabled bool) types.AssignPublicIp { + if enabled { + return types.AssignPublicIpEnabled + } + return types.AssignPublicIpDisabled +} + // isThrottlingError reports whether err is an AWS throttling error. func isThrottlingError(err error) bool { var apiErr smithy.APIError