diff --git a/examples/basic/main.tf b/examples/basic/main.tf index 16cb92d..49b10de 100644 --- a/examples/basic/main.tf +++ b/examples/basic/main.tf @@ -112,6 +112,14 @@ module "fargate" { TEST_VARIABLE = "TEST_VALUE" } + task_container_health_check = { + retries = 3, + command = ["CMD-SHELL", "curl -f http://localhost:9000/ || exit 1"], + timeout = 5, + interval = 30, + startPeriod = 15 + } + health_check = { port = "traffic-port" path = "/" diff --git a/main.tf b/main.tf index f687fe1..0a7cd36 100644 --- a/main.tf +++ b/main.tf @@ -136,6 +136,7 @@ locals { log_multiline_pattern = var.log_multiline_pattern != "" ? { "awslogs-multiline-pattern" = var.log_multiline_pattern } : null task_container_secrets = length(var.task_container_secrets) > 0 ? { "secrets" = var.task_container_secrets } : null repository_credentials = length(var.repository_credentials) > 0 ? { "repositoryCredentials" = { "credentialsParameter" = var.repository_credentials } } : null + task_container_health_check = length(var.task_container_health_check) > 0 ? { "healthCheck" = var.task_container_health_check } : null task_container_port_mappings = var.task_container_port == 0 ? var.task_container_port_mappings : concat(var.task_container_port_mappings, [{ containerPort = var.task_container_port, hostPort = var.task_container_port, protocol = "tcp" }]) task_container_environment = [for k, v in var.task_container_environment : { name = k, value = v }] task_container_mount_points = concat([for v in var.efs_volumes : { containerPath = v.mount_point, readOnly = v.readOnly, sourceVolume = v.name }], var.mount_points) diff --git a/variables.tf b/variables.tf index 705c701..0a3ccd5 100644 --- a/variables.tf +++ b/variables.tf @@ -24,6 +24,11 @@ variable "task_container_secrets_kms_key" { default = "alias/aws/secretsmanager" } +variable "task_container_health_check" { + description = "https://docs.aws.amazon.com/AmazonECS/latest/APIReference/API_HealthCheck.html" + default = "" +} + variable "vpc_id" { description = "The VPC ID." type = string