From 9b4528fb661d17b9e765ac7f357442ae22d6f3ec Mon Sep 17 00:00:00 2001 From: Rafael Gumieri Date: Mon, 10 Jun 2024 10:46:54 -0300 Subject: [PATCH] feat: if there's a public ip on tasks run, show it instead of the private ip --- cmd/task_definitions_run.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/cmd/task_definitions_run.go b/cmd/task_definitions_run.go index 6a2632e..7040f0a 100644 --- a/cmd/task_definitions_run.go +++ b/cmd/task_definitions_run.go @@ -221,7 +221,10 @@ func taskDefinitionsRunRun(cmd *cobra.Command, args []string) { t.Exitln("failed to describe the EC2 Instance running this task") } - hostIp := ec2Info.Reservations[0].Instances[0].PrivateIpAddress + hostIp := ec2Info.Reservations[0].Instances[0].PublicIpAddress + if hostIp == nil { + hostIp = ec2Info.Reservations[0].Instances[0].PrivateIpAddress + } hostPort := tasksStatus.Tasks[0].Containers[0].NetworkBindings[0].HostPort