Skip to content

geekcell/terraform-aws-ecs-task-definition

Repository files navigation

Geek Cell GmbH

Code Quality

License GitHub release (latest tag) Release Validate Lint

Terraform AWS ECS Task Definition Module

Terraform module for creating an AWS ECS Task Definition.

Inputs

Name Description Type Default Required
additional_execute_role_policies Additional policy ARNs to attach to the execution role. list(string) [] no
additional_task_role_policies Additional policy ARNs to attach to the task role. list(string) [] no
container_definitions A list of valid container definitions provided as a valid HCL object list. any n/a yes
cpu Number of CPU units used by the task. number 1024 no
cpu_architecture CPU architecture required by the task. string "X86_64" no
create_execution_role If enabled, will create an execution role and attach the AmazonECSTaskExecutionRolePolicy to it. bool true no
create_task_role If enabled, will create a task role. bool true no
enable_execute_command If enabled, will add the AmazonSSMManagedInstanceCore to the task role. bool true no
ephemeral_storage_size_in_gib The amount of ephemeral storage (in GiB) to allocate to the task. number 20 no
execution_role_arn Execution role ARN to attach to the task. string null no
execution_role_name Name of the execution role to create. string null no
execution_role_name_prefix Whether to prefix the execution role name with the family name. bool false no
inference_accelerators List of Elastic Inference accelerators associated with the task.
list(object({
name = string
type = string
}))
[] no
memory Amount (in MiB) of memory used by the task. number 2048 no
name Family of the task definition. string n/a yes
network_mode The network mode to use for the containers in the task. The valid values are bridge, host, awsvpc, and none. If no network mode is specified, the default is bridge. string "awsvpc" no
operating_system_family OS family required by the task. string "LINUX" no
proxy_configuration Configuration details for an App Mesh proxy.
object({
container_name = string
properties = map(any)
type = optional(string, "APPMESH")
})
null no
requires_compatibilities The launch type on which to run your service. The valid values are EC2 and FARGATE. list(string)
[
"FARGATE"
]
no
tags Tags to add to the created resources. map(any) {} no
task_role_arn Task role ARN to attach to the task. string null no
task_role_name Name of the task role to create. string null no
task_role_name_prefix Whether to prefix the task role name with the family name. bool false no
volumes A list of volume definitions.
list(object({
name = string
host_path = string

docker_volume_configuration = optional(object({
autoprovision = bool
driver = string
driver_opts = map(any)
labels = map(any)
scope = string
}))

efs_volume_configuration = optional(object({
file_system_id = string
root_directory = optional(string)
transit_encryption = optional(string)
transit_encryption_port = optional(number)

authorization_config = optional(object({
access_point_id = string
iam = optional(string)
}))
}))
}))
[] no

Outputs

Name Description
arn The ARN of the task definition.
execution_role_arn The ARN of the IAM role that grants the Amazon ECS container agent permission to make calls to your Amazon ECS container task.
execution_role_name The name of the IAM role that grants the Amazon ECS container agent permission to make calls to your Amazon ECS container task.
task_role_arn The ARN of the IAM role that allows your Amazon ECS container task to make calls to other AWS services.
task_role_name The name of the IAM role that allows your Amazon ECS container task to make calls to other AWS services.

Providers

Name Version
aws >= 4.36

Resources

  • resource.aws_ecs_task_definition.main (main.tf#6)
  • resource.aws_iam_role_policy_attachment.execute_additional (main.tf#113)
  • resource.aws_iam_role_policy_attachment.execute_command (main.tf#139)
  • resource.aws_iam_role_policy_attachment.task_additional (main.tf#132)