terraform-aws-ecs-container-definition icon indicating copy to clipboard operation
terraform-aws-ecs-container-definition copied to clipboard

Support for `enable_execute_command` flag passed to ECS container-definition

Open gtie opened this issue 1 year ago • 2 comments

Describe the Feature

ECS supports executing commands/opening a shell into the containers. The flag to enable this is documented at https://registry.terraform.io/modules/terraform-aws-modules/ecs/aws/latest/submodules/container-definition#input_enable_execute_command. No such flag, however, is supported by the terraform-aws-ecs-container-definition module.

Expected Behavior

Be able to turn on the enable_execute_command in the container definitions.

Use Case

Debugging failures in running containers is most convenient when there is the option to execute commands on them.

Describe Ideal Solution

Be able to pass the flag enable_execute_command to the module.

Alternatives Considered

No response

Additional Context

No response

gtie avatar Feb 05 '24 17:02 gtie

Hi @gtie

The cloudposse/terraform-aws-ecs-alb-service-task module supports enabling ECS Exec and I can confirm it works.

I notice that in the module you referenced, this flag set the InitProcessEnabled param to true within LinuxParameters. It seems this is best practice but not essential.

That seems like a good addition to this module.

Will you be opening a PR?

joe-niland avatar Feb 06 '24 04:02 joe-niland

Hi @gtie, This flag should be set on ECS Service https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/ecs_service#enable_execute_command.

So you can't do it using this module because this module is only for Task definition: https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/ecs_task_definition.

zahorniak avatar Mar 11 '24 07:03 zahorniak