Skip to content

Commit 00c38ef

Browse files
committed
Fixing formatting issues
1 parent 54ea734 commit 00c38ef

File tree

2 files changed

+132
-119
lines changed

2 files changed

+132
-119
lines changed

main.tf

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,13 @@ resource "aws_iam_role_policy_attachment" "ecs_task_execution_role_policy_attach
1717
# Container Definition
1818
module "container_definition" {
1919
source = "cloudposse/ecs-container-definition/aws"
20-
version = "0.41.0"
20+
version = "0.45.2"
2121

2222
container_name = var.container_name
2323
container_image = var.container_image
2424
container_memory = var.container_memory
2525
container_memory_reservation = var.container_memory_reservation
26+
# container_definition = var.container_definition
2627
port_mappings = var.port_mappings
2728
healthcheck = var.healthcheck
2829
container_cpu = var.container_cpu
@@ -31,23 +32,33 @@ module "container_definition" {
3132
command = var.command
3233
working_directory = var.working_directory
3334
environment = var.environment
35+
# extra_hosts = var.extra_hosts
36+
# map_environment = var.map_environment
37+
# environment_files = var.environment_files
3438
secrets = var.secrets
3539
readonly_root_filesystem = var.readonly_root_filesystem
3640
linux_parameters = var.linux_parameters
3741
log_configuration = var.log_configuration
3842
firelens_configuration = var.firelens_configuration
3943
mount_points = var.mount_points
4044
dns_servers = var.dns_servers
45+
# dns_search_domains = var.dns_search_domains
4146
ulimits = var.ulimits
42-
docker_labels = var.docker_labels
4347
repository_credentials = var.repository_credentials
4448
volumes_from = var.volumes_from
4549
links = var.links
4650
user = var.user
4751
container_depends_on = var.container_depends_on
52+
docker_labels = var.docker_labels
4853
start_timeout = var.start_timeout
4954
stop_timeout = var.stop_timeout
55+
# privileged = var.
5056
system_controls = var.system_controls
57+
# hostname = var.hostname
58+
# disable_networking = var.disable_networking
59+
# interactive = var.interactive
60+
# pseudo_terminal = var.pseudo_terminal
61+
# docker_security_options = var.docker_security_options
5162
}
5263

5364
# Task Definition

variables.tf

Lines changed: 119 additions & 117 deletions
Original file line numberDiff line numberDiff line change
@@ -6,64 +6,86 @@ variable "name_prefix" {
66
}
77

88
#------------------------------------------------------------------------------
9-
# AWS ECS Container Definition Variables
9+
# AWS ECS Container Definition Variables for Cloudposse module
1010
#------------------------------------------------------------------------------
11-
variable "container_image" {
12-
description = "The image used to start the container."
13-
}
11+
1412

1513
variable "container_name" {
1614
description = "The name of the container. Up to 255 characters ([a-z], [A-Z], [0-9], -, _ allowed)"
1715
}
1816

19-
variable "command" {
20-
description = "(Optional) The command that is passed to the container"
21-
type = list(string)
22-
default = null
17+
variable "container_image" {
18+
description = "The image used to start the container."
2319
}
2420

25-
variable "container_cpu" {
21+
variable "container_memory" {
2622
# https://docs.aws.amazon.com/AmazonECS/latest/developerguide/AWS_Fargate.html#fargate-task-defs
27-
description = "(Optional) The number of cpu units to reserve for the container. This is optional for tasks using Fargate launch type and the total amount of container_cpu of all containers in a task will need to be lower than the task-level cpu value"
28-
default = 1024 # 1 vCPU
23+
description = "(Optional) The amount of memory (in MiB) to allow the container to use. This is a hard limit, if the container attempts to exceed the container_memory, the container is killed. This field is optional for Fargate launch type and the total amount of container_memory of all containers in a task will need to be lower than the task memory value"
24+
default = 8192 # 8 GB
2925
}
3026

31-
variable "container_depends_on" {
32-
description = "(Optional) The dependencies defined for container startup and shutdown. A container can contain multiple dependencies. When a dependency is defined for container startup, for container shutdown it is reversed"
27+
variable "container_memory_reservation" {
28+
# https://docs.aws.amazon.com/AmazonECS/latest/developerguide/AWS_Fargate.html#fargate-task-defs
29+
description = "(Optional) The amount of memory (in MiB) to reserve for the container. If container needs to exceed this threshold, it can do so up to the set container_memory hard limit"
30+
default = 2048 # 2 GB
31+
}
32+
33+
variable "port_mappings" {
34+
description = "The port mappings to configure for the container. This is a list of maps. Each map should contain \"containerPort\", \"hostPort\", and \"protocol\", where \"protocol\" is one of \"tcp\" or \"udp\". If using containers in a task with the awsvpc or host network mode, the hostPort can either be left blank or set to the same value as the containerPort"
3335
type = list(object({
34-
containerName = string
35-
condition = string
36+
containerPort = number
37+
hostPort = number
38+
protocol = string
3639
}))
40+
default = [
41+
{
42+
containerPort = 80
43+
hostPort = 80
44+
protocol = "tcp"
45+
}
46+
]
47+
}
48+
49+
# https://docs.aws.amazon.com/AmazonECS/latest/APIReference/API_HealthCheck.html
50+
variable "healthcheck" {
51+
description = "(Optional) A map containing command (string), timeout, interval (duration in seconds), retries (1-10, number of times to retry before marking container unhealthy), and startPeriod (0-300, optional grace period to wait, in seconds, before failed healthchecks count toward retries)"
52+
type = object({
53+
command = list(string)
54+
retries = number
55+
timeout = number
56+
interval = number
57+
startPeriod = number
58+
})
3759
default = null
3860
}
3961

40-
variable "container_memory" {
62+
variable "container_cpu" {
4163
# https://docs.aws.amazon.com/AmazonECS/latest/developerguide/AWS_Fargate.html#fargate-task-defs
42-
description = "(Optional) The amount of memory (in MiB) to allow the container to use. This is a hard limit, if the container attempts to exceed the container_memory, the container is killed. This field is optional for Fargate launch type and the total amount of container_memory of all containers in a task will need to be lower than the task memory value"
43-
default = 8192 # 8 GB
64+
description = "(Optional) The number of cpu units to reserve for the container. This is optional for tasks using Fargate launch type and the total amount of container_cpu of all containers in a task will need to be lower than the task-level cpu value"
65+
default = 1024 # 1 vCPU
4466
}
4567

46-
variable "container_memory_reservation" {
47-
# https://docs.aws.amazon.com/AmazonECS/latest/developerguide/AWS_Fargate.html#fargate-task-defs
48-
description = "(Optional) The amount of memory (in MiB) to reserve for the container. If container needs to exceed this threshold, it can do so up to the set container_memory hard limit"
49-
default = 2048 # 2 GB
68+
variable "essential" {
69+
description = "(Optional) Determines whether all other containers in a task are stopped, if this container fails or stops for any reason. Due to how Terraform type casts booleans in json it is required to double quote this value"
70+
type = bool
71+
default = true
5072
}
5173

52-
variable "dns_servers" {
74+
variable "entrypoint" {
75+
description = "(Optional) The entry point that is passed to the container"
5376
type = list(string)
54-
description = "(Optional) Container DNS servers. This is a list of strings specifying the IP addresses of the DNS servers"
5577
default = null
5678
}
5779

58-
variable "docker_labels" {
59-
description = "(Optional) The configuration options to send to the `docker_labels`"
60-
type = map(string)
80+
variable "command" {
81+
description = "(Optional) The command that is passed to the container"
82+
type = list(string)
6183
default = null
6284
}
6385

64-
variable "entrypoint" {
65-
description = "(Optional) The entry point that is passed to the container"
66-
type = list(string)
86+
variable "working_directory" {
87+
description = "(Optional) The working directory to run commands inside the container"
88+
type = string
6789
default = null
6890
}
6991

@@ -76,39 +98,19 @@ variable "environment" {
7698
default = []
7799
}
78100

79-
variable "essential" {
80-
description = "(Optional) Determines whether all other containers in a task are stopped, if this container fails or stops for any reason. Due to how Terraform type casts booleans in json it is required to double quote this value"
81-
type = bool
82-
default = true
83-
}
84-
85-
# https://docs.aws.amazon.com/AmazonECS/latest/APIReference/API_FirelensConfiguration.html
86-
variable "firelens_configuration" {
87-
description = "(Optional) The FireLens configuration for the container. This is used to specify and configure a log router for container logs. For more details, see https://docs.aws.amazon.com/AmazonECS/latest/APIReference/API_FirelensConfiguration.html"
88-
type = object({
89-
type = string
90-
options = map(string)
91-
})
92-
default = null
93-
}
94-
95-
# https://docs.aws.amazon.com/AmazonECS/latest/APIReference/API_HealthCheck.html
96-
variable "healthcheck" {
97-
description = "(Optional) A map containing command (string), timeout, interval (duration in seconds), retries (1-10, number of times to retry before marking container unhealthy), and startPeriod (0-300, optional grace period to wait, in seconds, before failed healthchecks count toward retries)"
98-
type = object({
99-
command = list(string)
100-
retries = number
101-
timeout = number
102-
interval = number
103-
startPeriod = number
104-
})
101+
variable "secrets" {
102+
description = "(Optional) The secrets to pass to the container. This is a list of maps"
103+
type = list(object({
104+
name = string
105+
valueFrom = string
106+
}))
105107
default = null
106108
}
107109

108-
variable "links" {
109-
description = "(Optional) List of container names this container can communicate with without port mappings"
110-
type = list(string)
111-
default = null
110+
variable "readonly_root_filesystem" {
111+
description = "(Optional) Determines whether a container is given read-only access to its root filesystem. Due to how Terraform type casts booleans in json it is required to double quote this value"
112+
type = bool
113+
default = false
112114
}
113115

114116
# https://docs.aws.amazon.com/AmazonECS/latest/APIReference/API_LinuxParameters.html
@@ -152,6 +154,16 @@ variable "log_configuration" {
152154
default = null
153155
}
154156

157+
# https://docs.aws.amazon.com/AmazonECS/latest/APIReference/API_FirelensConfiguration.html
158+
variable "firelens_configuration" {
159+
description = "(Optional) The FireLens configuration for the container. This is used to specify and configure a log router for container logs. For more details, see https://docs.aws.amazon.com/AmazonECS/latest/APIReference/API_FirelensConfiguration.html"
160+
type = object({
161+
type = string
162+
options = map(string)
163+
})
164+
default = null
165+
}
166+
155167
variable "mount_points" {
156168
description = "(Optional) Container mount points. This is a list of maps, where each map should contain a `containerPath` and `sourceVolume`"
157169
type = list(object({
@@ -161,32 +173,20 @@ variable "mount_points" {
161173
default = []
162174
}
163175

164-
variable "port_mappings" {
165-
description = "The port mappings to configure for the container. This is a list of maps. Each map should contain \"containerPort\", \"hostPort\", and \"protocol\", where \"protocol\" is one of \"tcp\" or \"udp\". If using containers in a task with the awsvpc or host network mode, the hostPort can either be left blank or set to the same value as the containerPort"
166-
type = list(object({
167-
containerPort = number
168-
hostPort = number
169-
protocol = string
170-
}))
171-
default = [
172-
{
173-
containerPort = 80
174-
hostPort = 80
175-
protocol = "tcp"
176-
}
177-
]
178-
}
179-
180-
variable "task_role_arn" {
181-
description = "(Optional) The ARN of IAM role that allows your Amazon ECS container task to make calls to other AWS services. If not specified, `aws_iam_role.ecs_task_execution_role.arn` is used"
182-
type = string
176+
variable "dns_servers" {
177+
type = list(string)
178+
description = "(Optional) Container DNS servers. This is a list of strings specifying the IP addresses of the DNS servers"
183179
default = null
184180
}
185181

186-
variable "readonly_root_filesystem" {
187-
description = "(Optional) Determines whether a container is given read-only access to its root filesystem. Due to how Terraform type casts booleans in json it is required to double quote this value"
188-
type = bool
189-
default = false
182+
variable "ulimits" {
183+
description = "(Optional) Container ulimit settings. This is a list of maps, where each map should contain \"name\", \"hardLimit\" and \"softLimit\""
184+
type = list(object({
185+
name = string
186+
hardLimit = number
187+
softLimit = number
188+
}))
189+
default = null
190190
}
191191

192192
variable "repository_credentials" {
@@ -195,66 +195,68 @@ variable "repository_credentials" {
195195
default = null
196196
}
197197

198-
variable "secrets" {
199-
description = "(Optional) The secrets to pass to the container. This is a list of maps"
198+
variable "volumes_from" {
199+
description = "(Optional) A list of VolumesFrom maps which contain \"sourceContainer\" (name of the container that has the volumes to mount) and \"readOnly\" (whether the container can write to the volume)"
200200
type = list(object({
201-
name = string
202-
valueFrom = string
201+
sourceContainer = string
202+
readOnly = bool
203203
}))
204204
default = null
205205
}
206206

207-
variable "start_timeout" {
208-
description = "(Optional) Time duration (in seconds) to wait before giving up on resolving dependencies for a container."
209-
default = 30
210-
}
211-
212-
variable "system_controls" {
213-
description = "(Optional) A list of namespaced kernel parameters to set in the container, mapping to the --sysctl option to docker run. This is a list of maps: { namespace = \"\", value = \"\"}"
214-
type = list(map(string))
207+
variable "links" {
208+
description = "(Optional) List of container names this container can communicate with without port mappings"
209+
type = list(string)
215210
default = null
216211
}
217212

218-
variable "stop_timeout" {
219-
description = "(Optional) Timeout in seconds between sending SIGTERM and SIGKILL to container"
220-
type = number
221-
default = 30
213+
variable "user" {
214+
description = "(Optional) The user to run as inside the container. Can be any of these formats: user, user:group, uid, uid:gid, user:gid, uid:group"
215+
type = string
216+
default = null
222217
}
223218

224-
variable "ulimits" {
225-
description = "(Optional) Container ulimit settings. This is a list of maps, where each map should contain \"name\", \"hardLimit\" and \"softLimit\""
219+
variable "container_depends_on" {
220+
description = "(Optional) The dependencies defined for container startup and shutdown. A container can contain multiple dependencies. When a dependency is defined for container startup, for container shutdown it is reversed"
226221
type = list(object({
227-
name = string
228-
hardLimit = number
229-
softLimit = number
222+
containerName = string
223+
condition = string
230224
}))
231225
default = null
232226
}
233227

234-
variable "user" {
235-
description = "(Optional) The user to run as inside the container. Can be any of these formats: user, user:group, uid, uid:gid, user:gid, uid:group"
236-
type = string
228+
variable "docker_labels" {
229+
description = "(Optional) The configuration options to send to the `docker_labels`"
230+
type = map(string)
237231
default = null
238232
}
239233

240-
variable "volumes_from" {
241-
description = "(Optional) A list of VolumesFrom maps which contain \"sourceContainer\" (name of the container that has the volumes to mount) and \"readOnly\" (whether the container can write to the volume)"
242-
type = list(object({
243-
sourceContainer = string
244-
readOnly = bool
245-
}))
246-
default = null
234+
variable "start_timeout" {
235+
description = "(Optional) Time duration (in seconds) to wait before giving up on resolving dependencies for a container."
236+
default = 30
247237
}
248238

249-
variable "working_directory" {
250-
description = "(Optional) The working directory to run commands inside the container"
251-
type = string
239+
variable "stop_timeout" {
240+
description = "(Optional) Timeout in seconds between sending SIGTERM and SIGKILL to container"
241+
type = number
242+
default = 30
243+
}
244+
245+
variable "system_controls" {
246+
description = "(Optional) A list of namespaced kernel parameters to set in the container, mapping to the --sysctl option to docker run. This is a list of maps: { namespace = \"\", value = \"\"}"
247+
type = list(map(string))
252248
default = null
253249
}
254250

255251
#------------------------------------------------------------------------------
256252
# AWS ECS Task Definition Variables
257253
#------------------------------------------------------------------------------
254+
variable "task_role_arn" {
255+
description = "(Optional) The ARN of IAM role that allows your Amazon ECS container task to make calls to other AWS services. If not specified, `aws_iam_role.ecs_task_execution_role.arn` is used"
256+
type = string
257+
default = null
258+
}
259+
258260
variable "placement_constraints" {
259261
description = "(Optional) A set of placement constraints rules that are taken into consideration during task placement. Maximum number of placement_constraints is 10. This is a list of maps, where each map should contain \"type\" and \"expression\""
260262
type = list

0 commit comments

Comments
 (0)