mirror of
https://github.com/opentffoundation/opentf.git
synced 2026-05-09 12:02:55 -04:00
Update docs to say that volumes can be created without host_path, which will create an nonpersistent volume, as per http://docs.aws.amazon.com/AmazonECS/latest/developerguide/using_data_volumes.html. This feature was implemented in #3810 but did not appear in the docs.
3.0 KiB
3.0 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" "service" {
family = "service"
container_definitions = "${file("task-definitions/service.json")}"
volume {
name = "service-storage"
host_path = "/ecs/service-storage"
}
}
The referenced task-definitions/service.json file contains a valid JSON document,
which is show below, and its content is going to be passed directly into the
container_definitions attribute as a string. Please note that this example
contains only a small subset of the available parameters.
[
{
"name": "first",
"image": "service-first",
"cpu": 10,
"memory": 512,
"essential": true,
"portMappings": [
{
"containerPort": 80,
"hostPort": 80
}
]
},
{
"name": "second",
"image": "service-second",
"cpu": 10,
"memory": 256,
"essential": true,
"portMappings": [
{
"containerPort": 443,
"hostPort": 443
}
]
}
]
Argument Reference
The following arguments are supported:
family- (Required) An unique name for your task definition.container_definitions- (Required) A list of valid [container definitions] (http://docs.aws.amazon.com/AmazonECS/latest/APIReference/API_ContainerDefinition.html) provided as a single valid JSON document. Please note that you should only provide values that are part of the container definition document. For a detailed description of what parameters are available, see the [Task Definition Parameters] (https://docs.aws.amazon.com/AmazonECS/latest/developerguide/task_definition_parameters.html) section from the official Developer Guide.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 arenone,bridge, andhost.volume- (Optional) A volume block. See below for details about what arguments are supported.
Volume block supports the following arguments:
name- (Required) The name of the volume. This name is referenced in thesourceVolumeparameter of container definition in themountPointssection.host_path- (Optional) The path on the host container instance that is presented to the container. If not set, ECS will create a nonpersistent data volume that starts empty and is deleted after the task has finished.
Attributes Reference
The following attributes are exported:
arn- Full ARN of the Task Definition (including bothfamilyandrevision).family- The family of the Task Definition.revision- The revision of the task in a particular family.