Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions EXAMPLE.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,23 @@ module "ecs_task_definition" {
}
```

## Create ECS Task Definition with specified runtime platform
If `runtime_platform` variable is not passed default os will be `LINUX` and architecture will be `X86_64`
```
module "ecs_task_definition" {
source = "git::https://github.com/TechHoldingLLC/terraform-aws-ecs-task-definition.git?ref=v1.0.8"

name = "demo-ecs-task-definition"
task_cpu = 256
task_memory = 512

container_definitions = [module.con_def_1.container_definition, module.con_def_2.container_definition]

#If variable is not passed default os will be `LINUX` and architecture will be `X86_64`
runtime_platform = {
operating_system_family = "LINUX"
cpu_architecture = "ARM64"
}
}
```

1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ No modules.
| <a name="input_name"></a> [name](#input\_name) | ECS task definition name | `string` | n/a | yes |
| <a name="input_network_mode"></a> [network\_mode](#input\_network\_mode) | Docker networking mode to use for the containers in the task. The valid values are none, bridge, awsvpc, and host. | `string` | `"awsvpc"` | no |
| <a name="input_requires_compatibilities"></a> [requires\_compatibilities](#input\_requires\_compatibilities) | A set of launch types required by the task. The valid values are EC2 and FARGATE. | `list(string)` | <pre>[<br/> "FARGATE"<br/>]</pre> | no |
| <a name="input_runtime_platform"></a> [runtime\_platform](#input\_runtime\_platform) | The operating system family and the CPU architecture to use for the task. The valid values for operatingSystemFamily are WINDOWS and LINUX. The valid values for cpuArchitecture are X86\_64 and ARM64. | <pre>object({<br/> operating_system_family = string<br/> cpu_architecture = string<br/> })</pre> | `null` | no |
| <a name="input_ssm_kms_alias"></a> [ssm\_kms\_alias](#input\_ssm\_kms\_alias) | SSM kms key alias | `string` | `"alias/aws/ssm"` | no |
| <a name="input_task_cpu"></a> [task\_cpu](#input\_task\_cpu) | ECS fargate task cpu | `number` | n/a | yes |
| <a name="input_task_memory"></a> [task\_memory](#input\_task\_memory) | ECS fargate task memory | `number` | n/a | yes |
Expand Down
9 changes: 9 additions & 0 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -62,4 +62,13 @@ resource "aws_ecs_task_definition" "task" {
}
}
}

dynamic "runtime_platform" {
for_each = var.runtime_platform != null ? [var.runtime_platform] : []

content {
operating_system_family = runtime_platform.value.operating_system_family
cpu_architecture = runtime_platform.value.cpu_architecture
}
}
}
9 changes: 9 additions & 0 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -75,3 +75,12 @@ variable "ephemeral_storage_size" {
type = number
default = null
}

variable "runtime_platform" {
description = "The operating system family and the CPU architecture to use for the task. The valid values for operatingSystemFamily are WINDOWS and LINUX. The valid values for cpuArchitecture are X86_64 and ARM64."
type = object({
operating_system_family = string
cpu_architecture = string
})
default = null
}