mirror of
https://github.com/opentffoundation/opentf.git
synced 2026-03-12 07:01:03 -04:00
* docs/vsphere: Fix code block * docs: Convert `...` to `# ...` to allow `terraform fmt`ing * docs: Trim trailing whitespace * docs: First-pass run of `terraform fmt` on code examples
1.9 KiB
1.9 KiB
layout, page_title, sidebar_current, description
| layout | page_title | sidebar_current | description |
|---|---|---|---|
| aws | AWS: aws_ecs_task_definition | docs-aws-datasource-ecs-task-definition | Provides details about an ecs task definition |
aws_ecs_task_definition
The ECS task definition data source allows access to details of a specific AWS ECS task definition.
Example Usage
# Simply specify the family to find the latest ACTIVE revision in that family.
data "aws_ecs_task_definition" "mongo" {
task_definition = "${aws_ecs_task_definition.mongo.family}"
}
resource "aws_ecs_cluster" "foo" {
name = "foo"
}
resource "aws_ecs_task_definition" "mongo" {
family = "mongodb"
container_definitions = <<DEFINITION
[
{
"cpu": 128,
"environment": [{
"name": "SECRET",
"value": "KEY"
}],
"essential": true,
"image": "mongo:latest",
"memory": 128,
"memoryReservation": 64,
"name": "mongodb"
}
]
DEFINITION
}
resource "aws_ecs_service" "mongo" {
name = "mongo"
cluster = "${aws_ecs_cluster.foo.id}"
desired_count = 2
# Track the latest ACTIVE revision
task_definition = "${aws_ecs_task_definition.mongo.family}:${max("${aws_ecs_task_definition.mongo.revision}", "${data.aws_ecs_task_definition.mongo.revision}")}"
}
Argument Reference
The following arguments are supported:
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.
Attributes Reference
The following attributes are exported:
family- The family of this task definitionnetwork_mode- The Docker networking mode to use for the containers in this task.revision- The revision of this task definitionstatus- The status of this task definitiontask_role_arn- The ARN of the IAM role that containers in this task can assume