Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(ecs): vitals env to exist even if set to off #117

Merged
merged 1 commit into from
Oct 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading