Skip to content

Adding a new variable page, getting rid of the old one, and fixing links! #489

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jun 13, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion content/terraform/v1.12.x/data/language-nav-data.json
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@
"title": "Variables and Outputs",
"routes": [
{ "title": "Overview", "path": "values" },
{ "title": "Input Variables", "path": "values/variables" },
{ "title": "Variable block", "href": "/terraform/language/block/variable" },
{ "title": "Output block", "href": "/terraform/language/block/output" },
{ "title": "Local Values", "path": "values/locals" }
]
Expand Down Expand Up @@ -1142,6 +1142,10 @@
{
"title": "Terraform block",
"path": "block/terraform"
},
{
"title": "Variable block",
"path": "block/variable"
}
]
},
Expand Down
6 changes: 3 additions & 3 deletions content/terraform/v1.12.x/docs/cli/commands/import.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,11 @@ The command-line flags are all optional. The following flags are available:
can be set multiple times. Variable values are interpreted as
[literal expressions](/terraform/language/expressions/types) in the
Terraform language, so list and map values can be specified via this flag.

<!-- TODO: add link to new variable usage page once done -->
- `-var-file=foo` - Set variables in the Terraform configuration from
a [variable file](/terraform/language/values/variables#variable-definitions-tfvars-files). If
a [variable file](/terraform/language/block/variable#variable-definitions-tfvars-files). If
`terraform.tfvars` or any `.auto.tfvars` files are present in the current
directory, they are automatically loaded. Terraform loads `terraform.tfvars`
directory, they are automatically loaded. Terraform loads `terraform.tfvars`
first and the `.auto.tfvars` files after in alphabetical order. Any files
specified by `-var-file` override any values set automatically from files in
the working directory. This flag can be used multiple times. This is only
Expand Down
21 changes: 11 additions & 10 deletions content/terraform/v1.12.x/docs/cli/commands/plan.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ description: >-
changes that Terraform will make to your infrastructure.
---

# `terraform plan` command
# `terraform plan` command

The `terraform plan` command creates an execution plan, which lets you preview
the changes that Terraform plans to make to your infrastructure.
the changes that Terraform plans to make to your infrastructure.

## Introduction
By default, Terraform performs the following operations when it creates a plan:
Expand Down Expand Up @@ -138,25 +138,25 @@ In addition to alternate [planning modes](#planning-modes), there are several op
-> **Note:** Use `-target=ADDRESS` in exceptional circumstances only, such as recovering from mistakes or working around Terraform limitations. Refer to [Resource Targeting](#resource-targeting) for more details.

- `-var 'NAME=VALUE'` - Sets a value for a single
[input variable](/terraform/language/values/variables) declared in the
[input variable](/terraform/language/block/variable) declared in the
root module of the configuration. Use this option multiple times to set
more than one variable. Refer to
[Input Variables on the Command Line](#input-variables-on-the-command-line) for more information.

<!-- TODO: add link to new variable usage page once done -->
- `-var-file=FILENAME` - Sets values for potentially many
[input variables](/terraform/language/values/variables) declared in the
[input variables](/terraform/language/block/variable) declared in the
root module of the configuration, using definitions from a
["tfvars" file](/terraform/language/values/variables#variable-definitions-tfvars-files).
["tfvars" file](/terraform/language/block/variable#variable-definitions-tfvars-files).
Use this option multiple times to include values from more than one file.

<!-- TODO: add link to new variable usage page once done -->
There are several other ways to set values for input variables in the root
module, aside from the `-var` and `-var-file` options. Refer to
[Assigning Values to Root Module Variables](/terraform/language/values/variables#assigning-values-to-root-module-variables) for more information.
[Assigning Values to Root Module Variables](/terraform/language/block/variable#assigning-values-to-root-module-variables) for more information.

### Input Variables on the Command Line

You can use the `-var` command line option to specify values for
[input variables](/terraform/language/values/variables) declared in your
[input variables](/terraform/language/block/variable) declared in your
root module.

However, to do so will require writing a command line that is parsable both
Expand Down Expand Up @@ -222,10 +222,11 @@ terraform plan -var 'name=["a", "b", "c"]'
terraform plan -var "name=[\"a\", \"b\", \"c\"]"
```

<!-- TODO: add link to new variable usage page once done -->
Similar constraints apply when setting input variables using environment
variables. For more information on the various methods for setting root module
input variables, see
[Assigning Values to Root Module Variables](/terraform/language/values/variables#assigning-values-to-root-module-variables).
[Assigning Values to Root Module Variables](/terraform/language/block/variable#assigning-values-to-root-module-variables).

### Resource Targeting

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
page_title: Terraform CLI environment variables reference
description: >-
Terraform environment variables let you customize the Terraform CLI's default behavior.
Terraform environment variables let you customize the Terraform CLI's default behavior.
Learn about the Terraform CLI environment variables.
---

Expand Down Expand Up @@ -61,7 +61,8 @@ export TF_VAR_alist='[1,2,3]'
export TF_VAR_amap='{ foo = "bar", baz = "qux" }'
```

For more on how to use `TF_VAR_name` in context, check out the section on [Variable Configuration](/terraform/language/values/variables).
<!-- TODO: add link to new variable usage page once done -->
For more on how to use `TF_VAR_name` in context, check out the section on [Variable Configuration](/terraform/language/block/variable).

## TF_CLI_ARGS and TF_CLI_ARGS_name

Expand Down
2 changes: 1 addition & 1 deletion content/terraform/v1.12.x/docs/cli/workspaces/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ Use the [`terraform workspace list`](/terraform/cli/commands/workspace/list), [`

Use [the `terraform workspace select` command](/terraform/cli/commands/workspace/select) to change the currently selected workspace. For a given working directory, you can only select one workspace at a time. Most Terraform commands only interact with the currently selected workspace. This includes [provisioning](/terraform/cli/run) and [state manipulation](/terraform/cli/state).

When you provision infrastructure in each workspace, you usually need to manually specify different [input variables](/terraform/language/values/variables) to differentiate each collection. For example, you might deploy test infrastructure to a different region.
When you provision infrastructure in each workspace, you usually need to manually specify different [input variables](/terraform/language/block/variable) to differentiate each collection. For example, you might deploy test infrastructure to a different region.


## Use Cases
Expand Down
2 changes: 1 addition & 1 deletion content/terraform/v1.12.x/docs/language/block/output.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ Passing output values between child modules and the root module is useful for ma
The following ephemeral contexts can set values for output blocks with the `ephemeral` argument, and they can also reference output blocks with the `ephemeral` argument:
- Another child module's ephemeral `output` block
- A [write-only argument](/terraform/language/resources/ephemeral/write-only)
- [Variables with the `ephemeral` argument](/terraform/language/values/variables#exclude-values-from-state)
- [Variables with the `ephemeral` argument](/terraform/language/block/variable#ephemeral)
- [An `ephemeral` resource block](/terraform/language/resources/ephemeral)
- Configuring providers in the [`provider` block](/terraform/language/providers)
- In [provisioner](/terraform/language/resources/provisioners/syntax) and [connection](/terraform/language/resources/provisioners/connection) blocks
Expand Down
Loading
Loading