Skip to main content

Module: ecs-container-definition

Terraform module to generate well-formed JSON documents that are passed to the aws_ecs_task_definition Terraform resource as container definitions.

Usage

This module is meant to be used as output only, meaning it will be used to create outputs which are consumed as a parameter by Terraform resources or other modules.

Caution: This module, unlike nearly all other Cloud Posse Terraform modules, does not use terraform-null-label. Furthermore, it has an input named environment which has a completely different meaning than the one in terraform-null-label. Do not call this module with the conventional context = module.this.context. See the documentation below for the usage of environment.

For complete examples, see

For a complete example with automated tests, see examples/complete with bats and Terratest for the example test.

module "container_definition" {
source = "cloudposse/ecs-container-definition/aws"
# Cloud Posse recommends pinning every module to a specific version
# version = "x.x.x"

container_name = "geodesic"
container_image = "cloudposse/geodesic"
}

The output of this module can then be used with one of our other modules.

module "ecs_alb_service_task" {
source = "cloudposse/ecs-alb-service-task/aws"
# Cloud Posse recommends pinning every module to a specific version
# version = "x.x.x"

# ...
container_definition_json = module.container_definition.json_map_encoded_list
# ...
}