website/docs/segments/cli/terraform.mdx
Display the currently active Terraform Workspace name.
import Config from "@site/src/components/Config.js";
<Config data={{ type: "terraform", style: "powerline", powerline_symbol: "\uE0B0", foreground: "#000000", background: "#ebcc34", template: " \ue69a {{.WorkspaceName}}", }} />
| Name | Type | Default | Description |
|---|---|---|---|
fetch_version | boolean | false | fetch the version information, see Version detection for the sources and their priority |
command | string | terraform | the command(s) to run, allows support for tofu |
When fetch_version is enabled, the version is resolved from the first source
that yields a value, in this order:
TFENV_TERRAFORM_VERSION (or
TOFUENV_TOFU_VERSION when command is tofu).terraform-version (or .opentofu-version
when command is tofu)required_version declared in versions.tf or main.tfterraform_version stored in terraform.tfstateThe tenv sources let the segment show the pinned version even when you don't use
main.tf / versions.tf. The environment variable and version file are only
used to read the version; a project file (a .terraform folder or one of the
files above) is still required for the segment to activate.
:::note default template
{{ .WorkspaceName }}{{ if .Version }} {{ .Version }}{{ end }}
:::
| Name | Type | Description |
|---|---|---|
.WorkspaceName | string | is the current workspace name |
.Version | string | terraform version (set fetch_version to true) |