This is a stable example. It should successfully build out of the box
This examples does is built on Construct Libraries marked "Stable" and does not have any infrastructure prerequisites to build.
This module can be used to deploy aECS Task Definition on AWS Cloud Provider......
This module needs Terraform 0.12.19 or newer. You can download the latest Terraform version from here.
Below we are able to check the resources that are being created as part of this module call:
- ECS Task Definition
To use this module, add the following call to your code:
module "ecs_task_definition" {
source = "git::https://github.com/nitinda/terraform-module-aws-ecs-task-definition.git?ref=terraform-12/master"
providers = {
aws = aws.services
}
family = "nginx"
container_definitions = <<EOF
[
{
"Name": "nginx",
"Image": "nginx",
"PortMappings": [
{
"ContainerPort": 80,
"Protocol": "tcp",
"HostPort": 8080
}
],
"MemoryReservation": 12,
"Memory": 64,
"Essential": true
}
]
EOF
memory = 512
cpu = 256
network_mode = "bridge"
requires_compatibilities = ["EC2"]
# Tags
tags = {
Project = "POC"
Environment = "prod"
}
}
module "ecs_task_definition" {
source = "git::https://github.com/nitinda/terraform-module-aws-ecs-task-definition.git?ref=terraform-12/master"
providers = {
aws = aws.services
}
family = "nginx"
container_definitions = <<EOF
[
{
"Name": "nginx",
"Image": "nginx",
"PortMappings": [
{
"ContainerPort": 80,
"Protocol": "tcp",
"HostPort": 8080
}
],
"MemoryReservation": 12,
"Memory": 64,
"Essential": true
}
]
EOF
# Tags
tags = {
Project = "POC"
Environment = "prod"
}
}
The variables required in order for the module to be successfully called from the deployment repository are the following:
Variable | Description | Type | Argument Status |
---|---|---|---|
family | A unique name for your task definition | string | Required |
container_definitions | A list of valid container definitions provided as a single valid JSON document |
string | Required |
task_role_arn | The ARN of IAM role that allows your Amazon ECS container task to make calls to other AWS services |
string | Optional (Default - null) |
execution_role_arn | The ARN of the task execution role that the Amazon ECS container agent and the Docker daemon can assume |
string | Optional (Default - null) |
network_mode | The Docker networking mode to use for the containers in the task |
string | Optional (Default - null) |
ipc_mode | The IPC resource namespace to be used for the containers in the task |
string | Optional (Default - null) |
pid_mode | The process namespace to use for the containers in the task |
string | Optional (Default - null) |
volume | A set of volume blocks that containers in your task may use |
any | Optional (Default - {}) |
placement_constraints | A set of placement constraints rules that are taken into consideration during task placement |
any | Optional (Default - []) |
cpu | The number of cpu units used by the task | string | Optional (Default - null) |
memory | The amount (in MiB) of memory used by the task | string | Optional (Default - null) |
requires_compatibilities | A set of launch types | list(string) | Optional (Default - {}) |
tags | Resource tags | map(string) | Required |
This module has the following outputs:
- arn
- family
- revision
In order for the variables to be accessed at module level please use the syntax below:
data.terraform_remote_state.<layer_name>.<output_variable_name>
Module maintained by Module maintained by the - Nitin Das