Skip to content

Commit b952023

Browse files
committed
BAU: add missing fields to the review app task definition
These fields are automatically added by AWS when creating a task definition. If we don't include them in our task definition, Terraform tries to remove them on every apply, which causes unnecessary changes to the task definition (and thus noise in our Terraform plan output).
1 parent ad51097 commit b952023

File tree

1 file changed

+50
-4
lines changed

1 file changed

+50
-4
lines changed

.review_apps/ecs_task_definition.tf

Lines changed: 50 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -93,11 +93,16 @@ resource "aws_ecs_task_definition" "task" {
9393
portMappings = [
9494
{
9595
containerPort = 3001
96+
hostPort = 3001
9697
protocol = "tcp"
9798
appProtocol = "http"
9899
}
99100
]
100101

102+
mountPoints = []
103+
systemControls = []
104+
volumesFrom = []
105+
101106
logConfiguration = {
102107
logDriver = "awslogs"
103108
options = {
@@ -112,6 +117,7 @@ resource "aws_ecs_task_definition" "task" {
112117
interval = 30
113118
retries = 5
114119
startPeriod = 180
120+
timeout = 5
115121
}
116122

117123
dependsOn = [
@@ -155,11 +161,16 @@ resource "aws_ecs_task_definition" "task" {
155161
portMappings = [
156162
{
157163
containerPort = 3000
164+
hostPort = 3000
158165
protocol = "tcp"
159166
appProtocol = "http"
160167
}
161168
]
162169

170+
mountPoints = []
171+
systemControls = []
172+
volumesFrom = []
173+
163174
logConfiguration = {
164175
logDriver = "awslogs"
165176
options = {
@@ -174,6 +185,7 @@ resource "aws_ecs_task_definition" "task" {
174185
interval = 30
175186
retries = 5
176187
startPeriod = 180
188+
timeout = 5
177189
}
178190

179191
dependsOn = [
@@ -195,7 +207,17 @@ resource "aws_ecs_task_definition" "task" {
195207
command = []
196208
essential = true
197209

198-
portMappings = [{ containerPort = 5432 }]
210+
portMappings = [
211+
{
212+
containerPort = 5432
213+
hostPort = 5432
214+
protocol = "tcp"
215+
}
216+
]
217+
218+
mountPoints = []
219+
systemControls = []
220+
volumesFrom = []
199221

200222
environment = [
201223
{ name = "POSTGRES_PASSWORD", value = "postgres" }
@@ -211,7 +233,10 @@ resource "aws_ecs_task_definition" "task" {
211233
}
212234

213235
healthCheck = {
214-
command = ["CMD-SHELL", "psql -h localhost -p 5432 -U postgres -c \"SELECT current_timestamp - pg_postmaster_start_time();\""]
236+
command = ["CMD-SHELL", "psql -h localhost -p 5432 -U postgres -c \"SELECT current_timestamp - pg_postmaster_start_time();\""]
237+
interval = 30
238+
retries = 3
239+
timeout = 5
215240
}
216241
},
217242

@@ -226,7 +251,17 @@ resource "aws_ecs_task_definition" "task" {
226251
],
227252
essential = true
228253

229-
portMappings = [{ containerPort = 6379 }]
254+
portMappings = [
255+
{
256+
containerPort = 6379
257+
hostPort = 6379
258+
protocol = "tcp"
259+
}
260+
]
261+
262+
mountPoints = []
263+
systemControls = []
264+
volumesFrom = []
230265

231266
logConfiguration = {
232267
logDriver = "awslogs"
@@ -238,7 +273,10 @@ resource "aws_ecs_task_definition" "task" {
238273
}
239274

240275
healthCheck = {
241-
command = ["CMD-SHELL", "redis-cli", "ping"]
276+
command = ["CMD-SHELL", "redis-cli", "ping"]
277+
interval = 30
278+
retries = 3
279+
timeout = 5
242280
}
243281
},
244282

@@ -251,6 +289,10 @@ resource "aws_ecs_task_definition" "task" {
251289
environment = local.forms_runner_env_vars
252290
readonlyRootFilesystem = true
253291

292+
mountPoints = []
293+
systemControls = []
294+
volumesFrom = []
295+
254296
logConfiguration = {
255297
logDriver = "awslogs"
256298
options = {
@@ -277,6 +319,10 @@ resource "aws_ecs_task_definition" "task" {
277319
environment = local.forms_admin_env_vars
278320
readonlyRootFilesystem = true
279321

322+
mountPoints = []
323+
systemControls = []
324+
volumesFrom = []
325+
280326
logConfiguration = {
281327
logDriver = "awslogs"
282328
options = {

0 commit comments

Comments
 (0)