Skip to content

Commit

Permalink
fix(ecs): vitals env to exist even if set to off (#117)
Browse files Browse the repository at this point in the history
Signed-off-by: Orla Dunlop <[email protected]>
  • Loading branch information
odunlop authored Oct 29, 2024
1 parent 85e5c6d commit 0ef2ba7
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 15 deletions.
6 changes: 4 additions & 2 deletions templates/amazon-linux/cloud-init.sh
Original file line number Diff line number Diff line change
Expand Up @@ -401,12 +401,14 @@ KONG_CLUSTER_TELEMETRY_ENDPOINT="${kong_hybrid_conf.endpoint}:${kong_ports.telem
KONG_PLUGINS="${kong_plugins}"
%{ if vitals_endpoint != "" && kong_vitals_enabled == "on" }
KONG_VITALS="on"
KONG_VITALS="${kong_vitals_enabled}"
%{ if kong_vitals_enabled == "on" }
%{ if vitals_endpoint != "" }
KONG_VITALS_STRATEGY="prometheus"
KONG_VITALS_STATSD_ADDRESS="${vitals_endpoint}"
%{ endif }
KONG_VITALS_TSDB_ADDRESS=${vitals_tsdb_address}
%{ endif }
%{ for key, value in kong_config ~}
${key}="${value}"
Expand Down
12 changes: 7 additions & 5 deletions templates/ecs/kong_control_plane.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -175,24 +175,26 @@
"name": "KONG_TRUSTED_IPS",
"value": "0.0.0.0/0"
},
%{ if vitals_endpoint != "" && kong_vitals_enabled == "on" }
{
"name": "KONG_VITALS",
"value": "${kong_vitals_enabled}"
},
{
}
%{ if kong_vitals_enabled == "on" }
%{ if vitals_endpoint != "" }
,{
"name": "KONG_VITALS_STRATEGY",
"value": "prometheus"
},
{
"name": "KONG_VITALS_STATSD_ADDRESS",
"value": "${vitals_endpoint}"
},
}
%{ endif }
{
,{
"name": "KONG_VITALS_TSDB_ADDRESS",
"value": "${vitals_tsdb_address}"
}
%{ endif }
%{ if additional_vars != null }
%{ for name, value in additional_vars ~}
,{
Expand Down
14 changes: 8 additions & 6 deletions templates/ecs/kong_data_plane.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -97,24 +97,26 @@
"name": "KONG_ANONYMOUS_REPORTS",
"value": "off"
},
%{ if vitals_endpoint != "" && kong_vitals_enabled == "on" }
{
"name": "KONG_VITALS",
"value": "${kong_vitals_enabled}"
},
{
}
%{ if kong_vitals_enabled == "on" }
%{ if vitals_endpoint != "" }
,{
"name": "KONG_VITALS_STRATEGY",
"value": "prometheus"
},
{
"name": "KONG_VITALS_STATSD_ADDRESS",
"value": "${vitals_endpoint}"
},
}
%{ endif }
{
,{
"name": "KONG_VITALS_TSDB_ADDRESS",
"value": "127.0.0.1:443"
"value": "${vitals_tsdb_address}"
}
%{ endif }
],
"secrets": [
{
Expand Down
6 changes: 4 additions & 2 deletions templates/ubuntu/cloud-init.sh
Original file line number Diff line number Diff line change
Expand Up @@ -405,12 +405,14 @@ KONG_CLUSTER_TELEMETRY_ENDPOINT="${kong_hybrid_conf.endpoint}:${kong_ports.telem
KONG_PLUGINS="${kong_plugins}"
%{ if vitals_endpoint != "" && kong_vitals_enabled == "on" }
KONG_VITALS="on"
KONG_VITALS="${kong_vitals_enabled}"
%{ if kong_vitals_enabled == "on" }
%{ if vitals_endpoint != "" }
KONG_VITALS_STRATEGY="prometheus"
KONG_VITALS_STATSD_ADDRESS="${vitals_endpoint}"
%{ endif }
KONG_VITALS_TSDB_ADDRESS=${vitals_tsdb_address}
%{ endif }
%{ for key, value in kong_config ~}
${key}="${value}"
Expand Down
5 changes: 5 additions & 0 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -837,6 +837,11 @@ variable "kong_vitals_enabled" {
description = "(Optional) Define whether or not Kong Vitals should be enabled."
type = string
default = "on"

validation {
condition = contains(["on", "off"], var.kong_vitals_enabled)
error_message = "Must be one of the following values: 'on' or 'off'."
}
}

variable "kong_portal_enabled" {
Expand Down

0 comments on commit 0ef2ba7

Please sign in to comment.