Skip to content

Commit 0ef2ba7

Browse files
authored
fix(ecs): vitals env to exist even if set to off (#117)
Signed-off-by: Orla Dunlop <[email protected]>
1 parent 85e5c6d commit 0ef2ba7

File tree

5 files changed

+28
-15
lines changed

5 files changed

+28
-15
lines changed

templates/amazon-linux/cloud-init.sh

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -401,12 +401,14 @@ KONG_CLUSTER_TELEMETRY_ENDPOINT="${kong_hybrid_conf.endpoint}:${kong_ports.telem
401401
402402
KONG_PLUGINS="${kong_plugins}"
403403
404-
%{ if vitals_endpoint != "" && kong_vitals_enabled == "on" }
405-
KONG_VITALS="on"
404+
KONG_VITALS="${kong_vitals_enabled}"
405+
%{ if kong_vitals_enabled == "on" }
406+
%{ if vitals_endpoint != "" }
406407
KONG_VITALS_STRATEGY="prometheus"
407408
KONG_VITALS_STATSD_ADDRESS="${vitals_endpoint}"
408409
%{ endif }
409410
KONG_VITALS_TSDB_ADDRESS=${vitals_tsdb_address}
411+
%{ endif }
410412
411413
%{ for key, value in kong_config ~}
412414
${key}="${value}"

templates/ecs/kong_control_plane.tpl

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -175,24 +175,26 @@
175175
"name": "KONG_TRUSTED_IPS",
176176
"value": "0.0.0.0/0"
177177
},
178-
%{ if vitals_endpoint != "" && kong_vitals_enabled == "on" }
179178
{
180179
"name": "KONG_VITALS",
181180
"value": "${kong_vitals_enabled}"
182-
},
183-
{
181+
}
182+
%{ if kong_vitals_enabled == "on" }
183+
%{ if vitals_endpoint != "" }
184+
,{
184185
"name": "KONG_VITALS_STRATEGY",
185186
"value": "prometheus"
186187
},
187188
{
188189
"name": "KONG_VITALS_STATSD_ADDRESS",
189190
"value": "${vitals_endpoint}"
190-
},
191+
}
191192
%{ endif }
192-
{
193+
,{
193194
"name": "KONG_VITALS_TSDB_ADDRESS",
194195
"value": "${vitals_tsdb_address}"
195196
}
197+
%{ endif }
196198
%{ if additional_vars != null }
197199
%{ for name, value in additional_vars ~}
198200
,{

templates/ecs/kong_data_plane.tpl

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -97,24 +97,26 @@
9797
"name": "KONG_ANONYMOUS_REPORTS",
9898
"value": "off"
9999
},
100-
%{ if vitals_endpoint != "" && kong_vitals_enabled == "on" }
101100
{
102101
"name": "KONG_VITALS",
103102
"value": "${kong_vitals_enabled}"
104-
},
105-
{
103+
}
104+
%{ if kong_vitals_enabled == "on" }
105+
%{ if vitals_endpoint != "" }
106+
,{
106107
"name": "KONG_VITALS_STRATEGY",
107108
"value": "prometheus"
108109
},
109110
{
110111
"name": "KONG_VITALS_STATSD_ADDRESS",
111112
"value": "${vitals_endpoint}"
112-
},
113+
}
113114
%{ endif }
114-
{
115+
,{
115116
"name": "KONG_VITALS_TSDB_ADDRESS",
116-
"value": "127.0.0.1:443"
117+
"value": "${vitals_tsdb_address}"
117118
}
119+
%{ endif }
118120
],
119121
"secrets": [
120122
{

templates/ubuntu/cloud-init.sh

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -405,12 +405,14 @@ KONG_CLUSTER_TELEMETRY_ENDPOINT="${kong_hybrid_conf.endpoint}:${kong_ports.telem
405405
406406
KONG_PLUGINS="${kong_plugins}"
407407
408-
%{ if vitals_endpoint != "" && kong_vitals_enabled == "on" }
409-
KONG_VITALS="on"
408+
KONG_VITALS="${kong_vitals_enabled}"
409+
%{ if kong_vitals_enabled == "on" }
410+
%{ if vitals_endpoint != "" }
410411
KONG_VITALS_STRATEGY="prometheus"
411412
KONG_VITALS_STATSD_ADDRESS="${vitals_endpoint}"
412413
%{ endif }
413414
KONG_VITALS_TSDB_ADDRESS=${vitals_tsdb_address}
415+
%{ endif }
414416
415417
%{ for key, value in kong_config ~}
416418
${key}="${value}"

variables.tf

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -837,6 +837,11 @@ variable "kong_vitals_enabled" {
837837
description = "(Optional) Define whether or not Kong Vitals should be enabled."
838838
type = string
839839
default = "on"
840+
841+
validation {
842+
condition = contains(["on", "off"], var.kong_vitals_enabled)
843+
error_message = "Must be one of the following values: 'on' or 'off'."
844+
}
840845
}
841846

842847
variable "kong_portal_enabled" {

0 commit comments

Comments
 (0)