Skip to content

Commit 58665ef

Browse files
Remove task.tf
1 parent 71182e0 commit 58665ef

File tree

1 file changed

+1
-111
lines changed

1 file changed

+1
-111
lines changed

Diff for: task.tf

+1-111
Original file line numberDiff line numberDiff line change
@@ -1,113 +1,3 @@
1-
# A task definition is created if the user does not specify a task
2-
# definition arn. The task definition map is used to customize the
3-
# task definition created.
4-
# https://docs.aws.amazon.com/AmazonECS/latest/developerguide/task_definition_parameters.html
5-
6-
# The cpu and memory values define the TOTAL cpu and memory resources
7-
# reserved for all the containers defined in the container definition
8-
# file; individual container cpu and memory sizes are defined in
9-
# the task's container definition file. These values must not exceed
10-
# the TOTAL set here.
11-
# https://docs.aws.amazon.com/AmazonECS/latest/developerguide/task_definition_parameters.html#task_size
12-
131
locals {
14-
task_definition_arn = element(
15-
concat(
16-
aws_ecs_task_definition.fargate.*.arn,
17-
aws_ecs_task_definition.ec2.*.arn,
18-
[""],
19-
),
20-
0,
21-
)
22-
}
23-
24-
resource "aws_ecs_task_definition" "fargate" {
25-
count = var.task_definition_arn == "" && var.launch_type == "FARGATE" ? 1 : 0
26-
27-
family = var.name
28-
container_definitions = file(local.container_definition_file)
29-
task_role_arn = local.task_role_arn
30-
execution_role_arn = format(
31-
"arn:aws:iam::%s:role/ecsTaskExecutionRole",
32-
data.aws_caller_identity.current.account_id,
33-
)
34-
35-
network_mode = local.network_mode
36-
37-
dynamic "volume" {
38-
for_each = var.volume
39-
content {
40-
host_path = volume.value.host_path
41-
name = volume.value.name
42-
43-
dynamic "docker_volume_configuration" {
44-
for_each = volume.value.docker_volume_configuration != null ? [volume.value.docker_volume_configuration] : []
45-
content {
46-
autoprovision = docker_volume_configuration.value.autoprovision
47-
driver = docker_volume_configuration.value.driver
48-
driver_opts = docker_volume_configuration.value.driver_opts
49-
labels = docker_volume_configuration.value.labels
50-
scope = docker_volume_configuration.value.scope
51-
}
52-
}
53-
54-
dynamic "efs_volume_configuration" {
55-
for_each = volume.value.efs_volume_configuration != null ? [volume.value.efs_volume_configuration] : []
56-
content {
57-
file_system_id = efs_volume_configuration.value.file_system_id
58-
root_directory = efs_volume_configuration.value.root_directory
59-
}
60-
}
61-
}
62-
}
63-
64-
cpu = local.cpu
65-
memory = local.memory
66-
requires_compatibilities = ["FARGATE"]
67-
68-
tags = merge({ "Name" = var.name }, var.tags)
69-
}
70-
71-
resource "aws_ecs_task_definition" "ec2" {
72-
count = var.task_definition_arn == "" && var.launch_type == "EC2" ? 1 : 0
73-
74-
family = var.name
75-
container_definitions = file(local.container_definition_file)
76-
task_role_arn = local.task_role_arn
77-
execution_role_arn = format(
78-
"arn:aws:iam::%s:role/ecsTaskExecutionRole",
79-
data.aws_caller_identity.current.account_id,
80-
)
81-
82-
network_mode = local.network_mode
83-
dynamic "volume" {
84-
for_each = var.volume
85-
content {
86-
host_path = volume.value.host_path
87-
name = volume.value.name
88-
89-
dynamic "docker_volume_configuration" {
90-
for_each = volume.value.docker_volume_configuration != null ? [volume.value.docker_volume_configuration] : []
91-
content {
92-
autoprovision = docker_volume_configuration.value.autoprovision
93-
driver = docker_volume_configuration.value.driver
94-
driver_opts = docker_volume_configuration.value.driver_opts
95-
labels = docker_volume_configuration.value.labels
96-
scope = docker_volume_configuration.value.scope
97-
}
98-
}
99-
100-
dynamic "efs_volume_configuration" {
101-
for_each = volume.value.efs_volume_configuration != null ? [volume.value.efs_volume_configuration] : []
102-
content {
103-
file_system_id = efs_volume_configuration.value.file_system_id
104-
root_directory = efs_volume_configuration.value.root_directory
105-
}
106-
}
107-
}
108-
}
109-
110-
requires_compatibilities = ["EC2"]
111-
112-
tags = merge({ "Name" = var.name }, var.tags)
2+
task_definition_arn = ""
1133
}

0 commit comments

Comments
 (0)