File tree Expand file tree Collapse file tree 3 files changed +13
-0
lines changed Expand file tree Collapse file tree 3 files changed +13
-0
lines changed Original file line number Diff line number Diff line change @@ -7,6 +7,13 @@ module "ecs_task_definition" {
7
7
command = " "
8
8
port = 80
9
9
cloudwatch_log_retention_in_days = var. env == " prod" ? 90 : 30
10
+ health_check = {
11
+ command = [" CMD-SHELL" , " curl -f http://localhost:${ var . container_port } ${ var . task_health_check_path } || exit 1" ]
12
+ interval = 30
13
+ timeout = 5
14
+ retries = 2
15
+ startPeriod = 0 # should be passed from variable
16
+ }
10
17
requires_compatibilities = [" FARGATE" ]
11
18
network_mode = " awsvpc"
12
19
environment_variables = {
Original file line number Diff line number Diff line change @@ -28,6 +28,7 @@ resource "aws_ecs_task_definition" "task" {
28
28
},
29
29
name = var.name
30
30
image = var.image
31
+ healthcheck = var.health_check
31
32
portMappings = var.port > 0 ? [
32
33
{
33
34
hostPort = var.port
Original file line number Diff line number Diff line change @@ -65,3 +65,8 @@ variable "task_memory" {
65
65
description = " ECS fargate task memory"
66
66
type = number
67
67
}
68
+
69
+ variable "health_check" {
70
+ description = " task definition health check"
71
+ default = null
72
+ }
You can’t perform that action at this time.
0 commit comments