Files
opentf/website/source/docs/providers/aws/r/ecs_task_definition.html.markdown
Paul Stack 2f936eaad4 provider/aws: Add support for network_mode to aws_ecs_task_definition (#8391)
* provider/aws: Add support for `network_mode` to
`aws_ecs_task_definition`

Fixes #8281

```

```
make testacc TEST=./builtin/providers/aws TESTARGS='-run=TestAccAWSEcsTaskDefinition_'
==> Checking that code complies with gofmt requirements...
/Users/stacko/Code/go/bin/stringer
go generate $(go list ./... | grep -v /terraform/vendor/)
2016/08/22 18:12:20 Generated command/internal_plugin_list.go
TF_ACC=1 go test ./builtin/providers/aws -v -run=TestAccAWSEcsTaskDefinition_ -timeout 120m
=== RUN   TestAccAWSEcsTaskDefinition_basic
--- PASS: TestAccAWSEcsTaskDefinition_basic (29.02s)
=== RUN   TestAccAWSEcsTaskDefinition_withScratchVolume
--- PASS: TestAccAWSEcsTaskDefinition_withScratchVolume (16.75s)
=== RUN   TestAccAWSEcsTaskDefinition_withEcsService
--- PASS: TestAccAWSEcsTaskDefinition_withEcsService (147.77s)
=== RUN   TestAccAWSEcsTaskDefinition_withTaskRoleArn
--- PASS: TestAccAWSEcsTaskDefinition_withTaskRoleArn (19.49s)
=== RUN   TestAccAWSEcsTaskDefinition_withNetworkMode
--- PASS: TestAccAWSEcsTaskDefinition_withNetworkMode (19.52s)
PASS
ok  	github.com/hashicorp/terraform/builtin/providers/aws	232.588

* Update resource_aws_ecs_task_definition.go

* Update ecs_task_definition.html.markdown
2016-08-23 11:27:45 +01:00

2.3 KiB

layout, page_title, sidebar_current, description
layout page_title sidebar_current description
aws AWS: aws_ecs_task_definition docs-aws-resource-ecs-task-definition Provides an ECS task definition.

aws_ecs_task_definition

Provides an ECS task definition to be used in aws_ecs_service.

Example Usage

resource "aws_ecs_task_definition" "jenkins" {
  family = "jenkins"
  container_definitions = "${file("task-definitions/jenkins.json")}"

  volume {
    name = "jenkins-home"
    host_path = "/ecs/jenkins-home"
  }
}

task-definitions/jenkins.json

The below would be passed into the container_definitions attribute. This is a small subset of the available parameters, see the AWS docs for a full list.

[
  {
    "name": "jenkins",
    "image": "jenkins",
    "cpu": 10,
    "memory": 500,
    "essential": true,
    "portMappings": [
      {
        "containerPort": 80,
        "hostPort": 80
      }
    ]
  }
]

Argument Reference

The following arguments are supported:

  • family - (Required) The family, unique name for your task definition.
  • container_definitions - (Required) A list of container definitions in JSON format. See AWS docs for syntax. Note, you only need the containerDefinitions array, not the parent hash including the family and volumes keys.
  • task_role_arn - (Optional) The ARN of IAM role that allows your Amazon ECS container task to make calls to other AWS services.
  • network_mode - (Optional) The Docker networking mode to use for the containers in the task. The valid values are none, bridge, and host.
  • volume - (Optional) A volume block. Volumes documented below.

Volumes support the following:

  • name - (Required) The name of the volume. This name is referenced in the sourceVolume parameter of container definition mountPoints.
  • host_path - (Required) The path on the host container instance that is presented to the container.

Attributes Reference

The following attributes are exported:

  • arn - Full ARN of the task definition (including both family & revision)
  • family - The family of the task definition.
  • revision - The revision of the task in a particular family.