cloudposse / terraform-aws-ecs-container-definition

Terraform module to generate well-formed JSON documents (container definitions) that are passed to the aws_ecs_task_definition Terraform resource
https://cloudposse.com/accelerate
Apache License 2.0
339 stars 244 forks source link

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

Open gtie opened 7 months ago

gtie commented 7 months ago

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

joe-niland commented 7 months ago

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?

zahorniak commented 6 months ago

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.