env Provider

ℹ️

Introduced in Togomak v1.0.0

The data.env provider fetches variables from the host runtime environment.

Example

togomak {
  version = 2
}
 
data "env" "home" {
  key = "HOME"
  default = "nowhere"
}
 
stage "hello" {
  script = "echo my home is ${data.env.home.value}"
}

Usage

The data.env block accepts the following arguments:

  • default - Optional, specifies the fallback value if the key specified in key does not exist. In the case where the key does not exist in the host environment, and if the default argument is not defined, the data.env provider will return an error.

  • key - Required,

Arguments Reference

  • key: The environment variable key which needs to be fetched from os.environ
  • default: Fallback definition, which will be returned if os.environ[key] is undefined.

Attributes Reference

  • [value]: The value from the environment variable defined in key