github.com/danp/terraform@v0.9.5-0.20170426144147-39d740081351/website/source/docs/providers/aws/d/ecs_task_definition.html.markdown (about) 1 --- 2 layout: "aws" 3 page_title: "AWS: aws_ecs_task_definition" 4 sidebar_current: "docs-aws-datasource-ecs-task-definition" 5 description: |- 6 Provides details about an ecs task definition 7 --- 8 9 # aws\_ecs\_task\_definition 10 11 The ECS task definition data source allows access to details of 12 a specific AWS ECS task definition. 13 14 15 ## Example Usage 16 17 ```hcl 18 # Simply specify the family to find the latest ACTIVE revision in that family. 19 data "aws_ecs_task_definition" "mongo" { 20 task_definition = "${aws_ecs_task_definition.mongo.family}" 21 } 22 23 resource "aws_ecs_cluster" "foo" { 24 name = "foo" 25 } 26 27 resource "aws_ecs_task_definition" "mongo" { 28 family = "mongodb" 29 30 container_definitions = <<DEFINITION 31 [ 32 { 33 "cpu": 128, 34 "environment": [{ 35 "name": "SECRET", 36 "value": "KEY" 37 }], 38 "essential": true, 39 "image": "mongo:latest", 40 "memory": 128, 41 "memoryReservation": 64, 42 "name": "mongodb" 43 } 44 ] 45 DEFINITION 46 } 47 48 resource "aws_ecs_service" "mongo" { 49 name = "mongo" 50 cluster = "${aws_ecs_cluster.foo.id}" 51 desired_count = 2 52 53 # Track the latest ACTIVE revision 54 task_definition = "${aws_ecs_task_definition.mongo.family}:${max("${aws_ecs_task_definition.mongo.revision}", "${data.aws_ecs_task_definition.mongo.revision}")}" 55 } 56 ``` 57 58 ## Argument Reference 59 60 The following arguments are supported: 61 62 * `task_definition` - (Required) The family for the latest ACTIVE revision, family and revision (family:revision) for a specific revision in the family, the ARN of the task definition to access to. 63 64 ## Attributes Reference 65 66 The following attributes are exported: 67 68 * `family` - The family of this task definition 69 * `network_mode` - The Docker networking mode to use for the containers in this task. 70 * `revision` - The revision of this task definition 71 * `status` - The status of this task definition 72 * `task_role_arn` - The ARN of the IAM role that containers in this task can assume