page_title | subcategory | description |
---|---|---|
os_get_env function - helpers |
OS Functions |
Get an environment variable |
Get an environment variable
The function os_get_env
retrieves the value of an environment variable and provides a fallback value if the
environment variable is not set.
output "tf_log" {
value = {
test_value_as_is = provider::helpers::os_get_env("TF_LOG")
test_value_with_fallback = provider::helpers::os_get_env("TF_ENV", "test")
}
}
os_get_env(name string, fallback string...) string
name
(String) The name of the environment variable to get
fallback
(Variadic, String) The fallback value to use if the environment variable is not set
The return type of os_get_env
is a string representing the value of the environment variable or the fallback value.
You can use terraform type conversion functions to convert the string to other types if needed.