Skip to content

Commit 926e31a

Browse files
committed
Add info about -var and -var-file flags
1 parent bd0c2c6 commit 926e31a

File tree

14 files changed

+221
-8
lines changed

14 files changed

+221
-8
lines changed

content/terraform/v1.15.x (beta)/docs/cli/commands/get.mdx

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,24 @@ The modules are downloaded into a `.terraform` subdirectory of the current
2020
working directory. Don't commit this directory to your version control
2121
repository.
2222

23-
The `get` command supports the following option:
23+
The `get` command supports the following options:
2424

2525
* `-update` - If specified, modules that are already downloaded will be
2626
checked for updates and the updates will be downloaded if present.
2727

28+
* `-var 'NAME=VALUE'` - Sets a value for a single
29+
[input variable](/terraform/language/block/variable) declared in the
30+
root module of the configuration. Use this option multiple times to set
31+
more than one variable. Refer to
32+
[Input Variables on the Command Line](/terraform/cli/commands/plan#input-variables-on-the-command-line) for more information.
33+
34+
* `-var-file=FILENAME` - Sets values for potentially many
35+
[input variables](/terraform/language/block/variable) declared in the
36+
root module of the configuration, using definitions from a
37+
[`.tfvars` file](/terraform/language/values/variables#variable-definition-files).
38+
Use this option multiple times to include values from more than one file.
39+
There are several other ways to set values for input variables in the root
40+
module, aside from the `-var` and `-var-file` options. Refer to
41+
[Assign values to input variables](/terraform/language/values/variables#assign-values-to-input-variables) for more information.
42+
2843
* `-no-color` - Disable text coloring in the output.

content/terraform/v1.15.x (beta)/docs/cli/commands/graph.mdx

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,21 @@ Options:
3737
of the default resources-only simplified graph.
3838
Can be: `plan`, `plan-refresh-only`, `plan-destroy`, or `apply`.
3939

40+
* `-var 'NAME=VALUE'` - Sets a value for a single
41+
[input variable](/terraform/language/block/variable) declared in the
42+
root module of the configuration. Use this option multiple times to set
43+
more than one variable. Refer to
44+
[Input Variables on the Command Line](/terraform/cli/commands/plan#input-variables-on-the-command-line) for more information.
45+
46+
* `-var-file=FILENAME` - Sets values for potentially many
47+
[input variables](/terraform/language/block/variable) declared in the
48+
root module of the configuration, using definitions from a
49+
[`.tfvars` file](/terraform/language/values/variables#variable-definition-files).
50+
Use this option multiple times to include values from more than one file.
51+
There are several other ways to set values for input variables in the root
52+
module, aside from the `-var` and `-var-file` options. Refer to
53+
[Assign values to input variables](/terraform/language/values/variables#assign-values-to-input-variables) for more information.
54+
4055
## Generating Images
4156

4257
The graph output uses

content/terraform/v1.15.x (beta)/docs/cli/commands/modules.mdx

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,19 @@ Usage: `terraform modules [options]`
2626
The following optional flags are available:
2727

2828
- `-json` - Displays the module declarations in a machine-readable, JSON format.
29+
- `-var 'NAME=VALUE'` - Sets a value for a single
30+
[input variable](/terraform/language/block/variable) declared in the
31+
root module of the configuration. Use this option multiple times to set
32+
more than one variable. Refer to
33+
[Input Variables on the Command Line](/terraform/cli/commands/plan#input-variables-on-the-command-line) for more information.
34+
- `-var-file=FILENAME` - Sets values for potentially many
35+
[input variables](/terraform/language/block/variable) declared in the
36+
root module of the configuration, using definitions from a
37+
[`.tfvars` file](/terraform/language/values/variables#variable-definition-files).
38+
Use this option multiple times to include values from more than one file.
39+
There are several other ways to set values for input variables in the root
40+
module, aside from the `-var` and `-var-file` options. Refer to
41+
[Assign values to input variables](/terraform/language/values/variables#assign-values-to-input-variables) for more information.
2942

3043
The output of `terraform modules -json` includes a `format_version` key, which is set to the value of `"1.0"` in Terraform 1.10.0. The semantics of this version are:
3144

content/terraform/v1.15.x (beta)/docs/cli/commands/providers.mdx

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,20 @@ This command also has several subcommands with different purposes.
2020

2121
## Usage
2222

23-
Usage: `terraform providers`
23+
Usage: `terraform providers [options]`
24+
25+
The `terraform providers` command also accepts the following options:
26+
27+
- `-var 'NAME=VALUE'` - Sets a value for a single
28+
[input variable](/terraform/language/block/variable) declared in the
29+
root module of the configuration. Use this option multiple times to set
30+
more than one variable. Refer to
31+
[Input Variables on the Command Line](/terraform/cli/commands/plan#input-variables-on-the-command-line) for more information.
32+
- `-var-file=FILENAME` - Sets values for potentially many
33+
[input variables](/terraform/language/block/variable) declared in the
34+
root module of the configuration, using definitions from a
35+
[`.tfvars` file](/terraform/language/values/variables#variable-definition-files).
36+
Use this option multiple times to include values from more than one file.
37+
There are several other ways to set values for input variables in the root
38+
module, aside from the `-var` and `-var-file` options. Refer to
39+
[Assign values to input variables](/terraform/language/values/variables#assign-values-to-input-variables) for more information.

content/terraform/v1.15.x (beta)/docs/cli/commands/providers/lock.mdx

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ If you list one or more provider source addresses on the command line then
6868
`terraform providers lock` will restrict its work only to those providers,
6969
leaving the lock entries for other providers (if any) unchanged.
7070

71-
You can customize the default behavior using the following additional option:
71+
You can customize the default behavior using the following additional options:
7272

7373
* `-fs-mirror=PATH` - Direct Terraform to look for provider packages in the
7474
given local filesystem mirror directory, instead of in upstream registries.
@@ -99,6 +99,21 @@ You can customize the default behavior using the following additional option:
9999
`terraform provider lock` command is used to ensure no untrusted provider
100100
versions can be used installing the plugins from the cache is considered risky.
101101

102+
* `-var 'NAME=VALUE'` - Sets a value for a single
103+
[input variable](/terraform/language/block/variable) declared in the
104+
root module of the configuration. Use this option multiple times to set
105+
more than one variable. Refer to
106+
[Input Variables on the Command Line](/terraform/cli/commands/plan#input-variables-on-the-command-line) for more information.
107+
108+
* `-var-file=FILENAME` - Sets values for potentially many
109+
[input variables](/terraform/language/block/variable) declared in the
110+
root module of the configuration, using definitions from a
111+
[`.tfvars` file](/terraform/language/values/variables#variable-definition-files).
112+
Use this option multiple times to include values from more than one file.
113+
There are several other ways to set values for input variables in the root
114+
module, aside from the `-var` and `-var-file` options. Refer to
115+
[Assign values to input variables](/terraform/language/values/variables#assign-values-to-input-variables) for more information.
116+
102117

103118
## Specifying Target Platforms
104119

content/terraform/v1.15.x (beta)/docs/cli/commands/providers/mirror.mdx

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ if you upload the resulting directory to a static website host. Terraform
4848
ignores those index files when using the directory as a filesystem mirror,
4949
because the directory entries themselves are authoritative in that case.
5050

51-
This command supports the following additional option:
51+
This command supports the following additional options:
5252

5353
* `-platform=OS_ARCH` - Choose which target platform to build a mirror for.
5454
By default Terraform will obtain plugin packages suitable for the platform
@@ -63,6 +63,21 @@ This command supports the following additional option:
6363
providers. By default (`true`) the mirror command will use the version info in the
6464
lock file if the configuration directory has been previously initialized.
6565

66+
* `-var 'NAME=VALUE'` - Sets a value for a single
67+
[input variable](/terraform/language/block/variable) declared in the
68+
root module of the configuration. Use this option multiple times to set
69+
more than one variable. Refer to
70+
[Input Variables on the Command Line](/terraform/cli/commands/plan#input-variables-on-the-command-line) for more information.
71+
72+
* `-var-file=FILENAME` - Sets values for potentially many
73+
[input variables](/terraform/language/block/variable) declared in the
74+
root module of the configuration, using definitions from a
75+
[`.tfvars` file](/terraform/language/values/variables#variable-definition-files).
76+
Use this option multiple times to include values from more than one file.
77+
There are several other ways to set values for input variables in the root
78+
module, aside from the `-var` and `-var-file` options. Refer to
79+
[Assign values to input variables](/terraform/language/values/variables#assign-values-to-input-variables) for more information.
80+
6681
You can run `terraform providers mirror` again on an existing mirror directory
6782
to update it with new packages. For example, you can add packages for a new
6883
target platform by re-running the command with the desired new `-platform=...`

content/terraform/v1.15.x (beta)/docs/cli/commands/providers/schema.mdx

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,24 @@ $ terraform providers schema [options]
2020

2121
The following flags are available:
2222

23-
- `-json` - Displays the schemas in a machine-readable JSON format. The `-json` flag is required.
24-
25-
The output includes a `format_version` key, which has a default value of `"1.0"`. The semantics of this version are:
23+
- `-json` - Displays the schemas in a machine-readable JSON format. The `-json` flag is required.
24+
25+
- `-var 'NAME=VALUE'` - Sets a value for a single
26+
[input variable](/terraform/language/block/variable) declared in the
27+
root module of the configuration. Use this option multiple times to set
28+
more than one variable. Refer to
29+
[Input Variables on the Command Line](/terraform/cli/commands/plan#input-variables-on-the-command-line) for more information.
30+
31+
- `-var-file=FILENAME` - Sets values for potentially many
32+
[input variables](/terraform/language/block/variable) declared in the
33+
root module of the configuration, using definitions from a
34+
[`.tfvars` file](/terraform/language/values/variables#variable-definition-files).
35+
Use this option multiple times to include values from more than one file.
36+
There are several other ways to set values for input variables in the root
37+
module, aside from the `-var` and `-var-file` options. Refer to
38+
[Assign values to input variables](/terraform/language/values/variables#assign-values-to-input-variables) for more information.
39+
40+
The output includes a `format_version` key, which has a default value of `"1.0"`. The semantics of this version are:
2641

2742
- Versions between `1.0` and `2.0` are backward-compatible. You should ignore any object properties with unrecognized names to
2843
remain forward-compatible with future minor versions.

content/terraform/v1.15.x (beta)/docs/cli/commands/state/mv.mdx

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,20 @@ This command also accepts the following options:
5757
- `-dry-run` - Report all of the resource instances that match the given
5858
address without actually "forgetting" any of them.
5959

60+
- `-var 'NAME=VALUE'` - Sets a value for a single
61+
[input variable](/terraform/language/block/variable) declared in the
62+
root module of the configuration. Use this option multiple times to set
63+
more than one variable. Refer to
64+
[Input Variables on the Command Line](/terraform/cli/commands/plan#input-variables-on-the-command-line) for more information.
65+
- `-var-file=FILENAME` - Sets values for potentially many
66+
[input variables](/terraform/language/block/variable) declared in the
67+
root module of the configuration, using definitions from a
68+
[`.tfvars` file](/terraform/language/values/variables#variable-definition-files).
69+
Use this option multiple times to include values from more than one file.
70+
There are several other ways to set values for input variables in the root
71+
module, aside from the `-var` and `-var-file` options. Refer to
72+
[Assign values to input variables](/terraform/language/values/variables#assign-values-to-input-variables) for more information.
73+
6074
- `-lock=false` - Don't hold a state lock during the operation. This is
6175
dangerous if others might concurrently run commands against the same
6276
workspace.

content/terraform/v1.15.x (beta)/docs/cli/commands/state/pull.mdx

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,29 @@ The `terraform state pull` downloads and outputs state information from a [remot
1414

1515
## Usage
1616

17-
Usage: `terraform state pull`
17+
Usage: `terraform state pull [options]`
1818

1919
This command downloads the state from its current location, upgrades the
2020
local copy to the latest state file version that is compatible with
2121
locally-installed Terraform, and outputs the raw format to stdout.
2222

23+
This command also accepts the following options:
24+
25+
- `-var 'NAME=VALUE'` - Sets a value for a single
26+
[input variable](/terraform/language/block/variable) declared in the
27+
root module of the configuration. Use this option multiple times to set
28+
more than one variable. Refer to
29+
[Input Variables on the Command Line](/terraform/cli/commands/plan#input-variables-on-the-command-line) for more information.
30+
31+
- `-var-file=FILENAME` - Sets values for potentially many
32+
[input variables](/terraform/language/block/variable) declared in the
33+
root module of the configuration, using definitions from a
34+
[`.tfvars` file](/terraform/language/values/variables#variable-definition-files).
35+
Use this option multiple times to include values from more than one file.
36+
There are several other ways to set values for input variables in the root
37+
module, aside from the `-var` and `-var-file` options. Refer to
38+
[Assign values to input variables](/terraform/language/values/variables#assign-values-to-input-variables) for more information.
39+
2340
This is useful for reading values out of state (potentially pairing this
2441
command with something like [jq](https://stedolan.github.io/jq/)). It is
2542
also useful if you need to make manual modifications to state.

content/terraform/v1.15.x (beta)/docs/cli/commands/state/push.mdx

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,24 @@ Both of these safety checks can be disabled with the `-force` flag.
4141
**This is not recommended.** If you disable the safety checks and are
4242
pushing state, the destination state will be overwritten.
4343

44+
This command also accepts the following options:
45+
46+
- `-force` - Disable the safety checks for differing lineage and higher remote serial.
47+
48+
- `-var 'NAME=VALUE'` - Sets a value for a single
49+
[input variable](/terraform/language/block/variable) declared in the
50+
root module of the configuration. Use this option multiple times to set
51+
more than one variable. Refer to
52+
[Input Variables on the Command Line](/terraform/cli/commands/plan#input-variables-on-the-command-line) for more information.
53+
- `-var-file=FILENAME` - Sets values for potentially many
54+
[input variables](/terraform/language/block/variable) declared in the
55+
root module of the configuration, using definitions from a
56+
[`.tfvars` file](/terraform/language/values/variables#variable-definition-files).
57+
Use this option multiple times to include values from more than one file.
58+
There are several other ways to set values for input variables in the root
59+
module, aside from the `-var` and `-var-file` options. Refer to
60+
[Assign values to input variables](/terraform/language/values/variables#assign-values-to-input-variables) for more information.
61+
4462
For configurations using the [HCP Terraform CLI integration](/terraform/cli/cloud) or the [`remote` backend](/terraform/language/backend/remote)
4563
only, `terraform state push`
4664
also accepts the option

0 commit comments

Comments
 (0)