You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Real-world use-case: When integrating PagerDuty and Datadog, need to read PagerDuty API key from PAGERDUTY_TOKEN, then pass it to a variable, so that the Datadog provider can read it without printing in text (which is insecure).
If a Terraform variable is called var.pagerduty_token, then this would read PAGERDUTY_TOKEN and then write that same value to TF_VARS_pagerduty_token so that Terraform will read it as the variable value.
variable"pagerduty_token" {
description="PagerDuty API token. Value is set via .env file."type=string
}
data"corefunc_env_copy_to_var""pagerduty_token" {
name="PAGERDUTY_TOKEN"variable="pagerduty_token"
}
Yes, you could do export TF_VARS_pagerduty_token=$PAGERDUTY_TOKEN, but:
You'd be surprised how few people know about this.
This (and corefunc_env_ensure) help make it an explicit and unmissable part of running the Terraform.
The text was updated successfully, but these errors were encountered:
Go:
corefunc.EnvCopyToVar(envName, tfVarName)
TF:
corefunc_env_copy_to_var
Real-world use-case: When integrating PagerDuty and Datadog, need to read PagerDuty API key from
PAGERDUTY_TOKEN
, then pass it to a variable, so that the Datadog provider can read it without printing in text (which is insecure).If a Terraform variable is called
var.pagerduty_token
, then this would readPAGERDUTY_TOKEN
and then write that same value toTF_VARS_pagerduty_token
so that Terraform will read it as the variable value.Yes, you could do
export TF_VARS_pagerduty_token=$PAGERDUTY_TOKEN
, but:corefunc_env_ensure
) help make it an explicit and unmissable part of running the Terraform.The text was updated successfully, but these errors were encountered: