github.com/ves/terraform@v0.8.0-beta2/website/source/docs/providers/aws/r/ecs_task_definition.html.markdown (about) 1 --- 2 layout: "aws" 3 page_title: "AWS: aws_ecs_task_definition" 4 sidebar_current: "docs-aws-resource-ecs-task-definition" 5 description: |- 6 Provides an ECS task definition. 7 --- 8 9 # aws\_ecs\_task\_definition 10 11 Provides an ECS task definition to be used in `aws_ecs_service`. 12 13 ## Example Usage 14 15 ``` 16 resource "aws_ecs_task_definition" "service" { 17 family = "service" 18 container_definitions = "${file("task-definitions/service.json")}" 19 20 volume { 21 name = "service-storage" 22 host_path = "/ecs/service-storage" 23 } 24 } 25 ``` 26 27 The referenced `task-definitions/service.json` file contains a valid JSON document, 28 which is show below, and its content is going to be passed directly into the 29 `container_definitions` attribute as a string. Please note that this example 30 contains only a small subset of the available parameters. 31 32 ``` 33 [ 34 { 35 "name": "first", 36 "image": "service-first", 37 "cpu": 10, 38 "memory": 512, 39 "essential": true, 40 "portMappings": [ 41 { 42 "containerPort": 80, 43 "hostPort": 80 44 } 45 ] 46 }, 47 { 48 "name": "second", 49 "image": "service-second", 50 "cpu": 10, 51 "memory": 256, 52 "essential": true, 53 "portMappings": [ 54 { 55 "containerPort": 443, 56 "hostPort": 443 57 } 58 ] 59 } 60 ] 61 ``` 62 63 ## Argument Reference 64 65 The following arguments are supported: 66 67 * `family` - (Required) An unique name for your task definition. 68 * `container_definitions` - (Required) A list of valid [container definitions] 69 (http://docs.aws.amazon.com/AmazonECS/latest/APIReference/API_ContainerDefinition.html) provided as a 70 single valid JSON document. Please note that you should only provide values that are part of the container 71 definition document. For a detailed description of what parameters are available, see the [Task Definition Parameters] 72 (https://docs.aws.amazon.com/AmazonECS/latest/developerguide/task_definition_parameters.html) section from the 73 official [Developer Guide](https://docs.aws.amazon.com/AmazonECS/latest/developerguide). 74 * `task_role_arn` - (Optional) The ARN of IAM role that allows your Amazon ECS container task to make calls to other AWS services. 75 * `network_mode` - (Optional) The Docker networking mode to use for the containers in the task. The valid values are `none`, `bridge`, and `host`. 76 * `volume` - (Optional) A volume block. See below for details about what arguments are supported. 77 78 Volume block supports the following arguments: 79 80 * `name` - (Required) The name of the volume. This name is referenced in the `sourceVolume` 81 parameter of container definition in the `mountPoints` section. 82 * `host_path` - (Required) The path on the host container instance that is presented to the container. 83 84 ## Attributes Reference 85 86 The following attributes are exported: 87 88 * `arn` - Full ARN of the Task Definition (including both `family` and `revision`). 89 * `family` - The family of the Task Definition. 90 * `revision` - The revision of the task in a particular family.