For AI agents: the complete documentation index is available at /hclapi/llms.txt, the full documentation bundle is available at /hclapi/llms-full.txt, and this page is available as Markdown at /hclapi/docs/manifest/functions/system/env.md.

env

Reads the value of an environment variable from the host operating system.

Signature

env(name: string) -> string

Parameters

ParameterTypeRequiredDescription
namestringyesEnvironment variable name

Return value

Returns the documented result for the function signature.

Example

connection "postgres" "main" {
  url = env("DATABASE_URL")
}

An unset variable returns an empty string "".