github.com/daveadams/terraform@v0.6.4-0.20160830094355-13ce74975936/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" "jenkins" { 17 family = "jenkins" 18 container_definitions = "${file("task-definitions/jenkins.json")}" 19 20 volume { 21 name = "jenkins-home" 22 host_path = "/ecs/jenkins-home" 23 } 24 } 25 ``` 26 27 ### task-definitions/jenkins.json 28 29 The below would be passed into the `container_definitions` attribute. This is a small subset of the available parameters, see the [AWS docs](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/task_definition_parameters.html) for a full list. 30 31 ``` 32 [ 33 { 34 "name": "jenkins", 35 "image": "jenkins", 36 "cpu": 10, 37 "memory": 500, 38 "essential": true, 39 "portMappings": [ 40 { 41 "containerPort": 80, 42 "hostPort": 80 43 } 44 ] 45 } 46 ] 47 ``` 48 49 ## Argument Reference 50 51 The following arguments are supported: 52 53 * `family` - (Required) The family, unique name for your task definition. 54 * `container_definitions` - (Required) A list of container definitions in JSON format. See [AWS docs](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/create-task-definition.html) for syntax. Note, you only need the containerDefinitions array, not the parent hash including the family and volumes keys. 55 * `task_role_arn` - (Optional) The ARN of IAM role that allows your Amazon ECS container task to make calls to other AWS services. 56 * `network_mode` - (Optional) The Docker networking mode to use for the containers in the task. The valid values are `none`, `bridge`, and `host`. 57 * `volume` - (Optional) A volume block. Volumes documented below. 58 59 Volumes support the following: 60 61 * `name` - (Required) The name of the volume. This name is referenced in the `sourceVolume` parameter of container definition `mountPoints`. 62 * `host_path` - (Required) The path on the host container instance that is presented to the container. 63 64 ## Attributes Reference 65 66 The following attributes are exported: 67 68 * `arn` - Full ARN of the task definition (including both `family` & `revision`) 69 * `family` - The family of the task definition. 70 * `revision` - The revision of the task in a particular family.