Environment variables post v1.38

Hello,

We are upgrading from v1.36 to v1.40. This includes the “Strict handling of environment variables”

I’m facing trouble using bool and lists environment variables in the configuration-file after this change.

In the “inputs.x509_cert”-input there is an option for exclude_root_certs that is a bool, but I’m not able to make it work.

# cat -n /etc/telegraf/telegraf.conf | grep CERT_MONITOR_INPUTS_X509_CERT_EXCLUDE_ROOT_CERTS -C5
    69
    70  #
    71  # Monitor for the proxy
    72  [[inputs.x509_cert]]
    73    sources = ["${CERT_MONITOR_INPUTS_X509_CERT_SOURCES}"]
    74    exclude_root_certs = ${CERT_MONITOR_INPUTS_X509_CERT_EXCLUDE_ROOT_CERTS}
    75    timeout = "2s"
    76    server_name = "${CERT_MONITOR_INPUTS_X509_CERT_SERVER_NAME}"
E! loading config file /etc/telegraf/telegraf.conf failed: error parsing data: line 74: invalid TOML syntax
# env | grep CERT_MONITOR_INPUTS_X509_CERT_EXCLUDE_ROOT_CERTS
CERT_MONITOR_INPUTS_X509_CERT_EXCLUDE_ROOT_CERTS=false

I also had trouble with the list on line 73, but I just made it a string in the variable.

Telegraf Environment Variable Handling | InfluxData This only covers the “Why?” and strings.

Is there any examples of how to get non strings to work with this change?

The same goes for int.

E! loading config file /etc/telegraf/telegraf.conf failed: error parsing data: line 77: invalid TOML syntax

# cat -n /etc/telegraf/telegraf.conf
77    metric_version = ${PROMETHEUS_MONITOR_METRIC_VERSION}

# env | grep PROMETHEUS_MONITOR_METRIC_VERSION
PROMETHEUS_MONITOR_METRIC_VERSION=1