Skip to content

Latest commit

 

History

History
43 lines (32 loc) · 1.15 KB

os_get_env.md

File metadata and controls

43 lines (32 loc) · 1.15 KB
page_title subcategory description
os_get_env function - helpers
OS Functions
Get an environment variable

Function: os_get_env

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.

Example Usage

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")
  }
}

Signature

os_get_env(name string, fallback string...) string

Arguments

  1. name (String) The name of the environment variable to get
  1. fallback (Variadic, String) The fallback value to use if the environment variable is not set

Return Type

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.