Skip to content
This repository was archived by the owner on Feb 11, 2020. It is now read-only.

Commit 547ddfb

Browse files
alexwlchankenoir
authored andcommitted
Set a default healthcheck path based on path pattern (#18)
1 parent 90ec1e5 commit 547ddfb

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

services/main.tf

+7-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
locals {
2+
default_healthcheck_path = "/management/healthcheck"
3+
fallback_healthcheck_path = "${replace(var.path_pattern, "/*", local.default_healthcheck_path)}"
4+
healthcheck_path = "${var.healthcheck_path == "" ? local.fallback_healthcheck_path : var.healthcheck_path}"
5+
}
6+
17
module "service" {
28
source = "./ecs_service"
39
service_name = "${var.name}"
@@ -11,7 +17,7 @@ module "service" {
1117
path_pattern = "${var.path_pattern}"
1218
alb_priority = "${var.alb_priority}"
1319
desired_count = "${var.desired_count}"
14-
healthcheck_path = "${var.healthcheck_path}"
20+
healthcheck_path = "${local.healthcheck_path}"
1521
infra_bucket = "${var.infra_bucket}"
1622
host_name = "${var.host_name}"
1723

services/variables.tf

+2-2
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,8 @@ variable "path_pattern" {
8282
}
8383

8484
variable "healthcheck_path" {
85-
description = "path for ECS healthcheck endpoint"
86-
default = "/management/healthcheck"
85+
description = "Path for ECS healthcheck endpoint. Defaults to /management/healthcheck."
86+
default = ""
8787
}
8888

8989
variable "infra_bucket" {

0 commit comments

Comments
 (0)