Merge pull request #30001 from hashicorp/revert-commit

Revert "migrate docs to mdx"
This commit is contained in:
Brandon Romano 2021-11-22 16:01:33 -08:00 committed by GitHub
commit ce1dbd7d2c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
321 changed files with 4602 additions and 4223 deletions

View File

@ -1,23 +1,21 @@
--- ---
page_title: Authentication - Terraform CLI layout: "docs"
description: >- page_title: "Authentication - Terraform CLI"
Documentation about the login and logout commands that help automate getting description: "Documentation about the login and logout commands that help automate getting an API token for your Terraform Cloud account."
an API token for your Terraform Cloud account.
sidebar_title: Authentication
--- ---
# CLI Authentication # CLI Authentication
> **Hands-on:** Try the [Authenticate the CLI with Terraform Cloud](https://learn.hashicorp.com/tutorials/terraform/cloud-login?in=terraform/cloud&utm_source=WEBSITE&utm_medium=WEB_IO&utm_offer=ARTICLE_PAGE&utm_content=DOCS) tutorial on HashiCorp Learn. > **Hands-on:** Try the [Authenticate the CLI with Terraform Cloud](https://learn.hashicorp.com/tutorials/terraform/cloud-login?in=terraform/cloud&utm_source=WEBSITE&utm_medium=WEB_IO&utm_offer=ARTICLE_PAGE&utm_content=DOCS) tutorial on HashiCorp Learn.
[Terraform Cloud](/cloud-docs/) and [Terraform Cloud](/docs/cloud/index.html) and
[Terraform Enterprise](/enterprise/) are platforms that perform [Terraform Enterprise](/docs/enterprise/index.html) are platforms that perform
Terraform runs to provision infrastructure, offering a collaboration-focused Terraform runs to provision infrastructure, offering a collaboration-focused
environment that makes it easier for teams to use Terraform together. (For environment that makes it easier for teams to use Terraform together. (For
expediency, the content below refers to both products as "Terraform Cloud.") expediency, the content below refers to both products as "Terraform Cloud.")
Terraform CLI integrates with Terraform Cloud in several ways — it can be a Terraform CLI integrates with Terraform Cloud in several ways — it can be a
front-end for [CLI-driven runs](/cloud-docs/run/cli) in Terraform Cloud, front-end for [CLI-driven runs](/docs/cloud/run/cli.html) in Terraform Cloud,
and can also use Terraform Cloud as a state backend and a private module and can also use Terraform Cloud as a state backend and a private module
registry. All of these integrations require you to authenticate Terraform CLI registry. All of these integrations require you to authenticate Terraform CLI
with your Terraform Cloud account. with your Terraform Cloud account.
@ -28,5 +26,5 @@ Terraform Cloud user account.
For details, see: For details, see:
- [The `terraform login` command](/cli/commands/login) - [The `terraform login` command](/docs/cli/commands/login.html)
- [The `terraform logout` command](/cli/commands/logout) - [The `terraform logout` command](/docs/cli/commands/logout.html)

View File

@ -1,14 +1,12 @@
--- ---
page_title: Writing and Modifying Code - Terraform CLI layout: "docs"
description: >- page_title: "Writing and Modifying Code - Terraform CLI"
Learn commands that help validate, format, and upgrade code written in the description: "Learn commands that help validate, format, and upgrade code written in the Terraform Configuration Language."
Terraform Configuration Language.
sidebar_title: Writing and Modifying Code
--- ---
# Writing and Modifying Terraform Code # Writing and Modifying Terraform Code
The [Terraform language](/language/) is Terraform's primary The [Terraform language](/docs/language/index.html) is Terraform's primary
user interface, and all of Terraform's workflows rely on configurations written user interface, and all of Terraform's workflows rely on configurations written
in the Terraform language. in the Terraform language.
@ -16,17 +14,18 @@ Terraform CLI includes several commands to make Terraform code more convenient
to work with. Integrating these commands into your editing workflow can to work with. Integrating these commands into your editing workflow can
potentially save you time and effort. potentially save you time and effort.
- [The `terraform console` command](/cli/commands/console) starts an - [The `terraform console` command](/docs/cli/commands/console.html) starts an
interactive shell for evaluating Terraform interactive shell for evaluating Terraform
[expressions](/language/expressions/), which can be a faster way [expressions](/docs/language/expressions/index.html), which can be a faster way
to verify that a particular resource argument results in the value you expect. to verify that a particular resource argument results in the value you expect.
- [The `terraform fmt` command](/cli/commands/fmt) rewrites Terraform
- [The `terraform fmt` command](/docs/cli/commands/fmt.html) rewrites Terraform
configuration files to a canonical format and style, so you don't have to configuration files to a canonical format and style, so you don't have to
waste time making minor adjustments for readability and consistency. It works waste time making minor adjustments for readability and consistency. It works
well as a pre-commit hook in your version control system. well as a pre-commit hook in your version control system.
- [The `terraform validate` command](/cli/commands/validate) validates the - [The `terraform validate` command](/docs/cli/commands/validate.html) validates the
syntax and arguments of the Terraform configuration files in a directory, syntax and arguments of the Terraform configuration files in a directory,
including argument and attribute names and types for resources and modules. including argument and attribute names and types for resources and modules.
The `plan` and `apply` commands automatically validate a configuration before The `plan` and `apply` commands automatically validate a configuration before
@ -34,12 +33,12 @@ potentially save you time and effort.
workflow, but it can be very useful as a pre-commit hook or as part of a workflow, but it can be very useful as a pre-commit hook or as part of a
continuous integration pipeline. continuous integration pipeline.
- [The `0.13upgrade` command](/cli/commands/0.13upgrade) and - [The `0.13upgrade` command](/docs/cli/commands/0.13upgrade.html) and
[the `0.12upgrade` command](/cli/commands/0.12upgrade) can automatically [the `0.12upgrade` command](/docs/cli/commands/0.12upgrade.html) can automatically
modify the configuration files in a Terraform module to help deal with major modify the configuration files in a Terraform module to help deal with major
syntax changes that occurred in the 0.13 and 0.12 releases of Terraform. Both syntax changes that occurred in the 0.13 and 0.12 releases of Terraform. Both
of these commands are only available in the Terraform version they are of these commands are only available in the Terraform version they are
associated with, and you are expected to upgrade older code to be compatible associated with, and you are expected to upgrade older code to be compatible
with 0.12 before attempting to make it compatible with 0.13. For more detailed with 0.12 before attempting to make it compatible with 0.13. For more detailed
information about updating code for new Terraform versions, see the [upgrade information about updating code for new Terraform versions, see the [upgrade
guides](/upgrade-guides/) in the Terraform language docs. guides](/upgrade-guides/index.html) in the Terraform language docs.

View File

@ -1,8 +1,9 @@
--- ---
page_title: 'Command: 0.12upgrade' layout: "docs"
description: >- page_title: "Command: 0.12upgrade"
The 0.12upgrade subcommand automatically rewrites existing configurations for sidebar_current: "docs-commands-012upgrade"
Terraform 0.12 compatibility. description: |-
The 0.12upgrade subcommand automatically rewrites existing configurations for Terraform 0.12 compatibility.
--- ---
# Command: 0.12upgrade # Command: 0.12upgrade
@ -11,7 +12,7 @@ The `terraform 0.12upgrade` command applies several automatic upgrade rules to
help prepare a module that was written for Terraform v0.11 to be used help prepare a module that was written for Terraform v0.11 to be used
with Terraform v0.12. with Terraform v0.12.
-> **This command is available only in Terraform v0.12 releases.** For more information, see [the Terraform v0.12 upgrade guide](/upgrade-guides/0-12). -> **This command is available only in Terraform v0.12 releases.** For more information, see [the Terraform v0.12 upgrade guide](https://www.terraform.io/upgrade-guides/0-12.html).
## Usage ## Usage
@ -70,13 +71,13 @@ the change.
Once upgraded the configuration will no longer be compatible with Terraform Once upgraded the configuration will no longer be compatible with Terraform
v0.11 and earlier. When upgrading a shared module that is called from multiple v0.11 and earlier. When upgrading a shared module that is called from multiple
configurations, you may need to configurations, you may need to
[fix existing configurations to a previous version](/language/modules/syntax#version) [fix existing configurations to a previous version](/docs/language/modules/syntax.html#version)
to allow for a gradual upgrade. If the module is published via to allow for a gradual upgrade. If the module is published via
[a Terraform registry](/registry/), assign a new _major_ version number [a Terraform registry](/docs/registry/), assign a new _major_ version number
to the upgraded module source to represent the fact that this is a breaking to the upgraded module source to represent the fact that this is a breaking
change for v0.11 callers. If a module is installed directly from a version change for v0.11 callers. If a module is installed directly from a version
control system such as Git, control system such as Git,
[use specific revisions](/language/modules/sources#selecting-a-revision) [use specific revisions](https://www.terraform.io/docs/language/modules/sources.html#selecting-a-revision)
to control which version is used by which caller. to control which version is used by which caller.
The command-line options are all optional. The available options are: The command-line options are all optional. The available options are:
@ -106,9 +107,9 @@ On Mac OS X, the `find` included with the system does not support the `-printf`
``` ```
brew install findutils brew install findutils
``` ```
Once installed, run the above command line using `gfind` instead of `find`. Once installed, run the above command line using `gfind` instead of `find`.
Note that the above includes the `-yes` option to override the interactive Note that the above includes the `-yes` option to override the interactive
prompt, so be sure you have a clean work tree before running it. prompt, so be sure you have a clean work tree before running it.

View File

@ -1,8 +1,9 @@
--- ---
page_title: 'Command: 0.13upgrade' layout: "docs"
description: >- page_title: "Command: 0.13upgrade"
The 0.13upgrade subcommand updates existing configurations to use the new sidebar_current: "docs-commands-013upgrade"
provider source features from Terraform 0.13. description: |-
The 0.13upgrade subcommand updates existing configurations to use the new provider source features from Terraform 0.13.
--- ---
# Command: 0.13upgrade # Command: 0.13upgrade
@ -11,7 +12,7 @@ The `terraform 0.13upgrade` command updates existing configuration to add an
explicit `source` attribute for each provider used in a given module. The explicit `source` attribute for each provider used in a given module. The
provider source settings are stored in a `required_providers` block. provider source settings are stored in a `required_providers` block.
-> **This command is available only in Terraform v0.13 releases.** For more information, see [the Terraform v0.13 upgrade guide](/upgrade-guides/0-13). -> **This command is available only in Terraform v0.13 releases.** For more information, see [the Terraform v0.13 upgrade guide](https://www.terraform.io/upgrade-guides/0-13.html).
## Usage ## Usage
@ -22,7 +23,7 @@ providers are in use for a module, detect the source address for those
providers where possible, and record this information in a providers where possible, and record this information in a
[`required_providers` block][required-providers]. [`required_providers` block][required-providers].
[required-providers]: /language/providers/requirements [required-providers]: /docs/language/providers/requirements.html
~> Note: the command ignores `.tf.json` files and override files in the module. ~> Note: the command ignores `.tf.json` files and override files in the module.

View File

@ -1,8 +1,8 @@
--- ---
page_title: 'Command: apply' layout: "docs"
description: >- page_title: "Command: apply"
The terraform apply command executes the actions proposed in a Terraform plan sidebar_current: "docs-commands-apply"
to create, update, or destroy infrastructure. description: "The terraform apply command executes the actions proposed in a Terraform plan to create, update, or destroy infrastructure."
--- ---
# Command: apply # Command: apply
@ -33,15 +33,15 @@ you pass it the filename of a previously-saved plan file.
### Automatic Plan Mode ### Automatic Plan Mode
In the default case, with no saved plan file, `terraform apply` creates its own In the default case, with no saved plan file, `terraform apply` creates its own
plan of action, in the same way that [`terraform plan`](/cli/commands/plan) would. plan of action, in the same way that [`terraform plan`](./plan.html) would.
Terraform will propose the plan to you and prompt you to approve it before Terraform will propose the plan to you and prompt you to approve it before
taking the described actions, unless you waive that prompt by using the taking the described actions, unless you waive that prompt by using the
`-auto-approve` option. `-auto-approve` option.
When performing its own plan, `terraform apply` supports all of the same When performing its own plan, `terraform apply` supports all of the same
[planning modes](/cli/commands/plan#planning-modes) and [planning modes](./plan.html#planning-modes) and
[planning options](/cli/commands/plan#planning-options) that `terraform plan` would [planning options](./plan.html#planning-options) that `terraform plan` would
accept, so you can customize how Terraform will create the plan. accept, so you can customize how Terraform will create the plan.
### Saved Plan Mode ### Saved Plan Mode
@ -49,7 +49,7 @@ accept, so you can customize how Terraform will create the plan.
If you pass the filename of a previously-saved plan file, `terraform apply` If you pass the filename of a previously-saved plan file, `terraform apply`
performs exactly the steps specified by that plan file. It does not prompt for performs exactly the steps specified by that plan file. It does not prompt for
approval; if you want to inspect a plan file before applying it, you can use approval; if you want to inspect a plan file before applying it, you can use
[`terraform show`](/cli/commands/show). [`terraform show`](./show.html).
When using a saved plan, none of the planning modes or planning options linked When using a saved plan, none of the planning modes or planning options linked
above are supported; these options only affect Terraform's decisions about which above are supported; these options only affect Terraform's decisions about which
@ -61,8 +61,8 @@ decisions.
When run without a saved plan file, `terraform apply` supports all of `terraform When run without a saved plan file, `terraform apply` supports all of `terraform
plan`'s planning modes and planning options. For details, see: plan`'s planning modes and planning options. For details, see:
* [Planning Modes](/cli/commands/plan#planning-modes) - [Planning Modes](./plan.html#planning-modes)
* [Planning Options](/cli/commands/plan#planning-options) - [Planning Options](./plan.html#planning-options)
### Apply Options ### Apply Options
@ -70,7 +70,7 @@ The following options allow you to change various details about how the
apply command executes and reports on the apply operation. If you are running apply command executes and reports on the apply operation. If you are running
`terraform apply` _without_ a previously-saved plan file, these options are `terraform apply` _without_ a previously-saved plan file, these options are
_in addition to_ the planning modes and planning options described for _in addition to_ the planning modes and planning options described for
[`terraform plan`](/cli/commands/plan). [`terraform plan`](./plan.html).
* `-auto-approve` - Skips interactive approval of plan before applying. This * `-auto-approve` - Skips interactive approval of plan before applying. This
option is ignored when you pass a previously-saved plan file, because option is ignored when you pass a previously-saved plan file, because
@ -95,11 +95,11 @@ _in addition to_ the planning modes and planning options described for
variable values to continue. To enable this flag, you must also either enable variable values to continue. To enable this flag, you must also either enable
the `-auto-approve` flag or specify a previously-saved plan. the `-auto-approve` flag or specify a previously-saved plan.
[machine-readable-ui]: /internals/machine-readable-ui [machine-readable-ui]: /docs/internals/machine-readable-ui.html
* `-lock=false` - Don't hold a state lock during the operation. This is * `-lock=false` - Don't hold a state lock during the operation. This is
dangerous if others might concurrently run commands against the same dangerous if others might concurrently run commands against the same
workspace. workspace.
* `-lock-timeout=DURATION` - Unless locking is disabled with `-lock=false`, * `-lock-timeout=DURATION` - Unless locking is disabled with `-lock=false`,
instructs Terraform to retry acquiring a lock for a period of time before instructs Terraform to retry acquiring a lock for a period of time before
@ -111,13 +111,13 @@ _in addition to_ the planning modes and planning options described for
rendered by a system that cannot interpret terminal formatting. rendered by a system that cannot interpret terminal formatting.
* `-parallelism=n` - Limit the number of concurrent operation as Terraform * `-parallelism=n` - Limit the number of concurrent operation as Terraform
[walks the graph](/internals/graph#walking-the-graph). Defaults to [walks the graph](/docs/internals/graph.html#walking-the-graph). Defaults to
10\. 10.
For configurations using For configurations using
[the `local` backend](/language/settings/backends/local) only, [the `local` backend](/docs/language/settings/backends/local.html) only,
`terraform apply` also accepts the legacy options `terraform apply` also accepts the legacy options
[`-state`, `-state-out`, and `-backup`](/language/settings/backends/local#command-line-arguments). [`-state`, `-state-out`, and `-backup`](/docs/language/settings/backends/local.html#command-line-arguments).
## Passing a Different Configuration Directory ## Passing a Different Configuration Directory
@ -127,7 +127,7 @@ that directory as the root module instead of the current working directory.
That usage was deprecated in Terraform v0.14 and removed in Terraform v0.15. That usage was deprecated in Terraform v0.14 and removed in Terraform v0.15.
If your workflow relies on overriding the root module directory, use If your workflow relies on overriding the root module directory, use
[the `-chdir` global option](/cli/commands/#switching-working-directory-with-chdir) [the `-chdir` global option](./#switching-working-directory-with-chdir)
instead, which works across all commands and makes Terraform consistently look instead, which works across all commands and makes Terraform consistently look
in the given directory for all files it would normally read or write in the in the given directory for all files it would normally read or write in the
current working directory. current working directory.
@ -135,6 +135,6 @@ current working directory.
If your previous use of this legacy pattern was also relying on Terraform If your previous use of this legacy pattern was also relying on Terraform
writing the `.terraform` subdirectory into the current working directory even writing the `.terraform` subdirectory into the current working directory even
though the root module directory was overridden, use though the root module directory was overridden, use
[the `TF_DATA_DIR` environment variable](/cli/config/environment-variables#tf_data_dir) [the `TF_DATA_DIR` environment variable](/docs/cli/config/environment-variables.html#tf_data_dir)
to direct Terraform to write the `.terraform` directory to a location other to direct Terraform to write the `.terraform` directory to a location other
than the current working directory. than the current working directory.

View File

@ -1,36 +1,37 @@
--- ---
page_title: 'Command: console' layout: "docs"
description: >- page_title: "Command: console"
The terraform console command provides an interactive console for evaluating sidebar_current: "docs-commands-console"
expressions. description: "The terraform console command provides an interactive console for
evaluating expressions."
--- ---
# Command: console # Command: console
The `terraform console` command provides an interactive console for The `terraform console` command provides an interactive console for
evaluating [expressions](/language/expressions/). evaluating [expressions](/docs/language/expressions/index.html).
## Usage ## Usage
Usage: `terraform console [options]` Usage: `terraform console [options]`
This command provides an interactive command-line console for evaluating and This command provides an interactive command-line console for evaluating and
experimenting with [expressions](/language/expressions/). experimenting with [expressions](/docs/language/expressions/index.html).
This is useful for testing interpolations before using them in configurations, This is useful for testing interpolations before using them in configurations,
and for interacting with any values currently saved in and for interacting with any values currently saved in
[state](/language/state/). [state](/docs/language/state/index.html).
If the current state is empty or has not yet been created, the console can be If the current state is empty or has not yet been created, the console can be
used to experiment with the expression syntax and used to experiment with the expression syntax and
[built-in functions](/language/functions/). [built-in functions](/docs/language/functions/index.html).
You can close the console with the `exit` command or by pressing Control-C You can close the console with the `exit` command or by pressing Control-C
or Control-D. or Control-D.
For configurations using For configurations using
[the `local` backend](/language/settings/backends/local) only, [the `local` backend](/docs/language/settings/backends/local.html) only,
`terraform console` accepts the legacy command line option `terraform console` accepts the legacy command line option
[`-state`](/language/settings/backends/local#command-line-arguments). [`-state`](/docs/language/settings/backends/local.html#command-line-arguments).
## Scripting ## Scripting
@ -51,7 +52,7 @@ tolist([
## Remote State ## Remote State
If [remote state](/language/state/remote) is used by the current backend, If [remote state](/docs/language/state/remote.html) is used by the current backend,
Terraform will read the state for the current workspace from the backend Terraform will read the state for the current workspace from the backend
before evaluating any expressions. before evaluating any expressions.

View File

@ -1,8 +1,8 @@
--- ---
page_title: 'Command: destroy' layout: "docs"
description: >- page_title: "Command: destroy"
The terraform destroy command destroys all objects managed by a Terraform sidebar_current: "docs-commands-destroy"
configuration. description: "The terraform destroy command destroys all objects managed by a Terraform configuration."
--- ---
# Command: destroy # Command: destroy
@ -27,7 +27,7 @@ terraform apply -destroy
``` ```
For that reason, this command accepts most of the options that For that reason, this command accepts most of the options that
[`terraform apply`](/cli/commands/apply) accepts, although it does [`terraform apply`](./apply.html) accepts, although it does
not accept a plan file argument and forces the selection of the "destroy" not accept a plan file argument and forces the selection of the "destroy"
planning mode. planning mode.
@ -38,7 +38,7 @@ destroying would be, by running the following command:
terraform plan -destroy terraform plan -destroy
``` ```
This will run [`terraform plan`](/cli/commands/plan) in _destroy_ mode, showing This will run [`terraform plan`](./plan.html) in _destroy_ mode, showing
you the proposed destroy changes without executing them. you the proposed destroy changes without executing them.
-> **Note:** The `-destroy` option to `terraform apply` exists only in -> **Note:** The `-destroy` option to `terraform apply` exists only in

View File

@ -0,0 +1,12 @@
---
layout: "docs"
page_title: "Command: env"
sidebar_current: "docs-commands-envcmd"
description: "The terraform env command is a deprecated form of the terraform workspace command."
---
# Command: env
The `terraform env` command is deprecated.
[The `terraform workspace` command](/docs/cli/commands/workspace/index.html)
should be used instead.

View File

@ -1,12 +0,0 @@
---
page_title: 'Command: env'
description: >-
The terraform env command is a deprecated form of the terraform workspace
command.
---
# Command: env
The `terraform env` command is deprecated.
[The `terraform workspace` command](/cli/commands/workspace/)
should be used instead.

View File

@ -1,15 +1,15 @@
--- ---
page_title: 'Command: fmt' layout: "docs"
description: >- page_title: "Command: fmt"
The terraform fmt command rewrites configuration files to a canonical format sidebar_current: "docs-commands-fmt"
and style. description: "The terraform fmt command rewrites configuration files to a canonical format and style."
--- ---
# Command: fmt # Command: fmt
The `terraform fmt` command is used to rewrite Terraform configuration files The `terraform fmt` command is used to rewrite Terraform configuration files
to a canonical format and style. This command applies a subset of to a canonical format and style. This command applies a subset of
the [Terraform language style conventions](/language/syntax/style), the [Terraform language style conventions](/docs/language/syntax/style.html),
along with other minor adjustments for readability. along with other minor adjustments for readability.
Other Terraform commands that generate Terraform configuration will produce Other Terraform commands that generate Terraform configuration will produce
@ -58,5 +58,5 @@ The command-line flags are all optional. The list of available flags are:
* `-write=false` - Don't overwrite the input files. (This is implied by `-check` or when the input is STDIN.) * `-write=false` - Don't overwrite the input files. (This is implied by `-check` or when the input is STDIN.)
* `-diff` - Display diffs of formatting changes * `-diff` - Display diffs of formatting changes
* `-check` - Check if the input is formatted. Exit status will be 0 if * `-check` - Check if the input is formatted. Exit status will be 0 if
all input is properly formatted and non-zero otherwise. all input is properly formatted and non-zero otherwise.
* `-recursive` - Also process files in subdirectories. By default, only the given directory (or current directory) is processed. * `-recursive` - Also process files in subdirectories. By default, only the given directory (or current directory) is processed.

View File

@ -1,8 +1,8 @@
--- ---
page_title: 'Command: force-unlock' layout: "docs"
description: >- page_title: "Command: force-unlock"
The terraform force-unlock command unlocks the state for a configuration. It sidebar_current: "docs-commands-force-unlock"
does not modify your infrastructure. description: "The terraform force-unlock command unlocks the state for a configuration. It does not modify your infrastructure."
--- ---
# Command: force-unlock # Command: force-unlock
@ -27,4 +27,4 @@ process.
Options: Options:
* `-force` - Don't ask for input for unlock confirmation. * `-force` - Don't ask for input for unlock confirmation.

View File

@ -1,12 +1,14 @@
--- ---
page_title: 'Command: get' layout: "docs"
description: The terraform get command downloads and updates modules. page_title: "Command: get"
sidebar_current: "docs-commands-get"
description: "The terraform get command downloads and updates modules."
--- ---
# Command: get # Command: get
The `terraform get` command is used to download and update The `terraform get` command is used to download and update
[modules](/language/modules/develop/) mentioned in the root module. [modules](/docs/language/modules/develop/index.html) mentioned in the root module.
## Usage ## Usage
@ -19,6 +21,6 @@ repository.
The `get` command supports the following option: The `get` command supports the following option:
* `-update` - If specified, modules that are already downloaded will be * `-update` - If specified, modules that are already downloaded will be
checked for updates and the updates will be downloaded if present. checked for updates and the updates will be downloaded if present.
* `-no-color` - Disable text coloring in the output. * `-no-color` - Disable text coloring in the output.

View File

@ -1,8 +1,8 @@
--- ---
page_title: 'Command: graph' layout: "docs"
description: >- page_title: "Command: graph"
The terraform graph command generates a visual representation of a sidebar_current: "docs-commands-graph"
configuration or execution plan that you can use to generate charts. description: "The terraform graph command generates a visual representation of a configuration or execution plan that you can use to generate charts."
--- ---
# Command: graph # Command: graph
@ -12,6 +12,7 @@ representation of either a configuration or execution plan.
The output is in the DOT format, which can be used by The output is in the DOT format, which can be used by
[GraphViz](http://www.graphviz.org) to generate charts. [GraphViz](http://www.graphviz.org) to generate charts.
## Usage ## Usage
Usage: `terraform graph [options]` Usage: `terraform graph [options]`
@ -32,16 +33,16 @@ argument.
Options: Options:
* `-plan=tfplan` - Render graph using the specified plan file instead of the * `-plan=tfplan` - Render graph using the specified plan file instead of the
configuration in the current directory. configuration in the current directory.
* `-draw-cycles` - Highlight any cycles in the graph with colored edges. * `-draw-cycles` - Highlight any cycles in the graph with colored edges.
This helps when diagnosing cycle errors. This helps when diagnosing cycle errors.
* `-type=plan` - Type of graph to output. Can be: `plan`, `plan-destroy`, `apply`, * `-type=plan` - Type of graph to output. Can be: `plan`, `plan-destroy`, `apply`,
`validate`, `input`, `refresh`. `validate`, `input`, `refresh`.
* `-module-depth=n` - (deprecated) In prior versions of Terraform, specified the * `-module-depth=n` - (deprecated) In prior versions of Terraform, specified the
depth of modules to show in the output. depth of modules to show in the output.
## Generating Images ## Generating Images
@ -54,4 +55,4 @@ $ terraform graph | dot -Tsvg > graph.svg
``` ```
Here is an example graph output: Here is an example graph output:
![Graph Example](/img/docs/graph-example.png) ![Graph Example](docs/graph-example.png)

View File

@ -1,6 +1,8 @@
--- ---
page_title: 'Command: import' layout: "docs"
description: The terraform import command brings existing resources into Terraform state. page_title: "Command: import"
sidebar_current: "docs-commands-import"
description: "The terraform import command brings existing resources into Terraform state."
--- ---
# Command: import # Command: import
@ -8,7 +10,7 @@ description: The terraform import command brings existing resources into Terrafo
> **Hands-on:** Try the [Import Terraform Configuration](https://learn.hashicorp.com/tutorials/terraform/state-import?in=terraform/state&utm_source=WEBSITE&utm_medium=WEB_IO&utm_offer=ARTICLE_PAGE&utm_content=DOCS) tutorial on HashiCorp Learn. > **Hands-on:** Try the [Import Terraform Configuration](https://learn.hashicorp.com/tutorials/terraform/state-import?in=terraform/state&utm_source=WEBSITE&utm_medium=WEB_IO&utm_offer=ARTICLE_PAGE&utm_content=DOCS) tutorial on HashiCorp Learn.
The `terraform import` command is used to The `terraform import` command is used to
[import existing resources](/cli/import/) [import existing resources](/docs/cli/import/index.html)
into Terraform. into Terraform.
## Usage ## Usage
@ -18,7 +20,7 @@ Usage: `terraform import [options] ADDRESS ID`
Import will find the existing resource from ID and import it into your Terraform Import will find the existing resource from ID and import it into your Terraform
state at the given ADDRESS. state at the given ADDRESS.
ADDRESS must be a valid [resource address](/cli/state/resource-addressing). ADDRESS must be a valid [resource address](/docs/cli/state/resource-addressing.html).
Because any resource address is valid, the import command can import resources Because any resource address is valid, the import command can import resources
into modules as well as directly into the root of your state. into modules as well as directly into the root of your state.
@ -34,7 +36,7 @@ itself having created all objects. If you import existing objects into Terraform
be careful to import each remote object to only one Terraform resource address. be careful to import each remote object to only one Terraform resource address.
If you import the same object multiple times, Terraform may exhibit unwanted If you import the same object multiple times, Terraform may exhibit unwanted
behavior. For more information on this assumption, see behavior. For more information on this assumption, see
[the State section](/language/state/). [the State section](/docs/language/state/index.html).
The command-line flags are all optional. The list of available flags are: The command-line flags are all optional. The list of available flags are:
@ -46,29 +48,29 @@ The command-line flags are all optional. The list of available flags are:
* `-input=true` - Whether to ask for input for provider configuration. * `-input=true` - Whether to ask for input for provider configuration.
* `-lock=false` - Don't hold a state lock during the operation. This is * `-lock=false` - Don't hold a state lock during the operation. This is
dangerous if others might concurrently run commands against the same dangerous if others might concurrently run commands against the same
workspace. workspace.
* `-lock-timeout=0s` - Duration to retry a state lock. * `-lock-timeout=0s` - Duration to retry a state lock.
* `-no-color` - If specified, output won't contain any color. * `-no-color` - If specified, output won't contain any color.
* `-parallelism=n` - Limit the number of concurrent operation as Terraform * `-parallelism=n` - Limit the number of concurrent operation as Terraform
[walks the graph](/internals/graph#walking-the-graph). Defaults [walks the graph](/docs/internals/graph.html#walking-the-graph). Defaults
to 10. to 10.
* `-provider=provider` - **Deprecated** Override the provider configuration to * `-provider=provider` - **Deprecated** Override the provider configuration to
use when importing the object. By default, Terraform uses the provider specified use when importing the object. By default, Terraform uses the provider specified
in the configuration for the target resource, and that is the best behavior in most cases. in the configuration for the target resource, and that is the best behavior in most cases.
* `-var 'foo=bar'` - Set a variable in the Terraform configuration. This flag * `-var 'foo=bar'` - Set a variable in the Terraform configuration. This flag
can be set multiple times. Variable values are interpreted as can be set multiple times. Variable values are interpreted as
[literal expressions](/language/expressions/types) in the [literal expressions](/docs/language/expressions/types.html) in the
Terraform language, so list and map values can be specified via this flag. Terraform language, so list and map values can be specified via this flag.
This is only useful with the `-config` flag. This is only useful with the `-config` flag.
* `-var-file=foo` - Set variables in the Terraform configuration from * `-var-file=foo` - Set variables in the Terraform configuration from
a [variable file](/language/values/variables#variable-definitions-tfvars-files). If a [variable file](/docs/language/values/variables.html#variable-definitions-tfvars-files). If
a `terraform.tfvars` or any `.auto.tfvars` files are present in the current a `terraform.tfvars` or any `.auto.tfvars` files are present in the current
directory, they will be automatically loaded. `terraform.tfvars` is loaded directory, they will be automatically loaded. `terraform.tfvars` is loaded
first and the `.auto.tfvars` files after in alphabetical order. Any files first and the `.auto.tfvars` files after in alphabetical order. Any files
@ -77,15 +79,15 @@ The command-line flags are all optional. The list of available flags are:
useful with the `-config` flag. useful with the `-config` flag.
For configurations using For configurations using
[the `remote` backend](/language/settings/backends/remote) [the `remote` backend](/docs/language/settings/backends/remote.html)
only, `terraform import` only, `terraform import`
also accepts the option also accepts the option
[`-ignore-remote-version`](/language/settings/backends/remote#command-line-arguments). [`-ignore-remote-version`](/docs/language/settings/backends/remote.html#command-line-arguments).
For configurations using For configurations using
[the `local` backend](/language/settings/backends/local) only, [the `local` backend](/docs/language/settings/backends/local.html) only,
`terraform import` also accepts the legacy options `terraform import` also accepts the legacy options
[`-state`, `-state-out`, and `-backup`](/language/settings/backends/local#command-line-arguments). [`-state`, `-state-out`, and `-backup`](/docs/language/settings/backends/local.html#command-line-arguments).
## Provider Configuration ## Provider Configuration
@ -133,7 +135,7 @@ $ terraform import module.foo.aws_instance.bar i-abcd1234
## Example: Import into Resource configured with count ## Example: Import into Resource configured with count
The example below will import an AWS instance into the first instance of the `aws_instance` resource named `baz` configured with The example below will import an AWS instance into the first instance of the `aws_instance` resource named `baz` configured with
[`count`](/language/meta-arguments/count): [`count`](/docs/language/meta-arguments/count.html):
```shell ```shell
$ terraform import 'aws_instance.baz[0]' i-abcd1234 $ terraform import 'aws_instance.baz[0]' i-abcd1234
@ -142,7 +144,7 @@ $ terraform import 'aws_instance.baz[0]' i-abcd1234
## Example: Import into Resource configured with for_each ## Example: Import into Resource configured with for_each
The example below will import an AWS instance into the `"example"` instance of the `aws_instance` resource named `baz` configured with The example below will import an AWS instance into the `"example"` instance of the `aws_instance` resource named `baz` configured with
[`for_each`](/language/meta-arguments/for_each): [`for_each`](/docs/language/meta-arguments/for_each.html):
Linux, Mac OS, and UNIX: Linux, Mac OS, and UNIX:

View File

@ -1,6 +1,8 @@
--- ---
page_title: Basic CLI Features layout: "docs"
description: An introduction to the terraform command and its available subcommands. page_title: "Basic CLI Features"
sidebar_current: "docs-commands"
description: "An introduction to the terraform command and its available subcommands."
--- ---
# Basic CLI Features # Basic CLI Features
@ -15,8 +17,8 @@ of this page.
We refer to the `terraform` command line tool as "Terraform CLI" elsewhere We refer to the `terraform` command line tool as "Terraform CLI" elsewhere
in the documentation. This terminology is often used to distinguish it from in the documentation. This terminology is often used to distinguish it from
other components you might use in the Terraform product family, such as other components you might use in the Terraform product family, such as
[Terraform Cloud](/cloud-docs/) or [Terraform Cloud](/docs/cloud/) or
the various [Terraform providers](/language/providers/), which the various [Terraform providers](/docs/language/providers/index.html), which
are developed and released separately from Terraform CLI. are developed and released separately from Terraform CLI.
To view a list of the commands available in your current Terraform version, To view a list of the commands available in your current Terraform version,
@ -98,7 +100,7 @@ will be read or written in the given directory instead.
There are two exceptions where Terraform will use the original working directory There are two exceptions where Terraform will use the original working directory
even when you specify `-chdir=...`: even when you specify `-chdir=...`:
* Settings in the [CLI Configuration](/cli/config/config-file) are not for a specific * Settings in the [CLI Configuration](/docs/cli/config/config-file.html) are not for a specific
subcommand and Terraform processes them before acting on the `-chdir` subcommand and Terraform processes them before acting on the `-chdir`
option. option.
@ -151,7 +153,7 @@ Checkpoint itself can be entirely disabled for all HashiCorp products by
setting the environment variable `CHECKPOINT_DISABLE` to any non-empty value. setting the environment variable `CHECKPOINT_DISABLE` to any non-empty value.
Alternatively, settings in Alternatively, settings in
[the CLI configuration file](/cli/config/config-file) can be used to [the CLI configuration file](/docs/cli/config/config-file.html) can be used to
disable checkpoint features. The following checkpoint-related settings are disable checkpoint features. The following checkpoint-related settings are
supported in this file: supported in this file:

View File

@ -1,8 +1,8 @@
--- ---
page_title: 'Command: init' layout: "docs"
description: >- page_title: "Command: init"
The terraform init command initializes a working directory containing sidebar_current: "docs-commands-init"
configuration files and installs plugins for required providers. description: "The terraform init command initializes a working directory containing configuration files and installs plugins for required providers."
--- ---
# Command: init # Command: init
@ -74,7 +74,7 @@ activating credentials) before running `terraform init`.
## Backend Initialization ## Backend Initialization
During init, the root configuration directory is consulted for During init, the root configuration directory is consulted for
[backend configuration](/language/settings/backends/configuration) and the chosen backend [backend configuration](/docs/language/settings/backends/configuration.html) and the chosen backend
is initialized using the given configuration settings. is initialized using the given configuration settings.
Re-running init with an already-initialized backend will update the working Re-running init with an already-initialized backend will update the working
@ -96,14 +96,14 @@ when the working directory was already previously initialized for a particular
backend. backend.
The `-backend-config=...` option can be used for The `-backend-config=...` option can be used for
[partial backend configuration](/language/settings/backends/configuration#partial-configuration), [partial backend configuration](/docs/language/settings/backends/configuration.html#partial-configuration),
in situations where the backend settings are dynamic or sensitive and so cannot in situations where the backend settings are dynamic or sensitive and so cannot
be statically specified in the configuration file. be statically specified in the configuration file.
## Child Module Installation ## Child Module Installation
During init, the configuration is searched for `module` blocks, and the source During init, the configuration is searched for `module` blocks, and the source
code for referenced [modules](/language/modules/develop/) is retrieved from the locations code for referenced [modules](/docs/language/modules/develop/index.html) is retrieved from the locations
given in their `source` arguments. given in their `source` arguments.
Re-running init with modules already installed will install the sources for Re-running init with modules already installed will install the sources for
@ -128,13 +128,13 @@ third-party provider registry, `terraform init` will automatically find,
download, and install the necessary provider plugins. If you cannot or do not download, and install the necessary provider plugins. If you cannot or do not
wish to install providers from their origin registries, you can customize how wish to install providers from their origin registries, you can customize how
Terraform installs providers using Terraform installs providers using
[the provider installation settings in the CLI configuration](/cli/config/config-file#provider-installation). [the provider installation settings in the CLI configuration](/docs/cli/config/config-file.html#provider-installation).
For more information about specifying which providers are required for each For more information about specifying which providers are required for each
of your modules, see [Provider Requirements](/language/providers/requirements). of your modules, see [Provider Requirements](/docs/language/providers/requirements.html).
After successful installation, Terraform writes information about the selected After successful installation, Terraform writes information about the selected
providers to [the dependency lock file](/language/dependency-lock). providers to [the dependency lock file](/docs/language/dependency-lock.html).
You should commit this file to your version control system to ensure that You should commit this file to your version control system to ensure that
when you run `terraform init` again in future Terraform will select exactly when you run `terraform init` again in future Terraform will select exactly
the same provider versions. Use the `-upgrade` option if you want Terraform the same provider versions. Use the `-upgrade` option if you want Terraform
@ -142,31 +142,31 @@ to ignore the dependency lock file and consider installing newer versions.
You can modify `terraform init`'s plugin behavior with the following options: You can modify `terraform init`'s plugin behavior with the following options:
* `-upgrade` Upgrade all previously-selected plugins to the newest version - `-upgrade` Upgrade all previously-selected plugins to the newest version
that complies with the configuration's version constraints. This will that complies with the configuration's version constraints. This will
cause Terraform to ignore any selections recorded in the dependency lock cause Terraform to ignore any selections recorded in the dependency lock
file, and to take the newest available version matching the configured file, and to take the newest available version matching the configured
version constraints. version constraints.
* `-get-plugins=false` Skip plugin installation. - `-get-plugins=false` Skip plugin installation.
-> Note: Since Terraform 0.13, this option has been superseded by the -> Note: Since Terraform 0.13, this option has been superseded by the
[`provider_installation`](/cli/config/config-file#provider-installation) and [`provider_installation`](/docs/cli/config/config-file.html#provider-installation) and
[`plugin_cache_dir`](/cli/config/config-file#plugin_cache_dir) settings. [`plugin_cache_dir`](/docs/cli/config/config-file.html#plugin_cache_dir) settings.
It should not be used in Terraform versions 0.13+, and this option It should not be used in Terraform versions 0.13+, and this option
was removed in Terraform 0.15. was removed in Terraform 0.15.
* `-plugin-dir=PATH` Force plugin installation to read plugins _only_ from - `-plugin-dir=PATH` Force plugin installation to read plugins _only_ from
the specified directory, as if it had been configured as a `filesystem_mirror` the specified directory, as if it had been configured as a `filesystem_mirror`
in the CLI configuration. If you intend to routinely use a particular in the CLI configuration. If you intend to routinely use a particular
filesystem mirror then we recommend filesystem mirror then we recommend
[configuring Terraform's installation methods globally](/cli/config/config-file#provider-installation). [configuring Terraform's installation methods globally](/docs/cli/config/config-file.html#provider-installation).
You can use `-plugin-dir` as a one-time override for exceptional situations, You can use `-plugin-dir` as a one-time override for exceptional situations,
such as if you are testing a local build of a provider plugin you are such as if you are testing a local build of a provider plugin you are
currently developing. currently developing.
* `-lockfile=MODE` Set a dependency lockfile mode. - `-lockfile=MODE` Set a dependency lockfile mode.
The valid values for the lockfile mode are as follows: The valid values for the lockfile mode are as follows:
* readonly: suppress the lockfile changes, but verify checksums against the - readonly: suppress the lockfile changes, but verify checksums against the
information already recorded. It conflicts with the `-upgrade` flag. If you information already recorded. It conflicts with the `-upgrade` flag. If you
update the lockfile with third-party dependency management tools, it would be update the lockfile with third-party dependency management tools, it would be
useful to control when it changes explicitly. useful to control when it changes explicitly.
@ -192,7 +192,7 @@ that directory as the root module instead of the current working directory.
That usage is still supported in Terraform v0.14, but is now deprecated and we That usage is still supported in Terraform v0.14, but is now deprecated and we
plan to remove it in Terraform v0.15. If your workflow relies on overriding plan to remove it in Terraform v0.15. If your workflow relies on overriding
the root module directory, use the root module directory, use
[the `-chdir` global option](/cli/commands/#switching-working-directory-with-chdir) [the `-chdir` global option](./#switching-working-directory-with-chdir)
instead, which works across all commands and makes Terraform consistently look instead, which works across all commands and makes Terraform consistently look
in the given directory for all files it would normally read or write in the in the given directory for all files it would normally read or write in the
current working directory. current working directory.
@ -200,6 +200,6 @@ current working directory.
If your previous use of this legacy pattern was also relying on Terraform If your previous use of this legacy pattern was also relying on Terraform
writing the `.terraform` subdirectory into the current working directory even writing the `.terraform` subdirectory into the current working directory even
though the root module directory was overridden, use though the root module directory was overridden, use
[the `TF_DATA_DIR` environment variable](/cli/config/environment-variables#tf_data_dir) [the `TF_DATA_DIR` environment variable](/docs/cli/config/environment-variables.html#tf_data_dir)
to direct Terraform to write the `.terraform` directory to a location other to direct Terraform to write the `.terraform` directory to a location other
than the current working directory. than the current working directory.

View File

@ -1,9 +1,9 @@
--- ---
page_title: 'Command: login' layout: "docs"
description: >- page_title: "Command: login"
The terraform login command can be used to automatically obtain and save an sidebar_current: "docs-commands-login"
API token for Terraform Cloud, Terraform Enterprise, or any other host that description: |-
offers Terraform services. The terraform login command can be used to automatically obtain and save an API token for Terraform Cloud, Terraform Enterprise, or any other host that offers Terraform services.
--- ---
# Command: login # Command: login
@ -15,7 +15,7 @@ API token for Terraform Cloud, Terraform Enterprise, or any other host that offe
where it is possible to launch a web browser on the same host where Terraform where it is possible to launch a web browser on the same host where Terraform
is running. If you are running Terraform in an unattended automation scenario, is running. If you are running Terraform in an unattended automation scenario,
you can you can
[configure credentials manually in the CLI configuration](/cli/config/config-file#credentials). [configure credentials manually in the CLI configuration](https://www.terraform.io/docs/cli/config/config-file.html#credentials).
## Usage ## Usage
@ -34,12 +34,12 @@ not as desired.
If you don't wish to store your API token in the default location, you can If you don't wish to store your API token in the default location, you can
optionally configure a optionally configure a
[credentials helper program](/cli/config/config-file#credentials-helpers) which knows [credentials helper program](/docs/cli/config/config-file.html#credentials-helpers) which knows
how to store and later retrieve credentials in some other system, such as how to store and later retrieve credentials in some other system, such as
your organization's existing secrets management system. your organization's existing secrets management system.
## Login Server Support ## Login Server Support
The `terraform login` command works with any server supporting the The `terraform login` command works with any server supporting the
[login protocol](/internals/login-protocol), including Terraform Cloud [login protocol](/docs/internals/login-protocol.html), including Terraform Cloud
and Terraform Enterprise. and Terraform Enterprise.

View File

@ -1,8 +1,9 @@
--- ---
page_title: 'Command: logout' layout: "docs"
description: >- page_title: "Command: logout"
The terraform logout command is used to remove credentials stored by terraform sidebar_current: "docs-commands-logout"
login. description: |-
The terraform logout command is used to remove credentials stored by terraform login.
--- ---
# Command: logout # Command: logout
@ -25,5 +26,5 @@ the remote server, so it will remain valid until manually revoked.
By default, Terraform will remove the token stored in plain text in a local CLI By default, Terraform will remove the token stored in plain text in a local CLI
configuration file called `credentials.tfrc.json`. If you have configured a configuration file called `credentials.tfrc.json`. If you have configured a
[credentials helper program](/cli/config/config-file#credentials-helpers), Terraform [credentials helper program](/docs/cli/config/config-file.html#credentials-helpers), Terraform
will use the helper's `forget` command to remove it. will use the helper's `forget` command to remove it.

View File

@ -1,8 +1,9 @@
--- ---
page_title: 'Command: output' layout: "docs"
description: >- page_title: "Command: output"
The `terraform output` command is used to extract the value of an output sidebar_current: "docs-commands-output"
variable from the state file. description: |-
The `terraform output` command is used to extract the value of an output variable from the state file.
--- ---
# Command: output # Command: output
@ -21,20 +22,20 @@ output is printed.
The command-line flags are all optional. The list of available flags are: The command-line flags are all optional. The list of available flags are:
* `-json` - If specified, the outputs are formatted as a JSON object, with * `-json` - If specified, the outputs are formatted as a JSON object, with
a key per output. If `NAME` is specified, only the output specified will be a key per output. If `NAME` is specified, only the output specified will be
returned. This can be piped into tools such as `jq` for further processing. returned. This can be piped into tools such as `jq` for further processing.
* `-raw` - If specified, Terraform will convert the specified output value to a * `-raw` - If specified, Terraform will convert the specified output value to a
string and print that string directly to the output, without any special string and print that string directly to the output, without any special
formatting. This can be convenient when working with shell scripts, but formatting. This can be convenient when working with shell scripts, but
it only supports string, number, and boolean values. Use `-json` instead it only supports string, number, and boolean values. Use `-json` instead
for processing complex data types. for processing complex data types.
* `-no-color` - If specified, output won't contain any color. * `-no-color` - If specified, output won't contain any color.
* `-state=path` - Path to the state file. Defaults to "terraform.tfstate". * `-state=path` - Path to the state file. Defaults to "terraform.tfstate".
Ignored when [remote state](/language/state/remote) is used. Ignored when [remote state](/docs/language/state/remote.html) is used.
-> **Note:** When using the `-json` or `-raw` command-line flag, any sensitive -> **Note:** When using the `-json` or `-raw` command-line flag, any sensitive
values in Terraform state will be displayed in plain text. For more information, values in Terraform state will be displayed in plain text. For more information,
see [Sensitive Data in State](/language/state/sensitive-data). see [Sensitive Data in State](/docs/language/state/sensitive-data.html).
## Examples ## Examples

View File

@ -1,8 +1,8 @@
--- ---
page_title: 'Command: plan' layout: "docs"
description: >- page_title: "Command: plan"
The terraform plan command creates an execution plan with a preview of the sidebar_current: "docs-commands-plan"
changes that Terraform will make to your infrastructure. description: "The terraform plan command creates an execution plan with a preview of the changes that Terraform will make to your infrastructure."
--- ---
# Command: plan # Command: plan
@ -31,12 +31,12 @@ to be taken.
If you are using Terraform directly in an interactive terminal and you expect If you are using Terraform directly in an interactive terminal and you expect
to apply the changes Terraform proposes, you can alternatively run to apply the changes Terraform proposes, you can alternatively run
[`terraform apply`](/cli/commands/apply) directly. By default, the "apply" command [`terraform apply`](./apply.html) directly. By default, the "apply" command
automatically generates a new plan and prompts for you to approve it. automatically generates a new plan and prompts for you to approve it.
You can use the optional `-out=FILE` option to save the generated plan to a You can use the optional `-out=FILE` option to save the generated plan to a
file on disk, which you can later execute by passing the file to file on disk, which you can later execute by passing the file to
[`terraform apply`](/cli/commands/apply) as an extra argument. This two-step workflow [`terraform apply`](./apply.html) as an extra argument. This two-step workflow
is primarily intended for when is primarily intended for when
[running Terraform in automation](https://learn.hashicorp.com/tutorials/terraform/automate-terraform?in=terraform/automation&utm_source=WEBSITE&utm_medium=WEB_IO&utm_offer=ARTICLE_PAGE&utm_content=DOCS). [running Terraform in automation](https://learn.hashicorp.com/tutorials/terraform/automate-terraform?in=terraform/automation&utm_source=WEBSITE&utm_medium=WEB_IO&utm_offer=ARTICLE_PAGE&utm_content=DOCS).
@ -74,9 +74,9 @@ The remaining sections on this page describe the various options:
* **[Planning Options](#planning-options)**: Alongside the special planning * **[Planning Options](#planning-options)**: Alongside the special planning
modes, there are also some options you can set in order to customize the modes, there are also some options you can set in order to customize the
planning process for unusual needs. planning process for unusual needs.
* **[Resource Targeting](#resource-targeting)** is one particular * **[Resource Targeting](#resource-targeting)** is one particular
special planning option that has some important caveats associated special planning option that has some important caveats associated
with it. with it.
* **[Other Options](#other-options)**: These change the behavior of the planning * **[Other Options](#other-options)**: These change the behavior of the planning
command itself, rather than customizing the content of the generated plan. command itself, rather than customizing the content of the generated plan.
@ -94,7 +94,7 @@ a different intended outcome:
for situations like transient development environments, where the managed for situations like transient development environments, where the managed
objects cease to be useful once the development task is complete. objects cease to be useful once the development task is complete.
Activate destroy mode using the `-destroy` command line option. Activate destroy mode using the `-destroy` command line option.
* **Refresh-only mode:** creates a plan whose goal is only to update the * **Refresh-only mode:** creates a plan whose goal is only to update the
Terraform state and any root module output values to match changes made to Terraform state and any root module output values to match changes made to
@ -103,7 +103,7 @@ a different intended outcome:
workflow (e.g. while responding to an incident) and you now need to reconcile workflow (e.g. while responding to an incident) and you now need to reconcile
Terraform's records with those changes. Terraform's records with those changes.
Activate refresh-only mode using the `-refresh-only` command line option. Activate refresh-only mode using the `-refresh-only` command line option.
In situations where we need to discuss the default planning mode that Terraform In situations where we need to discuss the default planning mode that Terraform
uses when none of the alternative modes are selected, we refer to it as uses when none of the alternative modes are selected, we refer to it as
@ -118,7 +118,7 @@ one alternative mode at the same time.
-> **Note:** In Terraform v0.15 and earlier, the `-destroy` option is -> **Note:** In Terraform v0.15 and earlier, the `-destroy` option is
supported only by the `terraform plan` command, and not by the supported only by the `terraform plan` command, and not by the
`terraform apply` command. To create and apply a plan in destroy mode in `terraform apply` command. To create and apply a plan in destroy mode in
earlier versions you must run [`terraform destroy`](/cli/commands/destroy). earlier versions you must run [`terraform destroy`](./destroy.html).
-> **Note:** The `-refresh-only` option is available only in Terraform v0.15.4 -> **Note:** The `-refresh-only` option is available only in Terraform v0.15.4
and later. and later.
@ -140,62 +140,62 @@ the previous section, are also available with the same meanings on
* `-refresh=false` - Disables the default behavior of synchronizing the * `-refresh=false` - Disables the default behavior of synchronizing the
Terraform state with remote objects before checking for configuration changes. Terraform state with remote objects before checking for configuration changes.
This option can potentially make the planning operation faster by reducing This option can potentially make the planning operation faster by reducing
the number of remote API requests, but it comes at the expense of having the number of remote API requests, but it comes at the expense of having
Terraform not take into account any changes that might've happened outside Terraform not take into account any changes that might've happened outside
of Terraform, and thus the resulting plan may not be complete or correct. of Terraform, and thus the resulting plan may not be complete or correct.
This option is not available in the "refresh only" planning mode, because This option is not available in the "refresh only" planning mode, because
it would effectively disable the entirety of the planning operation in that it would effectively disable the entirety of the planning operation in that
case. case.
* `-replace=ADDRESS` - Instructs Terraform to plan to replace the single * `-replace=ADDRESS` - Instructs Terraform to plan to replace the single
resource instance with the given address. If the given instance would resource instance with the given address. If the given instance would
normally have caused only an "update" action, or no action at all, then normally have caused only an "update" action, or no action at all, then
Terraform will choose a "replace" action instead. Terraform will choose a "replace" action instead.
You can use this option if you have learned that a particular remote object You can use this option if you have learned that a particular remote object
has become degraded in some way. If you are using immutable infrastructure has become degraded in some way. If you are using immutable infrastructure
patterns then you may wish to respond to that by replacing the patterns then you may wish to respond to that by replacing the
malfunctioning object with a new object that has the same configuration. malfunctioning object with a new object that has the same configuration.
This option is allowed only in the normal planning mode, so this option This option is allowed only in the normal planning mode, so this option
is incompatible with the `-destroy` option. is incompatible with the `-destroy` option.
The `-replace=...` option is available only from Terraform v0.15.2 onwards. The `-replace=...` option is available only from Terraform v0.15.2 onwards.
For earlier versions, you can achieve a similar effect (with some caveats) For earlier versions, you can achieve a similar effect (with some caveats)
using [`terraform taint`](/cli/commands/taint). using [`terraform taint`](./taint.html).
* `-target=ADDRESS` - Instructs Terraform to focus its planning efforts only * `-target=ADDRESS` - Instructs Terraform to focus its planning efforts only
on resource instances which match the given address and on any objects that on resource instances which match the given address and on any objects that
those instances depend on. those instances depend on.
This command is for exceptional use only. See This command is for exceptional use only. See
[Resource Targeting](#resource-targeting) [Resource Targeting](#resource-targeting)
below for more information. below for more information.
* `-var 'NAME=VALUE'` - Sets a value for a single * `-var 'NAME=VALUE'` - Sets a value for a single
[input variable](/language/values/variables) declared in the [input variable](/docs/language/values/variables.html) declared in the
root module of the configuration. Use this option multiple times to set root module of the configuration. Use this option multiple times to set
more than one variable. For more information see more than one variable. For more information see
[Input Variables on the Command Line](#input-variables-on-the-command-line), [Input Variables on the Command Line](#input-variables-on-the-command-line),
below. below.
* `-var-file=FILENAME` - Sets values for potentially many * `-var-file=FILENAME` - Sets values for potentially many
[input variables](/language/values/variables) declared in the [input variables](/docs/language/values/variables.html) declared in the
root module of the configuration, using definitions from a root module of the configuration, using definitions from a
["tfvars" file](/language/values/variables#variable-definitions-tfvars-files). ["tfvars" file](/docs/language/values/variables.html#variable-definitions-tfvars-files).
Use this option multiple times to include values from more than one file. Use this option multiple times to include values from more than one file.
There are several other ways to set values for input variables in the root There are several other ways to set values for input variables in the root
module, aside from the `-var` and `-var-file` options. For more information, module, aside from the `-var` and `-var-file` options. For more information,
see see
[Assigning Values to Root Module Variables](/language/values/variables#assigning-values-to-root-module-variables). [Assigning Values to Root Module Variables](/docs/language/values/variables.html#assigning-values-to-root-module-variables).
### Input Variables on the Command Line ### Input Variables on the Command Line
You can use the `-var` command line option to specify values for You can use the `-var` command line option to specify values for
[input variables](/language/values/variables) declared in your [input variables](/docs/language/values/variables.html) declared in your
root module. root module.
However, to do so will require writing a command line that is parsable both However, to do so will require writing a command line that is parsable both
@ -242,7 +242,7 @@ so we do not recommend using Terraform with PowerShell when you are on Windows.
Use Windows Command Prompt instead. Use Windows Command Prompt instead.
The appropriate syntax for writing the variable value is different depending The appropriate syntax for writing the variable value is different depending
on the variable's [type constraint](/language/expressions/type-constraints). on the variable's [type constraint](/docs/language/expressions/type-constraints.html).
The primitive types `string`, `number`, and `bool` all expect a direct string The primitive types `string`, `number`, and `bool` all expect a direct string
value with no special punctuation except that required by your shell, as value with no special punctuation except that required by your shell, as
shown in the above examples. For all other type constraints, including list, shown in the above examples. For all other type constraints, including list,
@ -262,7 +262,8 @@ terraform plan -var "name=[\"a\", \"b\", \"c\"]"
Similar constraints apply when setting input variables using environment Similar constraints apply when setting input variables using environment
variables. For more information on the various methods for setting root module variables. For more information on the various methods for setting root module
input variables, see input variables, see
[Assigning Values to Root Module Variables](/language/values/variables#assigning-values-to-root-module-variables). [Assigning Values to Root Module Variables](/docs/language/values/variables.html#assigning-values-to-root-module-variables).
### Resource Targeting ### Resource Targeting
@ -270,7 +271,7 @@ input variables, see
You can use the `-target` option to focus Terraform's attention on only a You can use the `-target` option to focus Terraform's attention on only a
subset of resources. subset of resources.
You can use [resource address syntax](/cli/state/resource-addressing) You can use [resource address syntax](/docs/cli/state/resource-addressing.html)
to specify the constraint. Terraform interprets the resource address as follows: to specify the constraint. Terraform interprets the resource address as follows:
* If the given address identifies one specific resource instance, Terraform * If the given address identifies one specific resource instance, Terraform
@ -295,14 +296,14 @@ that those selections depend on either directly or indirectly.
This targeting capability is provided for exceptional circumstances, such This targeting capability is provided for exceptional circumstances, such
as recovering from mistakes or working around Terraform limitations. It as recovering from mistakes or working around Terraform limitations. It
is _not recommended_ to use `-target` for routine operations, since this can is *not recommended* to use `-target` for routine operations, since this can
lead to undetected configuration drift and confusion about how the true state lead to undetected configuration drift and confusion about how the true state
of resources relates to configuration. of resources relates to configuration.
Instead of using `-target` as a means to operate on isolated portions of very Instead of using `-target` as a means to operate on isolated portions of very
large configurations, prefer instead to break large configurations into large configurations, prefer instead to break large configurations into
several smaller configurations that can each be independently applied. several smaller configurations that can each be independently applied.
[Data sources](/language/data-sources/) can be used to access [Data sources](/docs/language/data-sources/index.html) can be used to access
information about resources created in other configurations, allowing information about resources created in other configurations, allowing
a complex system architecture to be broken down into more manageable parts a complex system architecture to be broken down into more manageable parts
that can be updated independently. that can be updated independently.
@ -338,11 +339,11 @@ The available options are:
This implies `-input=false`, so the configuration must have no unassigned This implies `-input=false`, so the configuration must have no unassigned
variable values to continue. variable values to continue.
[machine-readable-ui]: /internals/machine-readable-ui [machine-readable-ui]: /docs/internals/machine-readable-ui.html
* `-lock=false` - Don't hold a state lock during the operation. This is * `-lock=false` - Don't hold a state lock during the operation. This is
dangerous if others might concurrently run commands against the same dangerous if others might concurrently run commands against the same
workspace. workspace.
* `-lock-timeout=DURATION` - Unless locking is disabled with `-lock=false`, * `-lock-timeout=DURATION` - Unless locking is disabled with `-lock=false`,
instructs Terraform to retry acquiring a lock for a period of time before instructs Terraform to retry acquiring a lock for a period of time before
@ -358,28 +359,28 @@ The available options are:
the planned changes, and to some other Terraform commands that can work with the planned changes, and to some other Terraform commands that can work with
saved plan files. saved plan files.
Terraform will allow any filename for the plan file, but a typical Terraform will allow any filename for the plan file, but a typical
convention is to name it `tfplan`. **Do not** name the file with a suffix convention is to name it `tfplan`. **Do not** name the file with a suffix
that Terraform recognizes as another file format; if you use a `.tf` suffix that Terraform recognizes as another file format; if you use a `.tf` suffix
then Terraform will try to interpret the file as a configuration source then Terraform will try to interpret the file as a configuration source
file, which will then cause syntax errors for subsequent commands. file, which will then cause syntax errors for subsequent commands.
The generated file is not in any standard format intended for consumption The generated file is not in any standard format intended for consumption
by other software, but the file _does_ contain your full configuration, by other software, but the file _does_ contain your full configuration,
all of the values associated with planned changes, and all of the plan all of the values associated with planned changes, and all of the plan
options including the input variables. If your plan includes any sort of options including the input variables. If your plan includes any sort of
sensitive data, even if obscured in Terraform's terminal output, it will sensitive data, even if obscured in Terraform's terminal output, it will
be saved in cleartext in the plan file. You should therefore treat any be saved in cleartext in the plan file. You should therefore treat any
saved plan files as potentially-sensitive artifacts. saved plan files as potentially-sensitive artifacts.
* `-parallelism=n` - Limit the number of concurrent operations as Terraform * `-parallelism=n` - Limit the number of concurrent operations as Terraform
[walks the graph](/internals/graph#walking-the-graph). Defaults [walks the graph](/docs/internals/graph.html#walking-the-graph). Defaults
to 10. to 10.
For configurations using For configurations using
[the `local` backend](/language/settings/backends/local) only, [the `local` backend](/docs/language/settings/backends/local.html) only,
`terraform plan` accepts the legacy command line option `terraform plan` accepts the legacy command line option
[`-state`](/language/settings/backends/local#command-line-arguments). [`-state`](/docs/language/settings/backends/local.html#command-line-arguments).
### Passing a Different Configuration Directory ### Passing a Different Configuration Directory
@ -389,7 +390,7 @@ module instead of the current working directory.
That usage was deprecated in Terraform v0.14 and removed in Terraform v0.15. That usage was deprecated in Terraform v0.14 and removed in Terraform v0.15.
If your workflow relies on overriding the root module directory, use If your workflow relies on overriding the root module directory, use
[the `-chdir` global option](/cli/commands/#switching-working-directory-with-chdir) [the `-chdir` global option](./#switching-working-directory-with-chdir)
instead, which works across all commands and makes Terraform consistently look instead, which works across all commands and makes Terraform consistently look
in the given directory for all files it would normally read or write in the in the given directory for all files it would normally read or write in the
current working directory. current working directory.
@ -397,6 +398,6 @@ current working directory.
If your previous use of this legacy pattern was also relying on Terraform If your previous use of this legacy pattern was also relying on Terraform
writing the `.terraform` subdirectory into the current working directory even writing the `.terraform` subdirectory into the current working directory even
though the root module directory was overridden, use though the root module directory was overridden, use
[the `TF_DATA_DIR` environment variable](/cli/config/environment-variables#tf_data_dir) [the `TF_DATA_DIR` environment variable](/docs/cli/config/environment-variables.html#tf_data_dir)
to direct Terraform to write the `.terraform` directory to a location other to direct Terraform to write the `.terraform` directory to a location other
than the current working directory. than the current working directory.

View File

@ -1,14 +1,14 @@
--- ---
page_title: 'Command: providers' layout: "docs"
description: >- page_title: "Command: providers"
The terraform providers command prints information about the providers sidebar_current: "docs-commands-providers"
required in the current configuration. description: "The terraform providers command prints information about the providers required in the current configuration."
--- ---
# Command: providers # Command: providers
The `terraform providers` command shows information about the The `terraform providers` command shows information about the
[provider requirements](/language/providers/requirements) of the [provider requirements](/docs/language/providers/requirements.html) of the
configuration in the current working directory, as an aid to understanding configuration in the current working directory, as an aid to understanding
where each requirement was detected from. where each requirement was detected from.

View File

@ -1,5 +1,7 @@
--- ---
page_title: 'Command: providers lock' layout: "docs"
page_title: "Command: providers lock"
sidebar_current: "docs-commands-providers-lock"
description: |- description: |-
The `terraform providers lock` command adds new provider selection information The `terraform providers lock` command adds new provider selection information
to the dependency lock file without initializing the referenced providers. to the dependency lock file without initializing the referenced providers.
@ -9,31 +11,31 @@ description: |-
The `terraform providers lock` consults upstream registries (by default) in The `terraform providers lock` consults upstream registries (by default) in
order to write provider dependency information into order to write provider dependency information into
[the dependency lock file](/language/dependency-lock). [the dependency lock file](/docs/language/dependency-lock.html).
The common way to update the dependency lock file is as a side-effect of normal The common way to update the dependency lock file is as a side-effect of normal
provider installation during provider installation during
[`terraform init`](/cli/commands/init), but there are several situations where that [`terraform init`](/docs/cli/commands/init.html), but there are several situations where that
automatic approach may not be sufficient: automatic approach may not be sufficient:
* If you are running Terraform in an environment that uses * If you are running Terraform in an environment that uses
[alternative provider installation methods](/cli/config/config-file#provider-installation), [alternative provider installation methods](/docs/cli/config/config-file.html#provider-installation),
such as filesystem or network mirrors, normal provider installation will not such as filesystem or network mirrors, normal provider installation will not
access the origin registry for a provider and therefore Terraform will not access the origin registry for a provider and therefore Terraform will not
be able to populate all of the possible package checksums for the selected be able to populate all of the possible package checksums for the selected
provider versions. provider versions.
If you use `terraform lock` to write the official release checksums for a If you use `terraform lock` to write the official release checksums for a
provider into the dependency lock file then future `terraform init` runs provider into the dependency lock file then future `terraform init` runs
will verify the packages available in your selected mirror against the will verify the packages available in your selected mirror against the
official checksums previously recorded, giving additional certainty that official checksums previously recorded, giving additional certainty that
the mirror is serving the provider packages it is claiming to. the mirror is serving the provider packages it is claiming to.
* If your team runs Terraform across a number of different platforms (e.g. * If your team runs Terraform across a number of different platforms (e.g.
on both Windows and Linux) and the upstream registry for a provider is unable on both Windows and Linux) and the upstream registry for a provider is unable
to provide signed checksums using the latest hashing scheme, subsequent runs to provide signed checksums using the latest hashing scheme, subsequent runs
of Terraform on other platforms may of Terraform on other platforms may
[add additional checksums to the lock file](/language/dependency-lock#new-provider-package-checksums). [add additional checksums to the lock file](/docs/language/dependency-lock.html#new-provider-package-checksums).
You can avoid that by pre-populating hashes for all of the platforms you You can avoid that by pre-populating hashes for all of the platforms you
intend to use, using the `terraform providers lock` command. intend to use, using the `terraform providers lock` command.
@ -47,17 +49,17 @@ With no additional command line arguments, `terraform providers lock` will
analyze the configuration in the current working directory to find all of analyze the configuration in the current working directory to find all of
the providers it depends on, and it will fetch the necessary data about those the providers it depends on, and it will fetch the necessary data about those
providers from their origin registries and then update providers from their origin registries and then update
[the dependency lock file](/language/dependency-lock) to [the dependency lock file](/docs/language/dependency-lock.html) to
include a selected version for each provider and all of the package checksums include a selected version for each provider and all of the package checksums
that are covered by the provider developer's cryptographic signature. that are covered by the provider developer's cryptographic signature.
~> **Warning:** The `terraform providers lock` command prints information ~> **Warning:** The `terraform providers lock` command prints information
about what it has fetched and whether each package was signed using a about what it has fetched and whether each package was signed using a
cryptographic signature, but it cannot automatically verify that the cryptographic signature, but it cannot automatically verify that the
providers are trustworthy and that they comply with your local system providers are trustworthy and that they comply with your local system
policies or relevant regulations. Review the signing key information policies or relevant regulations. Review the signing key information
in the output to confirm that you trust all of the signers before committing in the output to confirm that you trust all of the signers before committing
the updated lock file to your version control system. the updated lock file to your version control system.
If you list one or more provider source addresses on the command line then If you list one or more provider source addresses on the command line then
`terraform providers lock` will restrict its work only to those providers, `terraform providers lock` will restrict its work only to those providers,
@ -72,21 +74,21 @@ You can customize the default behavior using the following additional option:
* `-net-mirror=URL` - Direct Terraform to look for provider packages in the * `-net-mirror=URL` - Direct Terraform to look for provider packages in the
given network mirror service, instead of in upstream registries. The given network mirror service, instead of in upstream registries. The
given URL must implement given URL must implement
[the Terraform provider network mirror protocol](/internals/provider-network-mirror-protocol). [the Terraform provider network mirror protocol](/docs/internals/provider-network-mirror-protocol.html).
* `-platform=OS_ARCH` - Specify a platform you intend to use to work with this * `-platform=OS_ARCH` - Specify a platform you intend to use to work with this
Terraform configuration. Terraform will ensure that the providers are all Terraform configuration. Terraform will ensure that the providers are all
available for the given platform and will save enough package checksums in available for the given platform and will save enough package checksums in
the lock file to support _at least_ the specified platforms. the lock file to support _at least_ the specified platforms.
Use this option multiple times to include checksums for multiple target
systems.
Use this option multiple times to include checksums for multiple target Target platform names consist of an operating system and a CPU
systems. architecture. For example, `linux_amd64` selects the Linux operating system
running on an AMD64 or x86_64 CPU.
Target platform names consist of an operating system and a CPU There is more detail on this option in the following section.
architecture. For example, `linux_amd64` selects the Linux operating system
running on an AMD64 or x86_64 CPU.
There is more detail on this option in the following section.
## Specifying Target Platforms ## Specifying Target Platforms
@ -148,7 +150,7 @@ multiple times and specify a different subset of your providers each time.
The `-fs-mirror` and `-net-mirror` options have the same meaning as The `-fs-mirror` and `-net-mirror` options have the same meaning as
`filesystem_mirror` and `network_mirror` blocks in `filesystem_mirror` and `network_mirror` blocks in
[the provider installation methods configuration](/cli/config/config-file#provider-installation), [the provider installation methods configuration](/docs/cli/config/config-file.html#provider-installation),
but specify only a single method in order to be explicit about where you but specify only a single method in order to be explicit about where you
intend to derive the package checksum information from. intend to derive the package checksum information from.
@ -165,4 +167,4 @@ If you wish, you can publish your in-house providers via an in-house provider
registry, which will then allow locking and installation of those providers registry, which will then allow locking and installation of those providers
without any special options or additional CLI configuration. For more without any special options or additional CLI configuration. For more
information, see information, see
[the provider registry protocol](/internals/provider-registry-protocol). [the provider registry protocol](/docs/internals/provider-registry-protocol.html).

View File

@ -1,5 +1,7 @@
--- ---
page_title: 'Command: providers mirror' layout: "docs"
page_title: "Command: providers mirror"
sidebar_current: "docs-commands-providers-mirror"
description: |- description: |-
The `terraform providers mirror` command downloads the providers required The `terraform providers mirror` command downloads the providers required
for the current configuration and copies them into a directory in the local for the current configuration and copies them into a directory in the local
@ -17,7 +19,7 @@ from provider registries as part of initializing the current working directory.
Sometimes Terraform is running in an environment where that isn't possible, Sometimes Terraform is running in an environment where that isn't possible,
such as on an isolated network without access to the Terraform Registry. In such as on an isolated network without access to the Terraform Registry. In
that case, that case,
[explicit installation method configuration](/cli/config/config-file#explicit-installation-method-configuration) [explicit installation method configuration](/docs/cli/config/config-file.html#explicit-installation-method-configuration)
allows you to configure Terraform, when running on a particular system, to allows you to configure Terraform, when running on a particular system, to
consult only a local filesystem directory where you've created a local mirror consult only a local filesystem directory where you've created a local mirror
of the necessary plugins, and to skip accessing the upstream registry at all. of the necessary plugins, and to skip accessing the upstream registry at all.
@ -39,7 +41,7 @@ themselves.
Terraform will also generate various `.json` index files which contain suitable Terraform will also generate various `.json` index files which contain suitable
responses to implement responses to implement
[the network mirror protocol](/internals/provider-network-mirror-protocol), [the network mirror protocol](/docs/internals/provider-network-mirror-protocol.html),
if you upload the resulting directory to a static website host. Terraform if you upload the resulting directory to a static website host. Terraform
ignores those index files when using the directory as a filesystem mirror, ignores those index files when using the directory as a filesystem mirror,
because the directory entries themselves are authoritative in that case. because the directory entries themselves are authoritative in that case.

View File

@ -1,9 +1,9 @@
--- ---
page_title: 'Command: providers schema' layout: "docs"
description: >- page_title: "Command: providers schema"
The `terraform providers schema` command prints detailed schemas for the sidebar_current: "docs-commands-providers-schema"
providers used description: |-
The `terraform providers schema` command prints detailed schemas for the providers used
in the current configuration. in the current configuration.
--- ---
@ -19,7 +19,7 @@ Usage: `terraform providers schema [options]`
The list of available flags are: The list of available flags are:
- `-json` - Displays the schemas in a machine-readable, JSON format. * `-json` - Displays the schemas in a machine-readable, JSON format.
Please note that, at this time, the `-json` flag is a _required_ option. In future releases, this command will be extended to allow for additional options. Please note that, at this time, the `-json` flag is a _required_ option. In future releases, this command will be extended to allow for additional options.
@ -34,7 +34,7 @@ value `"1.0"`. The semantics of this version are:
version. version.
We will introduce new major versions only within the bounds of We will introduce new major versions only within the bounds of
[the Terraform 1.0 Compatibility Promises](/language/v1-compatibility-promises). [the Terraform 1.0 Compatibility Promises](https://www.terraform.io/docs/language/v1-compatibility-promises.html).
## Format Summary ## Format Summary

View File

@ -1,14 +1,16 @@
--- ---
page_title: 'Command: push' layout: "docs"
description: >- page_title: "Command: push"
DISCONTINUED. Terraform Cloud and the modern "remote" backend have replaced sidebar_current: "docs-commands-push"
the old `terraform push` command. description: |-
DISCONTINUED. Terraform Cloud and the modern "remote" backend have replaced the old `terraform push` command.
--- ---
# Command: push # Command: push
!> **Important:** The `terraform push` command is no longer functional. Its functionality was replaced and surpassed by [the `remote` backend](/language/settings/backends/remote), which works with current versions of Terraform Cloud. The `remote` backend allows you to run remote operations directly from the command line, and displays real-time output from the remote run environment. !> **Important:** The `terraform push` command is no longer functional. Its functionality was replaced and surpassed by [the `remote` backend](/docs/language/settings/backends/remote.html), which works with current versions of Terraform Cloud. The `remote` backend allows you to run remote operations directly from the command line, and displays real-time output from the remote run environment.
The `terraform push` command was an early implementation of remote Terraform runs. It allowed teams to push a configuration to a remote run environment in a discontinued version of Terraform Enterprise. The `terraform push` command was an early implementation of remote Terraform runs. It allowed teams to push a configuration to a remote run environment in a discontinued version of Terraform Enterprise.
The legacy Terraform Enterprise version that supported `terraform push` is no longer available, and there are no remaining instances of that version in operation. Without a service to push to, the command is now completely non-functional. The legacy Terraform Enterprise version that supported `terraform push` is no longer available, and there are no remaining instances of that version in operation. Without a service to push to, the command is now completely non-functional.

View File

@ -1,5 +1,7 @@
--- ---
page_title: 'Command: refresh' layout: "docs"
page_title: "Command: refresh"
sidebar_current: "docs-commands-refresh"
description: |- description: |-
The `terraform refresh` command reads the current settings from all managed The `terraform refresh` command reads the current settings from all managed
remote objects and updates the Terraform state to match. remote objects and updates the Terraform state to match.
@ -12,19 +14,19 @@ description: |-
The `terraform refresh` command reads the current settings from all managed The `terraform refresh` command reads the current settings from all managed
remote objects and updates the Terraform state to match. remote objects and updates the Terraform state to match.
~> _Warning:_ This command is deprecated, because its default behavior is ~> *Warning:* This command is deprecated, because its default behavior is
unsafe if you have misconfigured credentials for any of your providers. unsafe if you have misconfigured credentials for any of your providers.
See below for more information and recommended alternatives. See below for more information and recommended alternatives.
This won't modify your real remote objects, but it will modify the This won't modify your real remote objects, but it will modify the
[Terraform state](/language/state/). [Terraform state](/docs/language/state/).
You shouldn't typically need to use this command, because Terraform You shouldn't typically need to use this command, because Terraform
automatically performs the same refreshing actions as a part of creating automatically performs the same refreshing actions as a part of creating
a plan in both the a plan in both the
[`terraform plan`](/cli/commands/plan) [`terraform plan`](./plan.html)
and and
[`terraform apply`](/cli/commands/apply) [`terraform apply`](./apply.html)
commands. This command is here primarily for backward compatibility, but commands. This command is here primarily for backward compatibility, but
we don't recommend using it because it provides no opportunity to review we don't recommend using it because it provides no opportunity to review
the effects of the operation before updating the state. the effects of the operation before updating the state.
@ -40,7 +42,7 @@ terraform apply -refresh-only -auto-approve
``` ```
Consequently, it supports all of the same options as Consequently, it supports all of the same options as
[`terraform apply`](/cli/commands/apply) except that it does not accept a saved [`terraform apply`](./apply.html) except that it does not accept a saved
plan file, it doesn't allow selecting a planning mode other than "refresh only", plan file, it doesn't allow selecting a planning mode other than "refresh only",
and `-auto-approve` is always enabled. and `-auto-approve` is always enabled.

View File

@ -1,10 +1,9 @@
--- ---
page_title: 'Command: show' layout: "docs"
description: >- page_title: "Command: show"
The `terraform show` command is used to provide human-readable output from a sidebar_current: "docs-commands-show"
state or plan file. This can be used to inspect a plan to ensure that the description: |-
planned operations are expected, or to inspect the current state as Terraform The `terraform show` command is used to provide human-readable output from a state or plan file. This can be used to inspect a plan to ensure that the planned operations are expected, or to inspect the current state as Terraform sees it.
sees it.
--- ---
# Command: show # Command: show
@ -19,7 +18,7 @@ flag.
-> **Note:** When using the `-json` command-line flag, any sensitive values in -> **Note:** When using the `-json` command-line flag, any sensitive values in
Terraform state will be displayed in plain text. For more information, see Terraform state will be displayed in plain text. For more information, see
[Sensitive Data in State](/language/state/sensitive-data). [Sensitive Data in State](/docs/language/state/sensitive-data.html).
## JSON Output ## JSON Output
@ -35,7 +34,7 @@ was written, the state needs to be upgraded before it can be displayed with
`-refresh=false`. If you are viewing a state file, run `terraform refresh` `-refresh=false`. If you are viewing a state file, run `terraform refresh`
first. first.
The output format is covered in detail in [JSON Output Format](/internals/json-format). The output format is covered in detail in [JSON Output Format](/docs/internals/json-format.html).
## Usage ## Usage

View File

@ -1,13 +1,16 @@
--- ---
page_title: 'Command: state' layout: "docs"
description: The `terraform state` command is used for advanced state management. page_title: "Command: state"
sidebar_current: "docs-commands-state-index"
description: |-
The `terraform state` command is used for advanced state management.
--- ---
# State Command # State Command
The `terraform state` command is used for advanced state management. The `terraform state` command is used for advanced state management.
As your Terraform usage becomes more advanced, there are some cases where As your Terraform usage becomes more advanced, there are some cases where
you may need to modify the [Terraform state](/language/state/). you may need to modify the [Terraform state](/docs/language/state/index.html).
Rather than modify the state directly, the `terraform state` commands can Rather than modify the state directly, the `terraform state` commands can
be used in many cases instead. be used in many cases instead.
@ -32,7 +35,7 @@ written to disk and the CLI usage is the same as if it were local state.
All `terraform state` subcommands that modify the state write backup All `terraform state` subcommands that modify the state write backup
files. The path of these backup file can be controlled with `-backup`. files. The path of these backup file can be controlled with `-backup`.
Subcommands that are read-only (such as [list](/cli/commands/state/list)) Subcommands that are read-only (such as [list](/docs/cli/commands/state/list.html))
do not write any backup files since they aren't modifying the state. do not write any backup files since they aren't modifying the state.
Note that backups for state modification _can not be disabled_. Due to Note that backups for state modification _can not be disabled_. Due to

View File

@ -1,14 +1,15 @@
--- ---
page_title: 'Command: state list' layout: "docs"
description: >- page_title: "Command: state list"
The terraform state list command is used to list resources within a Terraform sidebar_current: "docs-commands-state-sub-list"
state. description: |-
The terraform state list command is used to list resources within a Terraform state.
--- ---
# Command: state list # Command: state list
The `terraform state list` command is used to list resources within a The `terraform state list` command is used to list resources within a
[Terraform state](/language/state/). [Terraform state](/docs/language/state/index.html).
## Usage ## Usage
@ -24,12 +25,12 @@ within modules are listed last.
For complex infrastructures, the state can contain thousands of resources. For complex infrastructures, the state can contain thousands of resources.
To filter these, provide one or more patterns to the command. Patterns are To filter these, provide one or more patterns to the command. Patterns are
in [resource addressing format](/cli/state/resource-addressing). in [resource addressing format](/docs/cli/state/resource-addressing.html).
The command-line flags are all optional. The list of available flags are: The command-line flags are all optional. The list of available flags are:
* `-state=path` - Path to the state file. Defaults to "terraform.tfstate". * `-state=path` - Path to the state file. Defaults to "terraform.tfstate".
Ignored when [remote state](/language/state/remote) is used. Ignored when [remote state](/docs/language/state/remote.html) is used.
* `-id=id` - ID of resources to show. Ignored when unset. * `-id=id` - ID of resources to show. Ignored when unset.
## Example: All Resources ## Example: All Resources

View File

@ -1,13 +1,14 @@
--- ---
page_title: 'Command: state mv' layout: "docs"
description: >- page_title: "Command: state mv"
The `terraform state mv` command changes bindings in Terraform state, sidebar_current: "docs-commands-state-sub-mv"
associating existing remote objects with new resource instances. description: |-
The `terraform state mv` command changes bindings in Terraform state, associating existing remote objects with new resource instances.
--- ---
# Command: state mv # Command: state mv
The main function of [Terraform state](/language/state/) is The main function of [Terraform state](/docs/language/state/index.html) is
to track the bindings between resource instance addresses in your configuration to track the bindings between resource instance addresses in your configuration
and the remote objects they represent. Normally Terraform automatically and the remote objects they represent. Normally Terraform automatically
updates the state in response to actions taken when applying a plan, such as updates the state in response to actions taken when applying a plan, such as
@ -28,7 +29,7 @@ remote objects currently associated with the source to be tracked instead
by the destination. by the destination.
Both the source and destination addresses must use Both the source and destination addresses must use
[resource address syntax](/cli/state/resource-addressing), and [resource address syntax](/docs/cli/state/resource-addressing.html), and
they must both refer to the same kind of object: you can only move a resource they must both refer to the same kind of object: you can only move a resource
instance to another resource instance, a whole module instance to another instance to another resource instance, a whole module instance to another
whole module instance, etc. Furthermore, if you are moving a resource or whole module instance, etc. Furthermore, if you are moving a resource or
@ -44,7 +45,7 @@ object and create a new object at the new address, and so `terraform state mv`
allows you to override that interpretation by pre-emptively attaching the allows you to override that interpretation by pre-emptively attaching the
existing object to the new address in Terraform. existing object to the new address in Terraform.
~> _Warning:_ If you are using Terraform in a collaborative environment, you ~> *Warning:* If you are using Terraform in a collaborative environment, you
must ensure that when you are using `terraform state mv` for a code refactoring must ensure that when you are using `terraform state mv` for a code refactoring
purpose you communicate carefully with your coworkers to ensure that nobody purpose you communicate carefully with your coworkers to ensure that nobody
makes any other changes between your configuration change and your makes any other changes between your configuration change and your
@ -58,8 +59,8 @@ This command also accepts the following options:
address without actually "forgetting" any of them. address without actually "forgetting" any of them.
* `-lock=false` - Don't hold a state lock during the operation. This is * `-lock=false` - Don't hold a state lock during the operation. This is
dangerous if others might concurrently run commands against the same dangerous if others might concurrently run commands against the same
workspace. workspace.
* `-lock-timeout=DURATION` - Unless locking is disabled with `-lock=false`, * `-lock-timeout=DURATION` - Unless locking is disabled with `-lock=false`,
instructs Terraform to retry acquiring a lock for a period of time before instructs Terraform to retry acquiring a lock for a period of time before
@ -67,22 +68,23 @@ This command also accepts the following options:
unit letter, such as "3s" for three seconds. unit letter, such as "3s" for three seconds.
For configurations using For configurations using
[the `remote` backend](/language/settings/backends/remote) [the `remote` backend](/docs/language/settings/backends/remote.html)
only, `terraform state mv` only, `terraform state mv`
also accepts the option also accepts the option
[`-ignore-remote-version`](/language/settings/backends/remote#command-line-arguments). [`-ignore-remote-version`](/docs/language/settings/backends/remote.html#command-line-arguments).
The legacy options [`-backup` and `-backup-out`](/language/settings/backends/local#command-line-arguments) The legacy options [`-backup` and `-backup-out`](/docs/language/settings/backends/local.html#command-line-arguments)
operate on a local state file only. Configurations using operate on a local state file only. Configurations using
[the `remote` backend](/language/settings/backends/remote) [the `remote` backend](/docs/language/settings/backends/remote.html)
must specify a local state file with the [`-state`](/language/settings/backends/local#command-line-arguments) must specify a local state file with the [`-state`](/docs/language/settings/backends/local.html#command-line-arguments)
option in order to use the [`-backup` and `-backup-out`](/language/settings/backends/local#command-line-arguments) option in order to use the [`-backup` and `-backup-out`](/docs/language/settings/backends/local.html#command-line-arguments)
options. options.
For configurations using For configurations using
[the `local` state mv](/language/settings/backends/local) only, [the `local` state mv](/docs/language/settings/backends/local.html) only,
`terraform state mv` also accepts the legacy options `terraform state mv` also accepts the legacy options
[`-state`, `-state-out`, `-backup`, and `-backup-out`](/language/settings/backends/local#command-line-arguments). [`-state`, `-state-out`, `-backup`, and `-backup-out`](/docs/language/settings/backends/local.html#command-line-arguments).
## Example: Rename a Resource ## Example: Rename a Resource
@ -134,7 +136,7 @@ terraform state mv module.app module.parent.module.app
## Example: Move a Particular Instance of a Resource using `count` ## Example: Move a Particular Instance of a Resource using `count`
A resource defined with [the `count` meta-argument](/language/meta-arguments/count) A resource defined with [the `count` meta-argument](/docs/language/meta-arguments/count.html)
has multiple instances that are each identified by an integer. You can has multiple instances that are each identified by an integer. You can
select a particular instance by including an explicit index in your given select a particular instance by including an explicit index in your given
address: address:
@ -159,7 +161,7 @@ The above examples show the typical quoting syntax for Unix-style shells.
## Example: Move a Resource configured with for_each ## Example: Move a Resource configured with for_each
A resource defined with [the `for_each` meta-argument](/language/meta-arguments/for_each) A resource defined with [the `for_each` meta-argument](/docs/language/meta-arguments/for_each.html)
has multiple instances that are each identified by an string. You can has multiple instances that are each identified by an string. You can
select a particular instance by including an explicit key in your given select a particular instance by including an explicit key in your given
address. address.

View File

@ -1,14 +1,15 @@
--- ---
page_title: 'Command: state pull' layout: "docs"
description: >- page_title: "Command: state pull"
The `terraform state pull` command is used to manually download and output the sidebar_current: "docs-commands-state-sub-pull"
state from remote state. description: |-
The `terraform state pull` command is used to manually download and output the state from remote state.
--- ---
# Command: state pull # Command: state pull
The `terraform state pull` command is used to manually download and output The `terraform state pull` command is used to manually download and output
the state from [remote state](/language/state/remote). This command also the state from [remote state](/docs/language/state/remote.html). This command also
works with local state. works with local state.
## Usage ## Usage

View File

@ -0,0 +1,50 @@
---
layout: "docs"
page_title: "Command: state push"
sidebar_current: "docs-commands-state-sub-push"
description: |-
The `terraform state push` command pushes items to the Terraform state.
---
# Command: state push
The `terraform state push` command is used to manually upload a local
state file to [remote state](/docs/language/state/remote.html). This command also
works with local state.
This command should rarely be used. It is meant only as a utility in case
manual intervention is necessary with the remote state.
## Usage
Usage: `terraform state push [options] PATH`
This command will push the state specified by PATH to the currently
configured [backend](/docs/language/settings/backends/index.html).
If PATH is "-" then the state data to push is read from stdin. This data
is loaded completely into memory and verified prior to being written to
the destination state.
Terraform will perform a number of safety checks to prevent you from
making changes that appear to be unsafe:
* **Differing lineage**: If the "lineage" value in the state differs,
Terraform will not allow you to push the state. A differing lineage
suggests that the states are completely different and you may lose
data.
* **Higher remote serial**: If the "serial" value in the destination state
is higher than the state being pushed, Terraform will prevent the push.
A higher serial suggests that data is in the destination state that isn't
accounted for in the local state being pushed.
Both of these safety checks can be disabled with the `-force` flag.
**This is not recommended.** If you disable the safety checks and are
pushing state, the destination state will be overwritten.
For configurations using
[the `remote` backend](/docs/language/settings/backends/remote.html)
only, `terraform state push`
also accepts the option
[`-ignore-remote-version`](/docs/language/settings/backends/remote.html#command-line-arguments).

View File

@ -1,47 +0,0 @@
---
page_title: 'Command: state push'
description: The `terraform state push` command pushes items to the Terraform state.
---
# Command: state push
The `terraform state push` command is used to manually upload a local
state file to [remote state](/language/state/remote). This command also
works with local state.
This command should rarely be used. It is meant only as a utility in case
manual intervention is necessary with the remote state.
## Usage
Usage: `terraform state push [options] PATH`
This command will push the state specified by PATH to the currently
configured [backend](/language/settings/backends/).
If PATH is "-" then the state data to push is read from stdin. This data
is loaded completely into memory and verified prior to being written to
the destination state.
Terraform will perform a number of safety checks to prevent you from
making changes that appear to be unsafe:
- **Differing lineage**: If the "lineage" value in the state differs,
Terraform will not allow you to push the state. A differing lineage
suggests that the states are completely different and you may lose
data.
- **Higher remote serial**: If the "serial" value in the destination state
is higher than the state being pushed, Terraform will prevent the push.
A higher serial suggests that data is in the destination state that isn't
accounted for in the local state being pushed.
Both of these safety checks can be disabled with the `-force` flag.
**This is not recommended.** If you disable the safety checks and are
pushing state, the destination state will be overwritten.
For configurations using
[the `remote` backend](/language/settings/backends/remote)
only, `terraform state push`
also accepts the option
[`-ignore-remote-version`](/language/settings/backends/remote#command-line-arguments).

View File

@ -1,14 +1,15 @@
--- ---
page_title: 'Command: state replace-provider' layout: "docs"
description: >- page_title: "Command: state replace-provider"
The `terraform state replace-provider` command replaces the provider for sidebar_current: "docs-commands-state-sub-replace-provider"
resources in the Terraform state. description: |-
The `terraform state replace-provider` command replaces the provider for resources in the Terraform state.
--- ---
# Command: state replace-provider # Command: state replace-provider
The `terraform state replace-provider` command is used to replace the provider The `terraform state replace-provider` command is used to replace the provider
for resources in a [Terraform state](/language/state/). for resources in a [Terraform state](/docs/language/state/index.html).
## Usage ## Usage
@ -27,21 +28,22 @@ This command also accepts the following options:
* `-auto-approve` - Skip interactive approval. * `-auto-approve` - Skip interactive approval.
* `-lock=false` - Don't hold a state lock during the operation. This is * `-lock=false` - Don't hold a state lock during the operation. This is
dangerous if others might concurrently run commands against the same dangerous if others might concurrently run commands against the same
workspace. workspace.
* `-lock-timeout=0s` - Duration to retry a state lock. * `-lock-timeout=0s` - Duration to retry a state lock.
For configurations using For configurations using
[the `remote` backend](/language/settings/backends/remote) [the `remote` backend](/docs/language/settings/backends/remote.html)
only, `terraform state replace-provider` only, `terraform state replace-provider`
also accepts the option also accepts the option
[`-ignore-remote-version`](/language/settings/backends/remote#command-line-arguments). [`-ignore-remote-version`](/docs/language/settings/backends/remote.html#command-line-arguments).
For configurations using For configurations using
[the `local` state rm](/language/settings/backends/local) only, [the `local` state rm](/docs/language/settings/backends/local.html) only,
`terraform state replace-provider` also accepts the legacy options `terraform state replace-provider` also accepts the legacy options
[`-state`, `-state-out`, and `-backup`](/language/settings/backends/local#command-line-arguments). [`-state`, `-state-out`, and `-backup`](/docs/language/settings/backends/local.html#command-line-arguments).
## Example ## Example

View File

@ -1,13 +1,14 @@
--- ---
page_title: 'Command: state rm' layout: "docs"
description: >- page_title: "Command: state rm"
The `terraform state rm` command removes bindings from the Terraform state, sidebar_current: "docs-commands-state-sub-rm"
causing Terraform to "forget about" existing objects. description: |-
The `terraform state rm` command removes bindings from the Terraform state, causing Terraform to "forget about" existing objects.
--- ---
# Command: state rm # Command: state rm
The main function of [Terraform state](/language/state/) is The main function of [Terraform state](/docs/language/state/index.html) is
to track the bindings between resource instance addresses in your configuration to track the bindings between resource instance addresses in your configuration
and the remote objects they represent. Normally Terraform automatically and the remote objects they represent. Normally Terraform automatically
updates the state in response to actions taken when applying a plan, such as updates the state in response to actions taken when applying a plan, such as
@ -23,13 +24,13 @@ to exist in the remote system.
Usage: `terraform state rm [options] ADDRESS...` Usage: `terraform state rm [options] ADDRESS...`
Terraform will search the state for any instances matching the given Terraform will search the state for any instances matching the given
[resource address](/cli/state/resource-addressing), and remove [resource address](/docs/cli/state/resource-addressing.html), and remove
the record of each one so that Terraform will no longer be tracking the the record of each one so that Terraform will no longer be tracking the
corresponding remote objects. corresponding remote objects.
This means that although the objects will still continue to exist in the This means that although the objects will still continue to exist in the
remote system, a subsequent remote system, a subsequent
[`terraform plan`](/cli/commands/plan) [`terraform plan`](../plan.html)
will include an action to create a new object for each of the "forgotten" will include an action to create a new object for each of the "forgotten"
instances. Depending on the constraints imposed by the remote system, creating instances. Depending on the constraints imposed by the remote system, creating
those objects might fail if their names or other identifiers conflict with those objects might fail if their names or other identifiers conflict with
@ -41,8 +42,8 @@ This command also accepts the following options:
address without actually "forgetting" any of them. address without actually "forgetting" any of them.
* `-lock=false` - Don't hold a state lock during the operation. This is * `-lock=false` - Don't hold a state lock during the operation. This is
dangerous if others might concurrently run commands against the same dangerous if others might concurrently run commands against the same
workspace. workspace.
* `-lock-timeout=DURATION` - Unless locking is disabled with `-lock=false`, * `-lock-timeout=DURATION` - Unless locking is disabled with `-lock=false`,
instructs Terraform to retry acquiring a lock for a period of time before instructs Terraform to retry acquiring a lock for a period of time before
@ -50,15 +51,15 @@ This command also accepts the following options:
unit letter, such as "3s" for three seconds. unit letter, such as "3s" for three seconds.
For configurations using For configurations using
[the `remote` backend](/language/settings/backends/remote) [the `remote` backend](/docs/language/settings/backends/remote.html)
only, `terraform state rm` only, `terraform state rm`
also accepts the option also accepts the option
[`-ignore-remote-version`](/language/settings/backends/remote#command-line-arguments). [`-ignore-remote-version`](/docs/language/settings/backends/remote.html#command-line-arguments).
For configurations using For configurations using
[the `local` state rm](/language/settings/backends/local) only, [the `local` state rm](/docs/language/settings/backends/local.html) only,
`terraform state rm` also accepts the legacy options `terraform state rm` also accepts the legacy options
[`-state`, `-state-out`, and `-backup`](/language/settings/backends/local#command-line-arguments). [`-state`, `-state-out`, and `-backup`](/docs/language/settings/backends/local.html#command-line-arguments).
## Example: Remove all Instances of a Resource ## Example: Remove all Instances of a Resource
@ -93,7 +94,7 @@ $ terraform state rm 'module.foo'
## Example: Remove a Particular Instance of a Resource using `count` ## Example: Remove a Particular Instance of a Resource using `count`
A resource defined with [the `count` meta-argument](/language/meta-arguments/count) A resource defined with [the `count` meta-argument](/docs/language/meta-arguments/count.html)
has multiple instances that are each identified by an integer. You can has multiple instances that are each identified by an integer. You can
select a particular instance by including an explicit index in your given select a particular instance by including an explicit index in your given
address: address:
@ -108,7 +109,7 @@ The above shows the typical quoting syntax for Unix-style shells.
## Example: Remove a Particular Instance of a Resource using `for_each` ## Example: Remove a Particular Instance of a Resource using `for_each`
A resource defined with [the `for_each` meta-argument](/language/meta-arguments/for_each) A resource defined with [the `for_each` meta-argument](/docs/language/meta-arguments/for_each.html)
has multiple instances that are each identified by an string. You can has multiple instances that are each identified by an string. You can
select a particular instance by including an explicit key in your given select a particular instance by including an explicit key in your given
address. address.

View File

@ -1,15 +1,16 @@
--- ---
page_title: 'Command: state show' layout: "docs"
description: >- page_title: "Command: state show"
The `terraform state show` command is used to show the attributes of a single sidebar_current: "docs-commands-state-sub-show"
resource in the Terraform state. description: |-
The `terraform state show` command is used to show the attributes of a single resource in the Terraform state.
--- ---
# Command: state show # Command: state show
The `terraform state show` command is used to show the attributes of a The `terraform state show` command is used to show the attributes of a
single resource in the single resource in the
[Terraform state](/language/state/). [Terraform state](/docs/language/state/index.html).
## Usage ## Usage
@ -20,16 +21,16 @@ state file that matches the given address.
This command requires an address that points to a single resource in the This command requires an address that points to a single resource in the
state. Addresses are state. Addresses are
in [resource addressing format](/cli/state/resource-addressing). in [resource addressing format](/docs/cli/state/resource-addressing.html).
The command-line flags are all optional. The list of available flags are: The command-line flags are all optional. The list of available flags are:
* `-state=path` - Path to the state file. Defaults to "terraform.tfstate". * `-state=path` - Path to the state file. Defaults to "terraform.tfstate".
Ignored when [remote state](/language/state/remote) is used. Ignored when [remote state](/docs/language/state/remote.html) is used.
The output of `terraform state show` is intended for human consumption, not The output of `terraform state show` is intended for human consumption, not
programmatic consumption. To extract state data for use in other software, use programmatic consumption. To extract state data for use in other software, use
[`terraform show -json`](/cli/commands/show#json-output) and decode the result [`terraform show -json`](/docs/cli/commands/show.html#json-output) and decode the result
using the documented structure. using the documented structure.
## Example: Show a Resource ## Example: Show a Resource
@ -60,7 +61,7 @@ $ terraform state show 'module.foo.packet_device.worker'
## Example: Show a Resource configured with count ## Example: Show a Resource configured with count
The example below shows the first instance of a `packet_device` resource named `worker` configured with The example below shows the first instance of a `packet_device` resource named `worker` configured with
[`count`](/language/meta-arguments/count): [`count`](/docs/language/meta-arguments/count.html):
```shell ```shell
$ terraform state show 'packet_device.worker[0]' $ terraform state show 'packet_device.worker[0]'
@ -69,7 +70,7 @@ $ terraform state show 'packet_device.worker[0]'
## Example: Show a Resource configured with for_each ## Example: Show a Resource configured with for_each
The example below shows the `"example"` instance of a `packet_device` resource named `worker` configured with The example below shows the `"example"` instance of a `packet_device` resource named `worker` configured with
[`for_each`](/language/meta-arguments/for_each): [`for_each`](/docs/language/meta-arguments/for_each.html):
Linux, Mac OS, and UNIX: Linux, Mac OS, and UNIX:

View File

@ -1,5 +1,7 @@
--- ---
page_title: 'Command: taint' layout: "docs"
page_title: "Command: taint"
sidebar_current: "docs-commands-taint"
description: |- description: |-
The `terraform taint` command informs Terraform that a particular object The `terraform taint` command informs Terraform that a particular object
is damaged or degraded. is damaged or degraded.
@ -12,12 +14,12 @@ become degraded or damaged. Terraform represents this by marking the
object as "tainted" in the Terraform state, in which case Terraform will object as "tainted" in the Terraform state, in which case Terraform will
propose to replace it in the next plan you create. propose to replace it in the next plan you create.
~> _Warning:_ This command is deprecated, because there are better alternatives ~> *Warning:* This command is deprecated, because there are better alternatives
available in Terraform v0.15.2 and later. See below for more details. available in Terraform v0.15.2 and later. See below for more details.
If your intent is to force replacement of a particular object even though If your intent is to force replacement of a particular object even though
there are no configuration changes that would require it, we recommend instead there are no configuration changes that would require it, we recommend instead
to use the `-replace` option with [`terraform apply`](/cli/commands/apply). to use the `-replace` option with [`terraform apply`](./apply.html).
For example: For example:
``` ```
@ -42,13 +44,13 @@ Usage: `terraform taint [options] address`
The `address` argument is the address of the resource to mark as tainted. The `address` argument is the address of the resource to mark as tainted.
The address is in The address is in
[the resource address syntax](/cli/state/resource-addressing) syntax, [the resource address syntax](/docs/cli/state/resource-addressing.html) syntax,
as shown in the output from other commands, such as: as shown in the output from other commands, such as:
* `aws_instance.foo` * `aws_instance.foo`
* `aws_instance.bar[1]` * `aws_instance.bar[1]`
* `aws_instance.baz[\"key\"]` (quotes in resource addresses must be escaped on the command line, so that they will not be interpreted by your shell) * `aws_instance.baz[\"key\"]` (quotes in resource addresses must be escaped on the command line, so that they will not be interpreted by your shell)
* `module.foo.module.bar.aws_instance.qux` * `module.foo.module.bar.aws_instance.qux`
This command accepts the following options: This command accepts the following options:
@ -66,12 +68,12 @@ This command accepts the following options:
unit letter, such as "3s" for three seconds. unit letter, such as "3s" for three seconds.
For configurations using For configurations using
[the `remote` backend](/language/settings/backends/remote) [the `remote` backend](/docs/language/settings/backends/remote.html)
only, `terraform taint` only, `terraform taint`
also accepts the option also accepts the option
[`-ignore-remote-version`](/language/settings/backends/remote#command-line-arguments). [`-ignore-remote-version`](/docs/language/settings/backends/remote.html#command-line-arguments).
For configurations using For configurations using
[the `local` backend](/language/settings/backends/local) only, [the `local` backend](/docs/language/settings/backends/local.html) only,
`terraform taint` also accepts the legacy options `terraform taint` also accepts the legacy options
[`-state`, `-state-out`, and `-backup`](/language/settings/backends/local#command-line-arguments). [`-state`, `-state-out`, and `-backup`](/docs/language/settings/backends/local.html#command-line-arguments).

View File

@ -1,12 +1,15 @@
--- ---
page_title: 'Command: test' layout: "docs"
description: Part of the ongoing design research for module integration testing. page_title: "Command: test"
sidebar_current: "docs-commands-test"
description: |-
Part of the ongoing design research for module integration testing.
--- ---
# Command: test # Command: test
The `terraform test` command is currently serving as part of The `terraform test` command is currently serving as part of
[the module integration testing experiment](/language/modules/testing-experiment). [the module integration testing experiment](/docs/language/modules/testing-experiment.html).
It's not ready for routine use, but if you'd be interested in trying the It's not ready for routine use, but if you'd be interested in trying the
prototype functionality then we'd love to hear your feedback. See the prototype functionality then we'd love to hear your feedback. See the

View File

@ -1,5 +1,7 @@
--- ---
page_title: 'Command: untaint' layout: "docs"
page_title: "Command: untaint"
sidebar_current: "docs-commands-untaint"
description: |- description: |-
The `terraform untaint` command tells Terraform that an object is functioning The `terraform untaint` command tells Terraform that an object is functioning
correctly, even though its creation failed or it was previously manually correctly, even though its creation failed or it was previously manually
@ -16,7 +18,7 @@ a multi-step "create" action, because Terraform can't be sure that the object
was left in a fully-functional state. was left in a fully-functional state.
You can also manually mark an object as "tainted" using the deprecated command You can also manually mark an object as "tainted" using the deprecated command
[`terraform taint`](/cli/commands/taint), although we no longer recommend that [`terraform taint`](./taint.html), although we no longer recommend that
workflow. workflow.
If Terraform currently considers a particular object as tainted but you've If Terraform currently considers a particular object as tainted but you've
@ -38,7 +40,7 @@ terraform apply -replace="aws_instance.example[0]"
Usage: `terraform untaint [options] address` Usage: `terraform untaint [options] address`
The `address` argument is a [resource address](/cli/state/resource-addressing) The `address` argument is a [resource address](/docs/cli/state/resource-addressing.html)
identifying a particular resource instance which is currently tainted. identifying a particular resource instance which is currently tainted.
This command also accepts the following options: This command also accepts the following options:
@ -49,8 +51,8 @@ This command also accepts the following options:
the state. the state.
* `-lock=false` - Don't hold a state lock during the operation. This is * `-lock=false` - Don't hold a state lock during the operation. This is
dangerous if others might concurrently run commands against the same dangerous if others might concurrently run commands against the same
workspace. workspace.
* `-lock-timeout=DURATION` - Unless locking is disabled with `-lock=false`, * `-lock-timeout=DURATION` - Unless locking is disabled with `-lock=false`,
instructs Terraform to retry acquiring a lock for a period of time before instructs Terraform to retry acquiring a lock for a period of time before
@ -62,12 +64,12 @@ This command also accepts the following options:
rendered by a system that cannot interpret terminal formatting. rendered by a system that cannot interpret terminal formatting.
For configurations using For configurations using
[the `remote` backend](/language/settings/backends/remote) [the `remote` backend](/docs/language/settings/backends/remote.html)
only, `terraform untaint` only, `terraform untaint`
also accepts the option also accepts the option
[`-ignore-remote-version`](/language/settings/backends/remote#command-line-arguments). [`-ignore-remote-version`](/docs/language/settings/backends/remote.html#command-line-arguments).
For configurations using For configurations using
[the `local` backend](/language/settings/backends/local) only, [the `local` backend](/docs/language/settings/backends/local.html) only,
`terraform untaint` also accepts the legacy options `terraform untaint` also accepts the legacy options
[`-state`, `-state-out`, and `-backup`](/language/settings/backends/local#command-line-arguments). [`-state`, `-state-out`, and `-backup`](/docs/language/settings/backends/local.html#command-line-arguments).

View File

@ -1,8 +1,9 @@
--- ---
page_title: 'Command: validate' layout: "docs"
description: >- page_title: "Command: validate"
The `terraform validate` command is used to validate the syntax of the sidebar_current: "docs-commands-validate"
terraform files. description: |-
The `terraform validate` command is used to validate the syntax of the terraform files.
--- ---
# Command: validate # Command: validate
@ -38,11 +39,11 @@ Usage: `terraform validate [options]`
This command accepts the following options: This command accepts the following options:
* `-json` - Produce output in a machine-readable JSON format, suitable for - `-json` - Produce output in a machine-readable JSON format, suitable for
use in text editor integrations and other automated systems. Always disables use in text editor integrations and other automated systems. Always disables
color. color.
* `-no-color` - If specified, output won't contain any color. - `-no-color` - If specified, output won't contain any color.
## JSON Output Format ## JSON Output Format
@ -59,15 +60,15 @@ JSON, which it should then treat as a generic error case.
The output includes a `format_version` key, which as of Terraform 1.1.0 has The output includes a `format_version` key, which as of Terraform 1.1.0 has
value `"1.0"`. The semantics of this version are: value `"1.0"`. The semantics of this version are:
* We will increment the minor version, e.g. `"1.1"`, for backward-compatible - We will increment the minor version, e.g. `"1.1"`, for backward-compatible
changes or additions. Ignore any object properties with unrecognized names to changes or additions. Ignore any object properties with unrecognized names to
remain forward-compatible with future minor versions. remain forward-compatible with future minor versions.
* We will increment the major version, e.g. `"2.0"`, for changes that are not - We will increment the major version, e.g. `"2.0"`, for changes that are not
backward-compatible. Reject any input which reports an unsupported major backward-compatible. Reject any input which reports an unsupported major
version. version.
We will introduce new major versions only within the bounds of We will introduce new major versions only within the bounds of
[the Terraform 1.0 Compatibility Promises](/language/v1-compatibility-promises). [the Terraform 1.0 Compatibility Promises](https://www.terraform.io/docs/language/v1-compatibility-promises.html).
In the normal case, Terraform will print a JSON object to the standard output In the normal case, Terraform will print a JSON object to the standard output
stream. The top-level JSON object will have the following properties: stream. The top-level JSON object will have the following properties:
@ -94,93 +95,93 @@ The nested objects in `diagnostics` have the following properties:
* `severity` (string): A string keyword, currently either `"error"` or * `severity` (string): A string keyword, currently either `"error"` or
`"warning"`, indicating the diagnostic severity. `"warning"`, indicating the diagnostic severity.
The presence of errors causes Terraform to consider a configuration to be The presence of errors causes Terraform to consider a configuration to be
invalid, while warnings are just advice or caveats to the user which do not invalid, while warnings are just advice or caveats to the user which do not
block working with the configuration. Later versions of Terraform may block working with the configuration. Later versions of Terraform may
introduce new severity keywords, so consumers should be prepared to accept introduce new severity keywords, so consumers should be prepared to accept
and ignore severity values they don't understand. and ignore severity values they don't understand.
* `summary` (string): A short description of the nature of the problem that * `summary` (string): A short description of the nature of the problem that
the diagnostic is reporting. the diagnostic is reporting.
In Terraform's usual human-oriented diagnostic messages, the summary serves In Terraform's usual human-oriented diagnostic messages, the summary serves
as a sort of "heading" for the diagnostic, printed after the "Error:" or as a sort of "heading" for the diagnostic, printed after the "Error:" or
"Warning:" indicator. "Warning:" indicator.
Summaries are typically short, single sentences, but can sometimes be longer Summaries are typically short, single sentences, but can sometimes be longer
as a result of returning errors from subsystems that are not designed to as a result of returning errors from subsystems that are not designed to
return full diagnostics, where the entire error message therefore becomes the return full diagnostics, where the entire error message therefore becomes the
summary. In those cases, the summary might include newline characters which summary. In those cases, the summary might include newline characters which
a renderer should honor when presenting the message visually to a user. a renderer should honor when presenting the message visually to a user.
* `detail` (string): An optional additional message giving more detail about * `detail` (string): An optional additional message giving more detail about
the problem. the problem.
In Terraform's usual human-oriented diagnostic messages, the detail provides In Terraform's usual human-oriented diagnostic messages, the detail provides
the paragraphs of text that appear after the heading and the source location the paragraphs of text that appear after the heading and the source location
reference. reference.
Detail messages are often multiple paragraphs and possibly interspersed with Detail messages are often multiple paragraphs and possibly interspersed with
non-paragraph lines, so tools which aim to present detail messages to the non-paragraph lines, so tools which aim to present detail messages to the
user should distinguish between lines without leading spaces, treating them user should distinguish between lines without leading spaces, treating them
as paragraphs, and lines with leading spaces, treating them as preformatted as paragraphs, and lines with leading spaces, treating them as preformatted
text. Renderers should then soft-wrap the paragraphs to fit the width of the text. Renderers should then soft-wrap the paragraphs to fit the width of the
rendering container, but leave the preformatted lines unwrapped. rendering container, but leave the preformatted lines unwrapped.
Some Terraform detail messages currently contain an approximation of bullet Some Terraform detail messages currently contain an approximation of bullet
lists using ASCII characters to mark the bullets. This is not currently a lists using ASCII characters to mark the bullets. This is not currently a
contractural formatting convention and so renderers should avoid depending on contractural formatting convention and so renderers should avoid depending on
it and should instead treat those lines as either paragraphs or preformatted it and should instead treat those lines as either paragraphs or preformatted
text per the rules above. A future version of this format may define some text per the rules above. A future version of this format may define some
additional rules for processing other text conventions, but will do so within additional rules for processing other text conventions, but will do so within
the bounds of the rules above to achieve backward-compatibility. the bounds of the rules above to achieve backward-compatibility.
* `range` (object): An optional object referencing a portion of the configuration * `range` (object): An optional object referencing a portion of the configuration
source code that the diagnostic message relates to. For errors, this will source code that the diagnostic message relates to. For errors, this will
typically indicate the bounds of the specific block header, attribute, or typically indicate the bounds of the specific block header, attribute, or
expression which was detected as invalid. expression which was detected as invalid.
A source range is an object with a property `filename` which gives the A source range is an object with a property `filename` which gives the
filename as a relative path from the current working directory, and then filename as a relative path from the current working directory, and then
two properties `start` and `end` which are both themselves objects two properties `start` and `end` which are both themselves objects
describing source positions, as described below. describing source positions, as described below.
Not all diagnostic messages are connected with specific portions of the Not all diagnostic messages are connected with specific portions of the
configuration, so `range` will be omitted or `null` for diagnostic messages configuration, so `range` will be omitted or `null` for diagnostic messages
where it isn't relevant. where it isn't relevant.
* `snippet` (object): An optional object including an excerpt of the * `snippet` (object): An optional object including an excerpt of the
configuration source code that the diagnostic message relates to. configuration source code that the diagnostic message relates to.
The snippet information includes: The snippet information includes:
* `context` (string): An optional summary of the root context of the * `context` (string): An optional summary of the root context of the
diagnostic. For example, this might be the resource block containing the diagnostic. For example, this might be the resource block containing the
expression which triggered the diagnostic. For some diagnostics this expression which triggered the diagnostic. For some diagnostics this
information is not available, and then this property will be `null`. information is not available, and then this property will be `null`.
* `code` (string): A snippet of Terraform configuration including the * `code` (string): A snippet of Terraform configuration including the
source of the diagnostic. This can be multiple lines and may include source of the diagnostic. This can be multiple lines and may include
additional configuration source code around the expression which additional configuration source code around the expression which
triggered the diagnostic. triggered the diagnostic.
* `start_line` (number): A one-based line count representing the position * `start_line` (number): A one-based line count representing the position
in the source file at which the `code` excerpt begins. This is not in the source file at which the `code` excerpt begins. This is not
necessarily the same value as `range.start.line`, as it is possible for necessarily the same value as `range.start.line`, as it is possible for
`code` to include one or more lines of context before the source of the `code` to include one or more lines of context before the source of the
diagnostic. diagnostic.
* `highlight_start_offset` (number): A zero-based character offset into the * `highlight_start_offset` (number): A zero-based character offset into the
`code` string, pointing at the start of the expression which triggered `code` string, pointing at the start of the expression which triggered
the diagnostic. the diagnostic.
* `highlight_end_offset` (number): A zero-based character offset into the * `highlight_end_offset` (number): A zero-based character offset into the
`code` string, pointing at the end of the expression which triggered the `code` string, pointing at the end of the expression which triggered the
diagnostic. diagnostic.
* `values` (array of objects): Contains zero or more expression values * `values` (array of objects): Contains zero or more expression values
which may be useful in understanding the source of a diagnostic in a which may be useful in understanding the source of a diagnostic in a
complex expression. These expression value objects are described below. complex expression. These expression value objects are described below.
### Source Position ### Source Position

View File

@ -1,8 +1,8 @@
--- ---
page_title: 'Command: version' layout: "docs"
description: >- page_title: "Command: version"
The terraform version command displays the Terraform version and the version sidebar_current: "docs-commands-version"
of all installed plugins. description: "The terraform version command displays the Terraform version and the version of all installed plugins."
--- ---
# Command: version # Command: version
@ -16,12 +16,12 @@ Usage: `terraform version [options]`
With no additional arguments, `version` will display the version of Terraform, With no additional arguments, `version` will display the version of Terraform,
the platform it's installed on, installed providers, and the results of upgrade the platform it's installed on, installed providers, and the results of upgrade
and security checks [unless disabled](/cli/commands/#upgrade-and-security-bulletin-checks). and security checks [unless disabled](/docs/cli/commands/index.html#upgrade-and-security-bulletin-checks).
This command has one optional flag: This command has one optional flag:
* `-json` - If specified, the version information is formatted as a JSON object, * `-json` - If specified, the version information is formatted as a JSON object,
and no upgrade or security information is included. and no upgrade or security information is included.
-> **Note:** Platform information was added to the `version` command in Terraform 0.15. -> **Note:** Platform information was added to the `version` command in Terraform 0.15.
@ -51,4 +51,4 @@ $ terraform version -json
}, },
"terraform_outdated": true "terraform_outdated": true
} }
``` ```

View File

@ -1,6 +1,9 @@
--- ---
page_title: 'Command: workspace delete' layout: "docs"
description: The terraform workspace delete command is used to delete a workspace. page_title: "Command: workspace delete"
sidebar_current: "docs-commands-workspace-sub-delete"
description: |-
The terraform workspace delete command is used to delete a workspace.
--- ---
# Command: workspace delete # Command: workspace delete
@ -28,8 +31,8 @@ The command-line flags are all optional. The only supported flag is:
* `-force` - Delete the workspace even if its state is not empty. Defaults to false. * `-force` - Delete the workspace even if its state is not empty. Defaults to false.
* `-lock=false` - Don't hold a state lock during the operation. This is * `-lock=false` - Don't hold a state lock during the operation. This is
dangerous if others might concurrently run commands against the same dangerous if others might concurrently run commands against the same
workspace. workspace.
* `-lock-timeout=DURATION` - Duration to retry a state lock. Default 0s. * `-lock-timeout=DURATION` - Duration to retry a state lock. Default 0s.
## Example ## Example

View File

@ -1,12 +1,15 @@
--- ---
page_title: 'Command: workspace' layout: "docs"
description: The workspace command helps you manage workspaces. page_title: "Command: workspace"
sidebar_current: "docs-commands-workspace-index"
description: "The workspace command helps you manage workspaces."
--- ---
# Command: workspace # Command: workspace
The `terraform workspace` command is used to manage The `terraform workspace` command is used to manage
[workspaces](/language/state/workspaces). [workspaces](/docs/language/state/workspaces.html).
This command is a container for further subcommands. These subcommands are This command is a container for further subcommands. These subcommands are
listed in the navigation bar. listed in the navigation bar.

View File

@ -1,6 +1,9 @@
--- ---
page_title: 'Command: workspace list' layout: "docs"
description: The terraform workspace list command is used to list all existing workspaces. page_title: "Command: workspace list"
sidebar_current: "docs-commands-workspace-sub-list"
description: |-
The terraform workspace list command is used to list all existing workspaces.
--- ---
# Command: workspace list # Command: workspace list

View File

@ -1,6 +1,9 @@
--- ---
page_title: 'Command: workspace new' layout: "docs"
description: The terraform workspace new command is used to create a new workspace. page_title: "Command: workspace new"
sidebar_current: "docs-commands-workspace-sub-new"
description: |-
The terraform workspace new command is used to create a new workspace.
--- ---
# Command: workspace new # Command: workspace new
@ -20,8 +23,8 @@ will be copied to initialize the state for this new workspace.
The command-line flags are all optional. The supported flags are: The command-line flags are all optional. The supported flags are:
* `-lock=false` - Don't hold a state lock during the operation. This is * `-lock=false` - Don't hold a state lock during the operation. This is
dangerous if others might concurrently run commands against the same dangerous if others might concurrently run commands against the same
workspace. workspace.
* `-lock-timeout=DURATION` - Duration to retry a state lock. Default 0s. * `-lock-timeout=DURATION` - Duration to retry a state lock. Default 0s.
* `-state=path` - Path to an existing state file to initialize the state of this environment. * `-state=path` - Path to an existing state file to initialize the state of this environment.

View File

@ -1,6 +1,9 @@
--- ---
page_title: 'Command: workspace select' layout: "docs"
description: The terraform workspace select command is used to choose a workspace. page_title: "Command: workspace select"
sidebar_current: "docs-commands-workspace-sub-select"
description: |-
The terraform workspace select command is used to choose a workspace.
--- ---
# Command: workspace select # Command: workspace select

View File

@ -1,6 +1,9 @@
--- ---
page_title: 'Command: workspace show' layout: "docs"
description: The terraform workspace show command is used to output the current workspace. page_title: "Command: workspace show"
sidebar_current: "docs-commands-workspace-sub-show"
description: |-
The terraform workspace show command is used to output the current workspace.
--- ---
# Command: workspace show # Command: workspace show

View File

@ -1,15 +1,15 @@
--- ---
page_title: CLI Configuration layout: "docs"
description: >- page_title: "CLI Configuration"
Learn to use the CLI configuration file to customize your CLI settings, sidebar_current: "docs-commands-cli-config"
including credentials, plugin caching, provider installation methods, etc. description: "Learn to use the CLI configuration file to customize your CLI settings, including credentials, plugin caching, provider installation methods, etc."
--- ---
# CLI Configuration File (`.terraformrc` or `terraform.rc`) # CLI Configuration File (`.terraformrc` or `terraform.rc`)
The CLI configuration file configures per-user settings for CLI behaviors, The CLI configuration file configures per-user settings for CLI behaviors,
which apply across all Terraform working directories. This is separate from which apply across all Terraform working directories. This is separate from
[your infrastructure configuration](/language/). [your infrastructure configuration](/docs/language/index.html).
## Locations ## Locations
@ -31,7 +31,7 @@ as just `terraform.rc`. Use `dir` from PowerShell or Command Prompt to
confirm the filename. confirm the filename.
The location of the Terraform CLI configuration file can also be specified The location of the Terraform CLI configuration file can also be specified
using the `TF_CLI_CONFIG_FILE` [environment variable](/cli/config/environment-variables). using the `TF_CLI_CONFIG_FILE` [environment variable](/docs/cli/config/environment-variables.html).
Any such file should follow the naming pattern `*.tfrc`. Any such file should follow the naming pattern `*.tfrc`.
## Configuration File Syntax ## Configuration File Syntax
@ -50,38 +50,38 @@ disable_checkpoint = true
The following settings can be set in the CLI configuration file: The following settings can be set in the CLI configuration file:
* `credentials` - configures credentials for use with Terraform Cloud or - `credentials` - configures credentials for use with Terraform Cloud or
Terraform Enterprise. See [Credentials](#credentials) below for more Terraform Enterprise. See [Credentials](#credentials) below for more
information. information.
* `credentials_helper` - configures an external helper program for the storage - `credentials_helper` - configures an external helper program for the storage
and retrieval of credentials for Terraform Cloud or Terraform Enterprise. and retrieval of credentials for Terraform Cloud or Terraform Enterprise.
See [Credentials Helpers](#credentials-helpers) below for more information. See [Credentials Helpers](#credentials-helpers) below for more information.
* `disable_checkpoint` — when set to `true`, disables - `disable_checkpoint` — when set to `true`, disables
[upgrade and security bulletin checks](/cli/commands/#upgrade-and-security-bulletin-checks) [upgrade and security bulletin checks](/docs/cli/commands/index.html#upgrade-and-security-bulletin-checks)
that require reaching out to HashiCorp-provided network services. that require reaching out to HashiCorp-provided network services.
* `disable_checkpoint_signature` — when set to `true`, allows the upgrade and - `disable_checkpoint_signature` — when set to `true`, allows the upgrade and
security bulletin checks described above but disables the use of an anonymous security bulletin checks described above but disables the use of an anonymous
id used to de-duplicate warning messages. id used to de-duplicate warning messages.
* `plugin_cache_dir` — enables - `plugin_cache_dir` — enables
[plugin caching](#provider-plugin-cache) [plugin caching](#provider-plugin-cache)
and specifies, as a string, the location of the plugin cache directory. and specifies, as a string, the location of the plugin cache directory.
* `provider_installation` - customizes the installation methods used by - `provider_installation` - customizes the installation methods used by
`terraform init` when installing provider plugins. See `terraform init` when installing provider plugins. See
[Provider Installation](#provider-installation) below for more information. [Provider Installation](#provider-installation) below for more information.
## Credentials ## Credentials
[Terraform Cloud](/cloud-docs/) provides a number of remote network [Terraform Cloud](/docs/cloud/index.html) provides a number of remote network
services for use with Terraform, and services for use with Terraform, and
[Terraform Enterprise](/enterprise/) allows hosting those [Terraform Enterprise](/docs/enterprise/index.html) allows hosting those
services inside your own infrastructure. For example, these systems offer both services inside your own infrastructure. For example, these systems offer both
[remote operations](/cloud-docs/run/cli) and a [remote operations](/docs/cloud/run/cli.html) and a
[private module registry](/cloud-docs/registry/). [private module registry](/docs/cloud/registry/index.html).
When interacting with Terraform-specific network services, Terraform expects When interacting with Terraform-specific network services, Terraform expects
to find API tokens in CLI configuration files in `credentials` blocks: to find API tokens in CLI configuration files in `credentials` blocks:
@ -92,7 +92,7 @@ credentials "app.terraform.io" {
} }
``` ```
If you are running the Terraform CLI interactively on a computer with a web browser, you can use [the `terraform login` command](/cli/commands/login) If you are running the Terraform CLI interactively on a computer with a web browser, you can use [the `terraform login` command](/docs/cli/commands/login.html)
to get credentials and automatically save them in the CLI configuration. If to get credentials and automatically save them in the CLI configuration. If
not, you can manually write `credentials` blocks. not, you can manually write `credentials` blocks.
@ -104,9 +104,9 @@ giving the API token to use for that host.
~> **Important:** If you are using Terraform Cloud or Terraform Enterprise, ~> **Important:** If you are using Terraform Cloud or Terraform Enterprise,
the token provided must be either a the token provided must be either a
[user token](/cloud-docs/users-teams-organizations/users#api-tokens) [user token](/docs/cloud/users-teams-organizations/users.html#api-tokens)
or a or a
[team token](/cloud-docs/users-teams-organizations/api-tokens#team-api-tokens); [team token](/docs/cloud/users-teams-organizations/api-tokens.html#team-api-tokens);
organization tokens cannot be used for command-line Terraform actions. organization tokens cannot be used for command-line Terraform actions.
-> **Note:** The credentials hostname must match the hostname in your module -> **Note:** The credentials hostname must match the hostname in your module
@ -144,7 +144,7 @@ for a specific hostname by writing a `credentials` block alongside the
Terraform does not include any credentials helpers in the main distribution. Terraform does not include any credentials helpers in the main distribution.
To learn how to write and install your own credentials helpers to integrate To learn how to write and install your own credentials helpers to integrate
with existing in-house credentials management systems, see with existing in-house credentials management systems, see
[the guide to Credentials Helper internals](/internals/credentials-helpers). [the guide to Credentials Helper internals](/docs/internals/credentials-helpers.html).
## Provider Installation ## Provider Installation
@ -216,36 +216,36 @@ The following are the two supported installation method types:
providers. This method requires the additional argument `path` to indicate providers. This method requires the additional argument `path` to indicate
which directory to look in. which directory to look in.
Terraform expects the given directory to contain a nested directory structure Terraform expects the given directory to contain a nested directory structure
where the path segments together provide metadata about the available where the path segments together provide metadata about the available
providers. The following two directory structures are supported: providers. The following two directory structures are supported:
* Packed layout: `HOSTNAME/NAMESPACE/TYPE/terraform-provider-TYPE_VERSION_TARGET.zip` * Packed layout: `HOSTNAME/NAMESPACE/TYPE/terraform-provider-TYPE_VERSION_TARGET.zip`
is the distribution zip file obtained from the provider's origin registry. is the distribution zip file obtained from the provider's origin registry.
* Unpacked layout: `HOSTNAME/NAMESPACE/TYPE/VERSION/TARGET` is a directory * Unpacked layout: `HOSTNAME/NAMESPACE/TYPE/VERSION/TARGET` is a directory
containing the result of extracting the provider's distribution zip file. containing the result of extracting the provider's distribution zip file.
In both layouts, the `VERSION` is a string like `2.0.0` and the `TARGET` In both layouts, the `VERSION` is a string like `2.0.0` and the `TARGET`
specifies a particular target platform using a format like `darwin_amd64`, specifies a particular target platform using a format like `darwin_amd64`,
`linux_arm`, `windows_amd64`, etc. `linux_arm`, `windows_amd64`, etc.
If you use the unpacked layout, Terraform will attempt to create a symbolic If you use the unpacked layout, Terraform will attempt to create a symbolic
link to the mirror directory when installing the provider, rather than link to the mirror directory when installing the provider, rather than
creating a deep copy of the directory. The packed layout prevents this creating a deep copy of the directory. The packed layout prevents this
because Terraform must extract the zip file during installation. because Terraform must extract the zip file during installation.
You can include multiple `filesystem_mirror` blocks in order to specify You can include multiple `filesystem_mirror` blocks in order to specify
several different directories to search. several different directories to search.
* `network_mirror`: consult a particular HTTPS server for copies of providers, * `network_mirror`: consult a particular HTTPS server for copies of providers,
regardless of which registry host they belong to. This method requires the regardless of which registry host they belong to. This method requires the
additional argument `url` to indicate the mirror base URL, which should additional argument `url` to indicate the mirror base URL, which should
use the `https:` scheme and end with a trailing slash. use the `https:` scheme and end with a trailing slash.
Terraform expects the given URL to be a base URL for an implementation of Terraform expects the given URL to be a base URL for an implementation of
[the provider network mirror protocol](/internals/provider-network-mirror-protocol), [the provider network mirror protocol](/docs/internals/provider-network-mirror-protocol.html),
which is designed to be relatively easy to implement using typical static which is designed to be relatively easy to implement using typical static
website hosting mechanisms. website hosting mechanisms.
~> **Warning:** Don't configure `network_mirror` URLs that you do not trust. ~> **Warning:** Don't configure `network_mirror` URLs that you do not trust.
Provider mirror servers are subject to TLS certificate checks to verify Provider mirror servers are subject to TLS certificate checks to verify
@ -402,7 +402,7 @@ provider_installation {
With development overrides in effect, the `terraform init` command will still With development overrides in effect, the `terraform init` command will still
attempt to select a suitable published version of your provider to install and attempt to select a suitable published version of your provider to install and
record in record in
[the dependency lock file](/language/dependency-lock) [the dependency lock file](/docs/language/dependency-lock.html)
for future use, but other commands like for future use, but other commands like
`terraform apply` will disregard the lock file's entry for `hashicorp/null` and `terraform apply` will disregard the lock file's entry for `hashicorp/null` and
will use the given directory instead. Once your new changes are included in a will use the given directory instead. Once your new changes are included in a

View File

@ -1,8 +1,8 @@
--- ---
page_title: Environment Variables layout: "docs"
description: >- page_title: "Environment Variables"
Learn to use environment variables to change Terraform's default behavior. sidebar_current: "docs-commands-environment-variables"
Configure log content and output, set variables, and more. description: "Learn to use environment variables to change Terraform's default behavior. Configure log content and output, set variables, and more."
--- ---
# Environment Variables # Environment Variables
@ -27,7 +27,7 @@ To disable, either unset it, or set it to `off`. For example:
export TF_LOG=off export TF_LOG=off
``` ```
For more on debugging Terraform, check out the section on [Debugging](/internals/debugging). For more on debugging Terraform, check out the section on [Debugging](/docs/internals/debugging.html).
## TF_LOG_PATH ## TF_LOG_PATH
@ -37,7 +37,7 @@ This specifies where the log should persist its output to. Note that even when `
export TF_LOG_PATH=./terraform.log export TF_LOG_PATH=./terraform.log
``` ```
For more on debugging Terraform, check out the section on [Debugging](/internals/debugging). For more on debugging Terraform, check out the section on [Debugging](/docs/internals/debugging.html).
## TF_INPUT ## TF_INPUT
@ -58,10 +58,9 @@ export TF_VAR_alist='[1,2,3]'
export TF_VAR_amap='{ foo = "bar", baz = "qux" }' 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](/language/values/variables). For more on how to use `TF_VAR_name` in context, check out the section on [Variable Configuration](/docs/language/values/variables.html).
## TF_CLI_ARGS and TF_CLI_ARGS_name ## TF_CLI_ARGS and TF_CLI_ARGS_name
<a id="tf-cli-args"></a> <a id="tf-cli-args"></a>
The value of `TF_CLI_ARGS` will specify additional arguments to the The value of `TF_CLI_ARGS` will specify additional arguments to the
@ -114,7 +113,8 @@ export TF_WORKSPACE=your_workspace
Using this environment variable is recommended only for non-interactive usage, since in a local shell environment it can be easy to forget the variable is set and apply changes to the wrong state. Using this environment variable is recommended only for non-interactive usage, since in a local shell environment it can be easy to forget the variable is set and apply changes to the wrong state.
For more information regarding workspaces, check out the section on [Using Workspaces](/language/state/workspaces). For more information regarding workspaces, check out the section on [Using Workspaces]
(https://www.terraform.io/docs/language/state/workspaces.html).
## TF_IN_AUTOMATION ## TF_IN_AUTOMATION
@ -145,7 +145,7 @@ export TF_REGISTRY_CLIENT_TIMEOUT=15
## TF_CLI_CONFIG_FILE ## TF_CLI_CONFIG_FILE
The location of the [Terraform CLI configuration file](/cli/config/config-file). The location of the [Terraform CLI configuration file](/docs/cli/config/config-file.html).
```shell ```shell
export TF_CLI_CONFIG_FILE="$HOME/.terraformrc-custom" export TF_CLI_CONFIG_FILE="$HOME/.terraformrc-custom"
@ -159,4 +159,4 @@ If `TF_IGNORE` is set to "trace", Terraform will output debug messages to displa
export TF_IGNORE=trace export TF_IGNORE=trace
``` ```
For more details on `.terraformignore`, please see [Excluding Files from Upload with .terraformignore](/language/settings/backends/remote#excluding-files-from-upload-with-terraformignore). For more details on `.terraformignore`, please see [Excluding Files from Upload with .terraformignore](/docs/language/settings/backends/remote.html#excluding-files-from-upload-with-terraformignore).

View File

@ -1,9 +1,7 @@
--- ---
page_title: CLI Configuration - Terraform CLI layout: "docs"
description: >- page_title: "CLI Configuration - Terraform CLI"
Find documentation about the CLI config file and customizing Terraform description: "Find documentation about the CLI config file and customizing Terraform environment variables."
environment variables.
sidebar_title: CLI Configuration
--- ---
# CLI Configuration # CLI Configuration
@ -17,9 +15,9 @@ most of the global settings relate to advanced or automated workflows, or
unusual environmental conditions like running Terraform on an airgapped unusual environmental conditions like running Terraform on an airgapped
instance. instance.
- The [CLI config file](/cli/config/config-file) configures provider - The [CLI config file](/docs/cli/config/config-file.html) configures provider
installation and security features. installation and security features.
- Several [environment variables](/cli/config/environment-variables) can - Several [environment variables](/docs/cli/config/environment-variables.html) can
configure Terraform's inputs and outputs; this includes some alternate ways to configure Terraform's inputs and outputs; this includes some alternate ways to
provide information that is usually passed on the command line or read from provide information that is usually passed on the command line or read from
the state of the shell. the state of the shell.

View File

@ -1,5 +1,7 @@
--- ---
page_title: 'Import: Resource Importability' layout: "docs"
page_title: "Import: Resource Importability"
sidebar_current: "docs-import-importability"
description: |- description: |-
Each resource in Terraform must implement some basic logic to become Each resource in Terraform must implement some basic logic to become
importable. As a result, not all Terraform resources are currently importable. importable. As a result, not all Terraform resources are currently importable.
@ -19,4 +21,4 @@ you're interested in contributing that functionality, the Terraform team
would be grateful. would be grateful.
To make a resource importable, please see To make a resource importable, please see
[Extending Terraform: Resources — Import](/plugin/sdkv2/resources/import). [Extending Terraform: Resources — Import](/docs/extend/resources/import.html).

View File

@ -1,8 +1,8 @@
--- ---
page_title: Import layout: "docs"
description: >- page_title: "Import"
Terraform can import and manage existing infrastructure. This can help you sidebar_current: "docs-import"
transition your infrastructure to Terraform. description: "Terraform can import and manage existing infrastructure. This can help you transition your infrastructure to Terraform."
--- ---
# Import # Import
@ -23,12 +23,12 @@ itself having created all objects. If you import existing objects into Terraform
be careful to import each remote object to only one Terraform resource address. be careful to import each remote object to only one Terraform resource address.
If you import the same object multiple times, Terraform may exhibit unwanted If you import the same object multiple times, Terraform may exhibit unwanted
behavior. For more information on this assumption, see behavior. For more information on this assumption, see
[the State section](/language/state/). [the State section](/docs/language/state/index.html).
## Currently State Only ## Currently State Only
The current implementation of Terraform import can only import resources The current implementation of Terraform import can only import resources
into the [state](/language/state/). It does not generate configuration. A future into the [state](/docs/language/state/index.html). It does not generate configuration. A future
version of Terraform will also generate configuration. version of Terraform will also generate configuration.
Because of this, prior to running `terraform import` it is necessary to write Because of this, prior to running `terraform import` it is necessary to write
@ -41,7 +41,7 @@ importing existing resources.
## Remote Backends ## Remote Backends
When using Terraform import on the command line with a [remote When using Terraform import on the command line with a [remote
backend](/language/settings/backends/remote), such as Terraform Cloud, the import backend](/docs/language/settings/backends/remote.html), such as Terraform Cloud, the import
command runs locally, unlike commands such as apply, which run inside your command runs locally, unlike commands such as apply, which run inside your
Terraform Cloud environment. Because of this, the import command will not have Terraform Cloud environment. Because of this, the import command will not have
access to information from the remote backend, such as workspace variables. access to information from the remote backend, such as workspace variables.

View File

@ -1,6 +1,9 @@
--- ---
page_title: 'Import: Usage' layout: "docs"
description: The `terraform import` command is used to import existing infrastructure. page_title: "Import: Usage"
sidebar_current: "docs-import-usage"
description: |-
The `terraform import` command is used to import existing infrastructure.
--- ---
# Import Usage # Import Usage
@ -20,7 +23,7 @@ itself having created all objects. If you import existing objects into Terraform
be careful to import each remote object to only one Terraform resource address. be careful to import each remote object to only one Terraform resource address.
If you import the same object multiple times, Terraform may exhibit unwanted If you import the same object multiple times, Terraform may exhibit unwanted
behavior. For more information on this assumption, see behavior. For more information on this assumption, see
[the State section](/language/state/). [the State section](/docs/language/state/index.html).
To import a resource, first write a resource block for it in your To import a resource, first write a resource block for it in your
configuration, establishing the name by which it will be known to Terraform: configuration, establishing the name by which it will be known to Terraform:
@ -54,7 +57,7 @@ Terraform state.
It is also possible to import to resources in child modules, using their paths, It is also possible to import to resources in child modules, using their paths,
and to single instances of a resource with `count` or `for_each` set. See and to single instances of a resource with `count` or `for_each` set. See
[_Resource Addressing_](/cli/state/resource-addressing) for more [_Resource Addressing_](/docs/cli/state/resource-addressing.html) for more
details on how to specify a target resource. details on how to specify a target resource.
The syntax of the given ID is dependent on the resource type being imported. The syntax of the given ID is dependent on the resource type being imported.
@ -80,4 +83,4 @@ a `resource` block in configuration for each secondary resource. If this is
not done, Terraform will plan to destroy the imported objects on the next run. not done, Terraform will plan to destroy the imported objects on the next run.
If you want to rename or otherwise move the imported resources, the If you want to rename or otherwise move the imported resources, the
[state management commands](/cli/commands/state/) can be used. [state management commands](/docs/cli/commands/state/index.html) can be used.

View File

@ -1,8 +1,8 @@
--- ---
page_title: Terraform CLI Documentation layout: "docs"
description: >- page_title: "Terraform CLI Documentation"
Learn how to use Terraform's CLI-based workflows. You can use the CLI alone or sidebar_current: "docs-home"
in conjunction with Terraform Cloud or Terraform Enterprise. description: "Learn how to use Terraform's CLI-based workflows. You can use the CLI alone or in conjunction with Terraform Cloud or Terraform Enterprise."
--- ---
# Terraform CLI Documentation # Terraform CLI Documentation
@ -16,4 +16,4 @@ Cloud or Terraform Enterprise.
Notably, this documentation does not cover the syntax and usage of the Terraform Notably, this documentation does not cover the syntax and usage of the Terraform
language. For that, see the language. For that, see the
[Terraform Language Documentation](/language/). [Terraform Language Documentation](/docs/language/index.html).

View File

@ -1,17 +1,14 @@
--- ---
page_title: Initializing Working Directories - Terraform CLI layout: "docs"
description: >- page_title: "Initializing Working Directories - Terraform CLI"
Working directories contain configurations, settings, cached plugins and description: "Working directories contain configurations, settings, cached plugins and modules, and state data. Learn how to initialize and manage working directories."
modules, and state data. Learn how to initialize and manage working
directories.
sidebar_title: Initializing Working Directories
--- ---
# Initializing Working Directories # Initializing Working Directories
Terraform expects to be invoked from a working directory that contains Terraform expects to be invoked from a working directory that contains
configuration files written in configuration files written in
[the Terraform language](/language/). Terraform uses [the Terraform language](/docs/language/index.html). Terraform uses
configuration content from this directory, and also uses the directory to store configuration content from this directory, and also uses the directory to store
settings, cached plugins and modules, and sometimes state data. settings, cached plugins and modules, and sometimes state data.
@ -26,7 +23,7 @@ A Terraform working directory typically contains:
configuration is expected to change over time. configuration is expected to change over time.
- A hidden `.terraform` directory, which Terraform uses to manage cached - A hidden `.terraform` directory, which Terraform uses to manage cached
provider plugins and modules, record which provider plugins and modules, record which
[workspace](/cli/workspaces/) is currently active, and [workspace](/docs/cli/workspaces/index.html) is currently active, and
record the last known backend configuration in case it needs to migrate state record the last known backend configuration in case it needs to migrate state
on the next run. This directory is automatically managed by Terraform, and is on the next run. This directory is automatically managed by Terraform, and is
created during initialization. created during initialization.
@ -51,7 +48,7 @@ plugins, and downloading modules. Under some conditions (usually when changing
from one backend to another), it might ask the user for guidance or from one backend to another), it might ask the user for guidance or
confirmation. confirmation.
For details, see [the `terraform init` command](/cli/commands/init). For details, see [the `terraform init` command](/docs/cli/commands/init.html).
## Reinitialization ## Reinitialization

View File

@ -1,9 +1,7 @@
--- ---
page_title: Inspecting Infrastructure - Terraform CLI layout: "docs"
description: >- page_title: "Inspecting Infrastructure - Terraform CLI"
Learn commands to inspect dependency information, outputs, etc. Use them for description: "Learn commands to inspect dependency information, outputs, etc. Use them for integration or to understand your infrastructure."
integration or to understand your infrastructure.
sidebar_title: Inspecting Infrastructure
--- ---
# Inspecting Infrastructure # Inspecting Infrastructure
@ -18,19 +16,19 @@ Terraform CLI includes some commands for inspecting or transforming this data.
You can use these to integrate other tools with Terraform's infrastructure data, You can use these to integrate other tools with Terraform's infrastructure data,
or just to gain a deeper or more holistic understanding of your infrastructure. or just to gain a deeper or more holistic understanding of your infrastructure.
- [The `terraform graph` command](/cli/commands/graph) creates a visual - [The `terraform graph` command](/docs/cli/commands/graph.html) creates a visual
representation of a configuration or a set of planned changes. representation of a configuration or a set of planned changes.
- [The `terraform output` command](/cli/commands/output) can get the - [The `terraform output` command](/docs/cli/commands/output.html) can get the
values for the top-level [output values](/language/values/outputs) of values for the top-level [output values](/docs/language/values/outputs.html) of
a configuration, which are often helpful when making use of the infrastructure a configuration, which are often helpful when making use of the infrastructure
Terraform has provisioned. Terraform has provisioned.
- [The `terraform show` command](/cli/commands/show) can generate - [The `terraform show` command](/docs/cli/commands/show.html) can generate
human-readable versions of a state file or plan file, or generate human-readable versions of a state file or plan file, or generate
machine-readable versions that can be integrated with other tools. machine-readable versions that can be integrated with other tools.
- [The `terraform state list` command](/cli/commands/state/list) can list - [The `terraform state list` command](/docs/cli/commands/state/list.html) can list
the resources being managed by the current working directory and workspace, the resources being managed by the current working directory and workspace,
providing a complete or filtered list. providing a complete or filtered list.
- [The `terraform state show` command](/cli/commands/state/show) can print - [The `terraform state show` command](/docs/cli/commands/state/show.html) can print
all of the attributes of a given resource being managed by the current working all of the attributes of a given resource being managed by the current working
directory and workspace, including generated read-only attributes like the directory and workspace, including generated read-only attributes like the
unique ID assigned by the cloud provider. unique ID assigned by the cloud provider.

View File

@ -1,8 +1,9 @@
--- ---
page_title: APT Packages for Debian and Ubuntu layout: "downloads"
description: >- page_title: "APT Packages for Debian and Ubuntu"
The HashiCorp APT repositories contain distribution-specific Terraform sidebar_current: "docs-cli-install-apt"
packages for both Debian and Ubuntu systems. description: |-
The HashiCorp APT repositories contain distribution-specific Terraform packages for both Debian and Ubuntu systems.
--- ---
# APT Packages for Debian and Ubuntu # APT Packages for Debian and Ubuntu
@ -15,7 +16,7 @@ Debian and Ubuntu systems, which allow you to install Terraform using the
`apt install` command or any other APT frontend. `apt install` command or any other APT frontend.
If you are instead using Red Hat Enterprise Linux, CentOS, or Fedora, you If you are instead using Red Hat Enterprise Linux, CentOS, or Fedora, you
might prefer to [install Terraform from our Yum repositories](/cli/install/yum). might prefer to [install Terraform from our Yum repositories](yum.html).
-> **Note:** The APT repositories discussed on this page are generic HashiCorp -> **Note:** The APT repositories discussed on this page are generic HashiCorp
repositories that contain packages for a variety of different HashiCorp repositories that contain packages for a variety of different HashiCorp
@ -66,7 +67,7 @@ architecture, which is also sometimes known as `x86_64`.
There are no official packages available for other architectures, such as There are no official packages available for other architectures, such as
`arm64`. If you wish to use Terraform on a non-`amd64` system, `arm64`. If you wish to use Terraform on a non-`amd64` system,
[download a normal release `.zip` file](/downloads) instead. [download a normal release `.zip` file](/downloads.html) instead.
## Supported Debian and Ubuntu Releases ## Supported Debian and Ubuntu Releases

View File

@ -1,8 +1,9 @@
--- ---
page_title: 'Yum Packages for Red Hat Enterprise Linux, Fedora, and Amazon Linux' layout: "downloads"
description: >- page_title: "Yum Packages for Red Hat Enterprise Linux, Fedora, and Amazon Linux"
The HashiCorp Yum repositories contain distribution-specific Terraform sidebar_current: "docs-cli-install-yum"
packages for Red Hat Enterprise Linux, Fedora, and Amazon Linux systems. description: |-
The HashiCorp Yum repositories contain distribution-specific Terraform packages for Red Hat Enterprise Linux, Fedora, and Amazon Linux systems.
--- ---
# Yum/DNF Packages for RHEL, CentOS, and Fedora # Yum/DNF Packages for RHEL, CentOS, and Fedora
@ -15,7 +16,7 @@ RedHat Enterprise Linux, Fedora, and Amazon Linux systems, which allow you to
install Terraform using the `yum install` or `dnf install` commands. install Terraform using the `yum install` or `dnf install` commands.
If you are instead using Debian or Ubuntu, you If you are instead using Debian or Ubuntu, you
might prefer to [install Terraform from our APT repositories](/cli/install/apt). might prefer to [install Terraform from our APT repositories](apt.html).
-> **Note:** The Yum repositories discussed on this page are generic HashiCorp -> **Note:** The Yum repositories discussed on this page are generic HashiCorp
repositories that contain packages for a variety of different HashiCorp repositories that contain packages for a variety of different HashiCorp
@ -63,7 +64,7 @@ architecture, which is also sometimes known as `amd64`.
There are no official packages available for other architectures, such as There are no official packages available for other architectures, such as
`aarch64`. If you wish to use Terraform on a non-`x86_64` system, `aarch64`. If you wish to use Terraform on a non-`x86_64` system,
[download a normal release `.zip` file](/downloads) instead. [download a normal release `.zip` file](/downloads.html) instead.
## Supported Distribution Releases ## Supported Distribution Releases

View File

@ -1,16 +1,14 @@
--- ---
page_title: Managing Plugins - Terraform CLI layout: "docs"
description: >- page_title: "Managing Plugins - Terraform CLI"
Commands to install, configure, and show information about providers. Also description: "Commands to install, configure, and show information about providers. Also commands to reduce install effort in air-gapped environments."
commands to reduce install effort in air-gapped environments.
sidebar_title: Managing Plugins
--- ---
# Managing Plugins # Managing Plugins
Terraform relies on plugins called "providers" in order to manage various types Terraform relies on plugins called "providers" in order to manage various types
of resources. (For more information about providers, see of resources. (For more information about providers, see
[Providers](/language/providers/) in the Terraform [Providers](/docs/language/providers/index.html) in the Terraform
language docs.) language docs.)
-> **Note:** Providers are currently the only plugin type most Terraform users -> **Note:** Providers are currently the only plugin type most Terraform users
@ -18,8 +16,8 @@ will interact with. Terraform also supports third-party provisioner plugins, but
we discourage their use. we discourage their use.
Terraform downloads and/or installs any providers Terraform downloads and/or installs any providers
[required](/language/providers/requirements) by a configuration [required](/docs/language/providers/requirements.html) by a configuration
when [initializing](/cli/init/) a working directory. By default, when [initializing](/docs/cli/init/index.html) a working directory. By default,
this works without any additional interaction but requires network access to this works without any additional interaction but requires network access to
download providers from their source registry. download providers from their source registry.
@ -33,29 +31,29 @@ environments.
Terraform's configuration file includes options for caching downloaded plugins, Terraform's configuration file includes options for caching downloaded plugins,
or explicitly specifying a local or HTTPS mirror to install plugins from. For or explicitly specifying a local or HTTPS mirror to install plugins from. For
more information, see [CLI Config File](/cli/config/config-file). more information, see [CLI Config File](/docs/cli/config/config-file.html).
## Getting Plugin Information ## Getting Plugin Information
Use the [`terraform providers`](/cli/commands/providers) command to get information Use the [`terraform providers`](/docs/cli/commands/providers.html) command to get information
about the providers required by the current working directory's configuration. about the providers required by the current working directory's configuration.
Use the [`terraform version`](/cli/commands/version) command (or Use the [`terraform version`](/docs/cli/commands/version.html) command (or
`terraform -version`) to show the specific provider versions installed for the `terraform -version`) to show the specific provider versions installed for the
current working directory. current working directory.
Use the [`terraform providers schema`](/cli/commands/providers/schema) command to Use the [`terraform providers schema`](/docs/cli/commands/providers/schema.html) command to
get machine-readable information about the resources and configuration options get machine-readable information about the resources and configuration options
offered by each provider. offered by each provider.
## Managing Plugin Installation ## Managing Plugin Installation
Use the [`terraform providers mirror`](/cli/commands/providers/mirror) command to Use the [`terraform providers mirror`](/docs/cli/commands/providers/mirror.html) command to
download local copies of every provider required by the current working download local copies of every provider required by the current working
directory's configuration. This directory will use the nested directory layout directory's configuration. This directory will use the nested directory layout
that Terraform expects when installing plugins from a local source, so you can that Terraform expects when installing plugins from a local source, so you can
transfer it directly to an airgapped system that runs Terraform. transfer it directly to an airgapped system that runs Terraform.
Use the [`terraform providers lock`](/cli/commands/providers/lock) command Use the [`terraform providers lock`](/docs/cli/commands/providers/lock.html) command
to update the lock file that Terraform uses to ensure predictable runs when to update the lock file that Terraform uses to ensure predictable runs when
using ambiguous provider version constraints. using ambiguous provider version constraints.

View File

@ -1,8 +1,7 @@
--- ---
page_title: Plugin Signing layout: "docs"
description: >- page_title: "Plugin Signing"
Learn about the types of signatures providers can have on the Terraform description: "Learn about the types of signatures providers can have on the Terraform Registry."
Registry.
--- ---
<!-- THIS PAGED IS LINKED TO IN THE CLI --> <!-- THIS PAGED IS LINKED TO IN THE CLI -->
@ -15,11 +14,11 @@ Terraform providers installed from the Registry are cryptographically signed, an
* **Signed by HashiCorp** - are built, signed, and supported by HashiCorp. * **Signed by HashiCorp** - are built, signed, and supported by HashiCorp.
* **Signed by Trusted Partners** - are built, signed, and supported by a third party. HashiCorp has * **Signed by Trusted Partners** - are built, signed, and supported by a third party. HashiCorp has
verified the ownership of the private key and we provide a chain of trust to the CLI to verify this verified the ownership of the private key and we provide a chain of trust to the CLI to verify this
programatically. programatically.
* **Self-signed** - are built, signed, and supported by a third party. HashiCorp does not provide a * **Self-signed** - are built, signed, and supported by a third party. HashiCorp does not provide a
verification or chain of trust for the signature. You may obtain and validate fingerprints manually verification or chain of trust for the signature. You may obtain and validate fingerprints manually
if you want to ensure you are using a binary you can trust. if you want to ensure you are using a binary you can trust.
Terraform does **NOT** support fetching and using unsigned binaries, but you can manually install Terraform does **NOT** support fetching and using unsigned binaries, but you can manually install
unsigned binaries. You should take extreme care when doing so as no programatic authentication is performed. unsigned binaries. You should take extreme care when doing so as no programatic authentication is performed.

View File

@ -1,14 +1,14 @@
--- ---
page_title: Provisioning Infrastructure - Terraform CLI layout: "docs"
description: 'Learn about commands for core provisioning tasks: plan, apply, and destroy.' page_title: "Provisioning Infrastructure - Terraform CLI"
sidebar_title: Provisioning Infrastructure description: "Learn about commands for core provisioning tasks: plan, apply, and destroy."
--- ---
# Provisioning Infrastructure with Terraform # Provisioning Infrastructure with Terraform
Terraform's primary function is to create, modify, and destroy infrastructure Terraform's primary function is to create, modify, and destroy infrastructure
resources to match the desired state described in a resources to match the desired state described in a
[Terraform configuration](/language/). [Terraform configuration](/docs/language/index.html).
When people refer to "running Terraform," they generally mean performing these When people refer to "running Terraform," they generally mean performing these
provisioning actions in order to affect real infrastructure objects. The provisioning actions in order to affect real infrastructure objects. The
@ -17,8 +17,8 @@ actions, but these basic provisioning tasks are the core of Terraform.
Terraform's provisioning workflow relies on three commands: `plan`, `apply`, and Terraform's provisioning workflow relies on three commands: `plan`, `apply`, and
`destroy`. All of these commands require an `destroy`. All of these commands require an
[initialized](/cli/init/) working directory, and all of them act [initialized](/docs/cli/init/index.html) working directory, and all of them act
only upon the currently selected [workspace](/cli/workspaces/). only upon the currently selected [workspace](/docs/cli/workspaces/index.html).
## Planning ## Planning
@ -39,7 +39,7 @@ resulting actions are as expected. However, `terraform plan` can also save its
plan as a runnable artifact, which `terraform apply` can use to carry out those plan as a runnable artifact, which `terraform apply` can use to carry out those
exact changes. exact changes.
For details, see [the `terraform plan` command](/cli/commands/plan). For details, see [the `terraform plan` command](/docs/cli/commands/plan.html).
## Applying ## Applying
@ -55,7 +55,7 @@ running a new plan. You can use this to reliably perform an exact set of
pre-approved changes, even if the configuration or the state of the real pre-approved changes, even if the configuration or the state of the real
infrastructure has changed in the minutes since the original plan was created. infrastructure has changed in the minutes since the original plan was created.
For details, see [the `terraform apply` command](/cli/commands/apply). For details, see [the `terraform apply` command](/docs/cli/commands/apply.html).
## Destroying ## Destroying
@ -69,4 +69,4 @@ and then running an apply, except that it doesn't require editing the
configuration. This is more convenient if you intend to provision similar configuration. This is more convenient if you intend to provision similar
resources at a later date. resources at a later date.
For details, see [the `terraform destroy` command](/cli/commands/destroy). For details, see [the `terraform destroy` command](/docs/cli/commands/destroy.html).

View File

@ -1,16 +1,14 @@
--- ---
page_title: Manipulating State - Terraform CLI layout: "docs"
description: >- page_title: "Manipulating State - Terraform CLI"
State data tracks which real-world object corresponds to each resource. description: "State data tracks which real-world object corresponds to each resource. Inspect state, move or import resources, and more."
Inspect state, move or import resources, and more.
sidebar_title: Manipulating State
--- ---
# Manipulating Terraform State # Manipulating Terraform State
> **Hands-on:** Try the [Manage Resources in Terraform State](https://learn.hashicorp.com/tutorials/terraform/state-cli?utm_source=WEBSITE&utm_medium=WEB_IO&utm_offer=ARTICLE_PAGE&utm_content=DOCS) tutorial on HashiCorp Learn. > **Hands-on:** Try the [Manage Resources in Terraform State](https://learn.hashicorp.com/tutorials/terraform/state-cli?utm_source=WEBSITE&utm_medium=WEB_IO&utm_offer=ARTICLE_PAGE&utm_content=DOCS) tutorial on HashiCorp Learn.
Terraform uses [state data](/language/state/) to remember which Terraform uses [state data](/docs/language/state/index.html) to remember which
real-world object corresponds to each resource in the configuration; real-world object corresponds to each resource in the configuration;
this allows it to modify an existing object when its resource declaration this allows it to modify an existing object when its resource declaration
changes. changes.
@ -22,12 +20,12 @@ infrastructure.
Terraform CLI supports several workflows for interacting with state: Terraform CLI supports several workflows for interacting with state:
- [Inspecting State](/cli/state/inspect) - [Inspecting State](/docs/cli/state/inspect.html)
- [Forcing Re-creation (Tainting)](/cli/state/taint) - [Forcing Re-creation (Tainting)](/docs/cli/state/taint.html)
- [Moving Resources](/cli/state/move) - [Moving Resources](/docs/cli/state/move.html)
- Importing Pre-existing Resources (documented in the - Importing Pre-existing Resources (documented in the
[Importing Infrastructure](/cli/import/) section) [Importing Infrastructure](/docs/cli/import/index.html) section)
- [Disaster Recovery](/cli/state/recover) - [Disaster Recovery](/docs/cli/state/recover.html)
~> **Important:** Modifying state data outside a normal plan or apply can cause ~> **Important:** Modifying state data outside a normal plan or apply can cause
Terraform to lose track of managed resources, which might waste money, annoy Terraform to lose track of managed resources, which might waste money, annoy

View File

@ -1,7 +1,7 @@
--- ---
page_title: Inspecting State - Terraform CLI layout: "docs"
description: Commands that allow you to read and update state. page_title: "Inspecting State - Terraform CLI"
sidebar_title: Inspecting State description: "Commands that allow you to read and update state."
--- ---
# Inspecting State # Inspecting State
@ -9,14 +9,14 @@ sidebar_title: Inspecting State
Terraform includes some commands for reading and updating state without taking Terraform includes some commands for reading and updating state without taking
any other actions. any other actions.
- [The `terraform state list` command](/cli/commands/state/list) - [The `terraform state list` command](/docs/cli/commands/state/list.html)
shows the resource addresses for every resource Terraform knows about in a shows the resource addresses for every resource Terraform knows about in a
configuration, optionally filtered by partial resource address. configuration, optionally filtered by partial resource address.
- [The `terraform state show` command](/cli/commands/state/show) - [The `terraform state show` command](/docs/cli/commands/state/show.html)
displays detailed state data about one resource. displays detailed state data about one resource.
- [The `terraform refresh` command](/cli/commands/refresh) updates - [The `terraform refresh` command](/docs/cli/commands/refresh.html) updates
state data to match the real-world condition of the managed resources. This is state data to match the real-world condition of the managed resources. This is
done automatically during plans and applies, but not when interacting with done automatically during plans and applies, but not when interacting with
state directly. state directly.

View File

@ -1,15 +1,13 @@
--- ---
page_title: Moving Resources - Terraform CLI layout: "docs"
description: >- page_title: "Moving Resources - Terraform CLI"
Commands that allow you to manage the way that resources are tracked in state. description: "Commands that allow you to manage the way that resources are tracked in state. They are helpful when you move or change resources."
They are helpful when you move or change resources.
sidebar_title: Moving Resources
--- ---
# Moving Resources # Moving Resources
Terraform's state associates each real-world object with a configured resource Terraform's state associates each real-world object with a configured resource
at a specific [resource address](/cli/state/resource-addressing). This at a specific [resource address](/docs/cli/state/resource-addressing.html). This
is seamless when changing a resource's attributes, but Terraform will lose track is seamless when changing a resource's attributes, but Terraform will lose track
of a resource if you change its name, move it to a different module, or change of a resource if you change its name, move it to a different module, or change
its provider. its provider.
@ -22,17 +20,17 @@ In cases where it's important to preserve an existing infrastructure object, you
can explicitly tell Terraform to associate it with a different configured can explicitly tell Terraform to associate it with a different configured
resource. resource.
- [The `terraform state mv` command](/cli/commands/state/mv) changes - [The `terraform state mv` command](/docs/cli/commands/state/mv.html) changes
which resource address in your configuration is associated with a particular which resource address in your configuration is associated with a particular
real-world object. Use this to preserve an object when renaming a resource, or real-world object. Use this to preserve an object when renaming a resource, or
when moving a resource into or out of a child module. when moving a resource into or out of a child module.
- [The `terraform state rm` command](/cli/commands/state/rm) tells - [The `terraform state rm` command](/docs/cli/commands/state/rm.html) tells
Terraform to stop managing a resource as part of the current working directory Terraform to stop managing a resource as part of the current working directory
and workspace, _without_ destroying the corresponding real-world object. (You and workspace, _without_ destroying the corresponding real-world object. (You
can later use `terraform import` to start managing that resource in a can later use `terraform import` to start managing that resource in a
different workspace or a different Terraform configuration.) different workspace or a different Terraform configuration.)
- [The `terraform state replace-provider` command](/cli/commands/state/replace-provider) - [The `terraform state replace-provider` command](/docs/cli/commands/state/replace-provider.html)
transfers existing resources to a new provider without requiring them to be transfers existing resources to a new provider without requiring them to be
re-created. re-created.

View File

@ -1,9 +1,7 @@
--- ---
page_title: Recovering from State Disasters - Terraform CLI layout: "docs"
descriptin: >- page_title: "Recovering from State Disasters - Terraform CLI"
Commands that allow you to restore state backups and override Terraform state descriptin: "Commands that allow you to restore state backups and override Terraform state protections."
protections.
sidebar_title: Recovering from State Disasters
--- ---
# Recovering from State Disasters # Recovering from State Disasters
@ -12,7 +10,7 @@ If something has gone horribly wrong (possibly due to accidents when performing
other state manipulation actions), you might need to take drastic actions with other state manipulation actions), you might need to take drastic actions with
your state data. your state data.
- [The `terraform force-unlock` command](/cli/commands/force-unlock) can - [The `terraform force-unlock` command](/docs/cli/commands/force-unlock.html) can
override the protections Terraform uses to prevent two processes from override the protections Terraform uses to prevent two processes from
modifying state at the same time. You might need this if a Terraform process modifying state at the same time. You might need this if a Terraform process
(like a normal apply) is unexpectedly terminated (like by the complete (like a normal apply) is unexpectedly terminated (like by the complete
@ -20,7 +18,8 @@ your state data.
state backend. Do not run this until you are completely certain what happened state backend. Do not run this until you are completely certain what happened
to the process that caused the lock to get stuck. to the process that caused the lock to get stuck.
- [The `terraform state pull` command](/cli/commands/state/pull) and - [The `terraform state pull` command](/docs/cli/commands/state/pull.html) and
[the `terraform state push` command](/cli/commands/state/push) can [the `terraform state push` command](/docs/cli/commands/state/push.html) can
directly read and write entire state files from and to the configured backend. directly read and write entire state files from and to the configured backend.
You might need this for obtaining or restoring a state backup. You might need this for obtaining or restoring a state backup.

View File

@ -1,5 +1,7 @@
--- ---
page_title: 'Internals: Resource Address' layout: "docs"
page_title: "Internals: Resource Address"
sidebar_current: "docs-internals-resource-addressing"
description: |- description: |-
A resource address is a string that identifies zero or more resource A resource address is a string that identifies zero or more resource
instances in your overall configuration. instances in your overall configuration.
@ -30,12 +32,12 @@ A module path addresses a module within the tree of modules. It takes the form:
module.module_name[module index] module.module_name[module index]
``` ```
- `module` - Module keyword indicating a child module (non-root). Multiple `module` * `module` - Module keyword indicating a child module (non-root). Multiple `module`
keywords in a path indicate nesting. keywords in a path indicate nesting.
- `module_name` - User-defined name of the module. * `module_name` - User-defined name of the module.
- `[module index]` - (Optional) [Index](#index-values-for-modules-and-resources) * `[module index]` - (Optional) [Index](#index-values-for-modules-and-resources)
to select an instance from a module call that has multiple instances, to select an instance from a module call that has multiple instances,
surrounded by square bracket characters (`[` and `]`). surrounded by square bracket characters (`[` and `]`).
An address without a resource spec, i.e. `module.foo` applies to every resource within An address without a resource spec, i.e. `module.foo` applies to every resource within
the module if a single module, or all instances of a module if a module has multiple instances. the module if a single module, or all instances of a module if a module has multiple instances.
@ -62,11 +64,11 @@ It has the following syntax:
resource_type.resource_name[instance index] resource_type.resource_name[instance index]
``` ```
- `resource_type` - Type of the resource being addressed. * `resource_type` - Type of the resource being addressed.
- `resource_name` - User-defined name of the resource. * `resource_name` - User-defined name of the resource.
- `[instance index]` - (Optional) [Index](#index-values-for-modules-and-resources) * `[instance index]` - (Optional) [Index](#index-values-for-modules-and-resources)
to select an instance from a resource that has multiple instances, to select an instance from a resource that has multiple instances,
surrounded by square bracket characters (`[` and `]`). surrounded by square bracket characters (`[` and `]`).
-> In Terraform v0.12 and later, a resource spec without a module path prefix -> In Terraform v0.12 and later, a resource spec without a module path prefix
matches only resources in the root module. In earlier versions, a resource spec matches only resources in the root module. In earlier versions, a resource spec
@ -77,12 +79,12 @@ in any descendent module.
The following specifications apply to index values on modules and resources with multiple instances: The following specifications apply to index values on modules and resources with multiple instances:
- `[N]` where `N` is a `0`-based numerical index into a resource with multiple * `[N]` where `N` is a `0`-based numerical index into a resource with multiple
instances specified by the `count` meta-argument. Omitting an index when instances specified by the `count` meta-argument. Omitting an index when
addressing a resource where `count > 1` means that the address references addressing a resource where `count > 1` means that the address references
all instances. all instances.
- `["INDEX"]` where `INDEX` is a alphanumerical key index into a resource with * `["INDEX"]` where `INDEX` is a alphanumerical key index into a resource with
multiple instances specified by the `for_each` meta-argument. multiple instances specified by the `for_each` meta-argument.
## Examples ## Examples

View File

@ -1,7 +1,7 @@
--- ---
page_title: Forcing Re-creation of Resources (Tainting) - Terraform CLI layout: "docs"
description: Commands that allow you to destroy and re-create resources manually. page_title: "Forcing Re-creation of Resources (Tainting) - Terraform CLI"
sidebar_title: Forcing Re-creation of Resources (Tainting) description: "Commands that allow you to destroy and re-create resources manually."
--- ---
# Forcing Re-creation of Resources (Tainting) # Forcing Re-creation of Resources (Tainting)
@ -17,10 +17,10 @@ happen during creation; for example, a virtual machine that configures itself
with `cloud-init` on startup might no longer meet your needs if the cloud-init with `cloud-init` on startup might no longer meet your needs if the cloud-init
configuration changes. configuration changes.
- [The `terraform taint` command](/cli/commands/taint) tells Terraform to - [The `terraform taint` command](/docs/cli/commands/taint.html) tells Terraform to
destroy and re-create a particular resource during the next apply, regardless destroy and re-create a particular resource during the next apply, regardless
of whether its resource arguments would normally require that. of whether its resource arguments would normally require that.
- [The `terraform untaint` command](/cli/commands/untaint) undoes a - [The `terraform untaint` command](/docs/cli/commands/untaint.html) undoes a
previous taint, or can preserve a resource that was automatically tainted due previous taint, or can preserve a resource that was automatically tainted due
to failed [provisioners](/language/resources/provisioners/syntax). to failed [provisioners](/docs/language/resources/provisioners/syntax.html).

View File

@ -1,30 +1,28 @@
--- ---
page_title: Managing Workspaces - Terraform CLI layout: "docs"
description: >- page_title: "Managing Workspaces - Terraform CLI"
Commands to list, select, create, and output workspaces. Workspaces help description: "Commands to list, select, create, and output workspaces. Workspaces help manage different groups of resources with one configuration."
manage different groups of resources with one configuration.
sidebar_title: Managing Workspaces
--- ---
# Managing Workspaces # Managing Workspaces
In Terraform CLI, _workspaces_ are separate instances of In Terraform CLI, _workspaces_ are separate instances of
[state data](/language/state/) that can be used from the same working [state data](/docs/language/state/index.html) that can be used from the same working
directory. You can use workspaces to manage multiple non-overlapping groups of directory. You can use workspaces to manage multiple non-overlapping groups of
resources with the same configuration. resources with the same configuration.
- Every [initialized working directory](/cli/init/) has at least - Every [initialized working directory](/docs/cli/init/index.html) has at least
one workspace. (If you haven't created other workspaces, it is a workspace one workspace. (If you haven't created other workspaces, it is a workspace
named `default`.) named `default`.)
- For a given working directory, only one workspace can be _selected_ at a time. - For a given working directory, only one workspace can be _selected_ at a time.
- Most Terraform commands (including [provisioning](/cli/run/) - Most Terraform commands (including [provisioning](/docs/cli/run/index.html)
and [state manipulation](/cli/state/) commands) only interact and [state manipulation](/docs/cli/state/index.html) commands) only interact
with the currently selected workspace. with the currently selected workspace.
- Use [the `terraform workspace select` command](/cli/commands/workspace/select) - Use [the `terraform workspace select` command](/docs/cli/commands/workspace/select.html)
to change the currently selected workspace. to change the currently selected workspace.
- Use the [`terraform workspace list`](/cli/commands/workspace/list), - Use the [`terraform workspace list`](/docs/cli/commands/workspace/list.html),
[`terraform workspace new`](/cli/commands/workspace/new), and [`terraform workspace new`](/docs/cli/commands/workspace/new.html), and
[`terraform workspace delete`](/cli/commands/workspace/delete) commands [`terraform workspace delete`](/docs/cli/commands/workspace/delete.html) commands
to manage the available workspaces in the current working directory. to manage the available workspaces in the current working directory.
-> **Note:** Terraform Cloud and Terraform CLI both have features called -> **Note:** Terraform Cloud and Terraform CLI both have features called
@ -37,19 +35,19 @@ Since most of the resources you can manage with Terraform don't include a unique
name as part of their configuration, it's common to use the same Terraform name as part of their configuration, it's common to use the same Terraform
configuration to provision multiple groups of similar resources. configuration to provision multiple groups of similar resources.
Terraform relies on [state](/language/state/) to associate resources with Terraform relies on [state](/docs/language/state/index.html) to associate resources with
real-world objects, so if you run the same configuration multiple times with real-world objects, so if you run the same configuration multiple times with
completely separate state data, Terraform can manage many non-overlapping groups completely separate state data, Terraform can manage many non-overlapping groups
of resources. In some cases you'll want to change of resources. In some cases you'll want to change
[variable values](/language/values/variables) for these different [variable values](/docs/language/values/variables.html) for these different
resource collections (like when specifying differences between staging and resource collections (like when specifying differences between staging and
production deployments), and in other cases you might just want many instances production deployments), and in other cases you might just want many instances
of a particular infrastructure pattern. of a particular infrastructure pattern.
The simplest way to maintain multiple instances of a configuration with The simplest way to maintain multiple instances of a configuration with
completely separate state data is to use multiple completely separate state data is to use multiple
[working directories](/cli/init/) (with different [working directories](/docs/cli/init/index.html) (with different
[backend](/language/settings/backends/configuration) configurations per directory, if you [backend](/docs/language/settings/backends/configuration.html) configurations per directory, if you
aren't using the default `local` backend). aren't using the default `local` backend).
However, this isn't always the most _convenient_ way to handle separate states. However, this isn't always the most _convenient_ way to handle separate states.
@ -73,9 +71,9 @@ data, run history, and settings.
These two kinds of workspaces are different, but related. When using Terraform These two kinds of workspaces are different, but related. When using Terraform
CLI as a frontend for Terraform Cloud, you associate the current working CLI as a frontend for Terraform Cloud, you associate the current working
directory with one or more remote workspaces by configuring directory with one or more remote workspaces by configuring
[the `remote` backend](/language/settings/backends/remote). If you associate the [the `remote` backend](/docs/language/settings/backends/remote.html). If you associate the
directory with multiple workspaces (using a name prefix), you can use the directory with multiple workspaces (using a name prefix), you can use the
`terraform workspace` commands to select which remote workspace to use. `terraform workspace` commands to select which remote workspace to use.
For more information about using Terraform CLI with Terraform Cloud, see For more information about using Terraform CLI with Terraform Cloud, see
[CLI-driven Runs](/cloud-docs/run/cli) in the Terraform Cloud docs. [CLI-driven Runs](/docs/cloud/run/cli.html) in the Terraform Cloud docs.

View File

@ -0,0 +1,157 @@
---
layout: "language"
page_title: "Expressions Landing Page - Configuration Language"
sidebar_current: "docs-config-expressions"
---
# Expressions Landing Page
To improve navigation, we've split the old Expressions page into several smaller
pages.
<a id="types-and-values"></a>
<a id="advanced-type-details"></a>
<a id="type-conversion"></a>
<a id="literal-expressions"></a>
<a id="indices-and-attributes"></a>
## Types and Values, Literal Expressions, Indices and Attributes
Terraform's types are `string`, `number`, `bool`, `list`, `tuple`, `map`,
`object`, and `null`.
This information has moved to
[Types and Values](/docs/language/expressions/types.html).
<div style="height: 30vh; margin: 0; padding: 0;"></div>
<a id="references-to-named-values"></a>
<a id="local-named-values"></a>
<a id="named-values-and-dependencies"></a>
<a id="references-to-resource-attributes"></a>
<a id="local-named-values-1"></a>
<a id="values-not-yet-known"></a>
## References to Named Values (Resource Attributes, Variables, etc.)
You can refer to certain values by name, like `var.some_variable` or
`aws_instance.example.ami`.
This information has moved to
[References to Values](/docs/language/expressions/references.html).
<div style="height: 30vh; margin: 0; padding: 0;"></div>
<a id="arithmetic-operators"></a>
<a id="equality-operators"></a>
<a id="comparison-operators"></a>
<a id="logical-operators"></a>
## Arithmetic and Logical Operators
Operators are expressions that transform other expressions, like adding two
numbers (`+`) or comparing two values to get a bool (`==`, `>=`, etc.).
This information has moved to
[Operators](/docs/language/expressions/operators.html).
<div style="height: 30vh; margin: 0; padding: 0;"></div>
## Conditional Expressions
The `condition ? true_val : false_val` expression chooses between two
expressions based on a bool condition.
This information has moved to
[Conditional Expressions](/docs/language/expressions/conditionals.html).
<div style="height: 30vh; margin: 0; padding: 0;"></div>
<a id="expanding-function-arguments"></a>
<a id="available-functions"></a>
## Function Calls
Terraform's functions can be called like `function_name(arg1, arg2)`.
This information has moved to
[Function Calls](/docs/language/expressions/function-calls.html).
<div style="height: 30vh; margin: 0; padding: 0;"></div>
<a id="for-expressions"></a>
## `for` Expressions
Expressions like `[for s in var.list : upper(s)]` can transform a complex type
value into another complex type value.
This information has moved to
[For Expressions](/docs/language/expressions/for.html).
<div style="height: 30vh; margin: 0; padding: 0;"></div>
<a id="splat-expressions"></a>
<a id="legacy-attribute-only-splat-expressions"></a>
## Splat Expressions
Expressions like `var.list[*].id` can extract simpler collections from complex
collections.
This information has moved to
[Splat Expressions](/docs/language/expressions/splat.html).
<div style="height: 30vh; margin: 0; padding: 0;"></div>
<a id="dynamic-blocks"></a>
<a id="best-practices-for-dynamic-blocks"></a>
## `dynamic` Blocks
The special `dynamic` block type serves the same purpose as a `for` expression,
except it creates multiple repeatable nested blocks instead of a complex value.
This information has moved to
[Dynamic Blocks](/docs/language/expressions/dynamic-blocks.html).
<div style="height: 30vh; margin: 0; padding: 0;"></div>
<a id="string-literals"></a>
<a id="string-templates"></a>
<a id="interpolation"></a>
<a id="directives"></a>
## String Literals and String Templates
Strings can be `"double-quoted"` or
```hcl
<<EOT
heredocs
EOT
```
Strings can also include escape sequences like `\n`, interpolation sequences
(`${ ... }`), and template sequences (`%{ ... }`).
This information has moved to
[Strings and Templates](/docs/language/expressions/strings.html).
<div style="height: 30vh; margin: 0; padding: 0;"></div>

View File

@ -1,122 +0,0 @@
---
page_title: Expressions Landing Page - Configuration Language
sidebar_title: Expressions Landing Page
---
# Expressions Landing Page
To improve navigation, we've split the old Expressions page into several smaller
pages.
<a id="types-and-values"></a> <a id="advanced-type-details"></a> <a id="type-conversion"></a> <a id="literal-expressions"></a> <a id="indices-and-attributes"></a>
## Types and Values, Literal Expressions, Indices and Attributes
Terraform's types are `string`, `number`, `bool`, `list`, `tuple`, `map`,
`object`, and `null`.
This information has moved to
[Types and Values](/language/expressions/types).
<div style={{height: '30vh', margin: 0, padding: 0}} />
<a id="references-to-named-values"></a> <a id="local-named-values"></a> <a id="named-values-and-dependencies"></a> <a id="references-to-resource-attributes"></a> <a id="local-named-values-1"></a> <a id="values-not-yet-known"></a>
## References to Named Values (Resource Attributes, Variables, etc.)
You can refer to certain values by name, like `var.some_variable` or
`aws_instance.example.ami`.
This information has moved to
[References to Values](/language/expressions/references).
<div style={{height: '30vh', margin: 0, padding: 0}} />
<a id="arithmetic-operators"></a> <a id="equality-operators"></a> <a id="comparison-operators"></a> <a id="logical-operators"></a>
## Arithmetic and Logical Operators
Operators are expressions that transform other expressions, like adding two
numbers (`+`) or comparing two values to get a bool (`==`, `>=`, etc.).
This information has moved to
[Operators](/language/expressions/operators).
<div style={{height: '30vh', margin: 0, padding: 0}} />
## Conditional Expressions
The `condition ? true_val : false_val` expression chooses between two
expressions based on a bool condition.
This information has moved to
[Conditional Expressions](/language/expressions/conditionals).
<div style={{height: '30vh', margin: 0, padding: 0}} />
<a id="expanding-function-arguments"></a> <a id="available-functions"></a>
## Function Calls
Terraform's functions can be called like `function_name(arg1, arg2)`.
This information has moved to
[Function Calls](/language/expressions/function-calls).
<div style={{height: '30vh', margin: 0, padding: 0}} />
<a id="for-expressions"></a>
## `for` Expressions
Expressions like `[for s in var.list : upper(s)]` can transform a complex type
value into another complex type value.
This information has moved to
[For Expressions](/language/expressions/for).
<div style={{height: '30vh', margin: 0, padding: 0}} />
<a id="splat-expressions"></a> <a id="legacy-attribute-only-splat-expressions"></a>
## Splat Expressions
Expressions like `var.list[*].id` can extract simpler collections from complex
collections.
This information has moved to
[Splat Expressions](/language/expressions/splat).
<div style={{height: '30vh', margin: 0, padding: 0}} />
<a id="dynamic-blocks"></a> <a id="best-practices-for-dynamic-blocks"></a>
## `dynamic` Blocks
The special `dynamic` block type serves the same purpose as a `for` expression,
except it creates multiple repeatable nested blocks instead of a complex value.
This information has moved to
[Dynamic Blocks](/language/expressions/dynamic-blocks).
<div style={{height: '30vh', margin: 0, padding: 0}} />
<a id="string-literals"></a> <a id="string-templates"></a> <a id="interpolation"></a> <a id="directives"></a>
## String Literals and String Templates
Strings can be `"double-quoted"` or
```hcl
<<EOT
heredocs
EOT
```
Strings can also include escape sequences like `\n`, interpolation sequences
(`${ ... }`), and template sequences (`%{ ... }`).
This information has moved to
[Strings and Templates](/language/expressions/strings).
<div style={{height: '30vh', margin: 0, padding: 0}} />

View File

@ -1,5 +0,0 @@
---
page_title: Terraform Configuration
---
# Terraform Configuration

View File

@ -0,0 +1,54 @@
---
layout: "language"
page_title: "Modules Landing Page - Configuration Language"
---
# Modules Landing Page
To improve navigation, we've split the old Modules page into several smaller
pages.
<a id="calling-a-child-module"></a>
<a id="accessing-module-output-values"></a>
<a id="transferring-resource-state-into-modules"></a>
<a id="tainting-resources-within-a-module"></a>
<a id="module-versions"></a>
<a id="other-meta-arguments"></a>
## Syntax and Elements of Module Blocks
This information has moved to
[Module Blocks](/docs/language/modules/syntax.html).
<div style="height: 100vh; margin: 0; padding: 0;"></div>
<a id="multiple-instances-of-a-module"></a>
## Multiple Instances with `count` and `for_each`
This information has moved to
[`count`](/docs/language/meta-arguments/count.html) and
[`for_each`](/docs/language/meta-arguments/for_each.html).
<div style="height: 100vh; margin: 0; padding: 0;"></div>
<a id="providers-within-modules"></a>
<a id="provider-version-constraints-in-modules"></a>
<a id="implicit-provider-inheritance"></a>
<a id="passing-providers-explicitly"></a>
<a id="proxy-configuration-blocks"></a>
<a id="legacy-shared-modules-with-provider-configurations"></a>
## Handling Provider Configurations in Re-usable Modules
This information has moved to
[The `providers` Meta-Argument](/docs/language/meta-arguments/module-providers.html)
(for users of re-usable modules) and
[Providers Within Modules](/docs/language/modules/develop/providers.html)
(for module developers).
<div style="height: 100vh; margin: 0; padding: 0;"></div>

View File

@ -1,40 +0,0 @@
---
page_title: Modules Landing Page - Configuration Language
sidebar_title: Modules Landing Page
---
# Modules Landing Page
To improve navigation, we've split the old Modules page into several smaller
pages.
<a id="calling-a-child-module"></a> <a id="accessing-module-output-values"></a> <a id="transferring-resource-state-into-modules"></a> <a id="tainting-resources-within-a-module"></a> <a id="module-versions"></a> <a id="other-meta-arguments"></a>
## Syntax and Elements of Module Blocks
This information has moved to
[Module Blocks](/language/modules/syntax).
<div style={{height: '100vh', margin: 0, padding: 0}} />
<a id="multiple-instances-of-a-module"></a>
## Multiple Instances with `count` and `for_each`
This information has moved to
[`count`](/language/meta-arguments/count) and
[`for_each`](/language/meta-arguments/for_each).
<div style={{height: '100vh', margin: 0, padding: 0}} />
<a id="providers-within-modules"></a> <a id="provider-version-constraints-in-modules"></a> <a id="implicit-provider-inheritance"></a> <a id="passing-providers-explicitly"></a> <a id="proxy-configuration-blocks"></a> <a id="legacy-shared-modules-with-provider-configurations"></a>
## Handling Provider Configurations in Re-usable Modules
This information has moved to
[The `providers` Meta-Argument](/language/meta-arguments/module-providers)
(for users of re-usable modules) and
[Providers Within Modules](/language/modules/develop/providers)
(for module developers).
<div style={{height: '100vh', margin: 0, padding: 0}} />

View File

@ -0,0 +1,135 @@
---
layout: "language"
page_title: "Resources Landing Page - Configuration Language"
---
# Resources Landing Page
To improve navigation, we've split the old Resources page into several smaller
pages.
<a id="resource-syntax"></a>
<a id="resource-types"></a>
<a id="providers"></a>
<a id="resource-arguments"></a>
<a id="documentation-for-resource-types"></a>
<a id="meta-arguments"></a>
<a id="timeouts"></a>
<a id="operation-timeouts"></a>
## Syntax and Elements of Resource Blocks
This information has moved to
[Resource Blocks](/docs/language/resources/syntax.html).
<div style="height: 100vh; margin: 0; padding: 0;"></div>
<a id="resource-behavior"></a>
<a id="accessing-resource-attributes"></a>
<a id="resource-dependencies"></a>
<a id="local-only-resources"></a>
## Details of Resource Behavior
This information has moved to
[Resource Behavior](/docs/language/resources/behavior.html).
<div style="height: 100vh; margin: 0; padding: 0;"></div>
## Resource Meta-Arguments
Each resource meta-argument has moved to its own page:
- [`depends_on`](/docs/language/meta-arguments/depends_on.html)
- [`count`](/docs/language/meta-arguments/count.html)
- [`for_each`](/docs/language/meta-arguments/for_each.html)
- [`provider`](/docs/language/meta-arguments/resource-provider.html)
- [`lifecycle`](/docs/language/meta-arguments/lifecycle.html)
- [Provisioners](/docs/language/resources/provisioners/index.html)
<div style="height: 100vh; margin: 0; padding: 0;"></div>
<a id="depends_on-explicit-resource-dependencies"></a>
### `depends_on`
This information has moved to
[`depends_on`](/docs/language/meta-arguments/depends_on.html).
<div style="height: 100vh; margin: 0; padding: 0;"></div>
<a id="count-multiple-resource-instances-by-count"></a>
<a id="count-multiple-resource-instances"></a>
<a id="the-count-object"></a>
<a id="count-index"></a>
<a id="referring-to-instances"></a>
<a id="using-expressions-in-count"></a>
<a id="when-to-use-for_each-instead-of-count"></a>
### `count`
This information has moved to
[`count`](/docs/language/meta-arguments/count.html).
<div style="height: 100vh; margin: 0; padding: 0;"></div>
<a id="for_each-multiple-resource-instances-defined-by-a-map-or-set-of-strings"></a>
<a id="the-each-object"></a>
<a id="each-key"></a>
<a id="each-value"></a>
<a id="using-expressions-in-for_each"></a>
<a id="referring-to-instances-1"></a>
<a id="using-sets"></a>
### `for_each`
This information has moved to
[`for_each`](/docs/language/meta-arguments/for_each.html).
<div style="height: 100vh; margin: 0; padding: 0;"></div>
<a id="provider-selecting-a-non-default-provider-configuration"></a>
### `provider`
This information has moved to
[`provider`](/docs/language/meta-arguments/resource-provider.html).
<div style="height: 100vh; margin: 0; padding: 0;"></div>
<a id="lifecycle-lifecycle-customizations"></a>
<a id="prevent_destroy"></a>
<a id="create_before_destroy"></a>
<a id="ignore_changes"></a>
### `lifecycle`
This information has moved to
[`lifecycle`](/docs/language/meta-arguments/lifecycle.html).
<div style="height: 100vh; margin: 0; padding: 0;"></div>
<a id="provisioner-and-connection-resource-provisioners"></a>
### Provisioners
This information has moved to
[Provisioners](/docs/language/resources/provisioners/index.html).
<div style="height: 100vh; margin: 0; padding: 0;"></div>

View File

@ -1,94 +0,0 @@
---
page_title: Resources Landing Page - Configuration Language
sidebar_title: Resources Landing Page
---
# Resources Landing Page
To improve navigation, we've split the old Resources page into several smaller
pages.
<a id="resource-syntax"></a> <a id="resource-types"></a> <a id="providers"></a> <a id="resource-arguments"></a> <a id="documentation-for-resource-types"></a> <a id="meta-arguments"></a> <a id="timeouts"></a> <a id="operation-timeouts"></a>
## Syntax and Elements of Resource Blocks
This information has moved to
[Resource Blocks](/language/resources/syntax).
<div style={{height: '100vh', margin: 0, padding: 0}} />
<a id="resource-behavior"></a> <a id="accessing-resource-attributes"></a> <a id="resource-dependencies"></a> <a id="local-only-resources"></a>
## Details of Resource Behavior
This information has moved to
[Resource Behavior](/language/resources/behavior).
<div style={{height: '100vh', margin: 0, padding: 0}} />
## Resource Meta-Arguments
Each resource meta-argument has moved to its own page:
- [`depends_on`](/language/meta-arguments/depends_on)
- [`count`](/language/meta-arguments/count)
- [`for_each`](/language/meta-arguments/for_each)
- [`provider`](/language/meta-arguments/resource-provider)
- [`lifecycle`](/language/meta-arguments/lifecycle)
- [Provisioners](/language/resources/provisioners/)
<div style={{height: '100vh', margin: 0, padding: 0}} />
<a id="depends_on-explicit-resource-dependencies"></a>
### `depends_on`
This information has moved to
[`depends_on`](/language/meta-arguments/depends_on).
<div style={{height: '100vh', margin: 0, padding: 0}} />
<a id="count-multiple-resource-instances-by-count"></a> <a id="count-multiple-resource-instances"></a> <a id="the-count-object"></a> <a id="count-index"></a> <a id="referring-to-instances"></a> <a id="using-expressions-in-count"></a> <a id="when-to-use-for_each-instead-of-count"></a>
### `count`
This information has moved to
[`count`](/language/meta-arguments/count).
<div style={{height: '100vh', margin: 0, padding: 0}} />
<a id="for_each-multiple-resource-instances-defined-by-a-map-or-set-of-strings"></a> <a id="the-each-object"></a> <a id="each-key"></a> <a id="each-value"></a> <a id="using-expressions-in-for_each"></a> <a id="referring-to-instances-1"></a> <a id="using-sets"></a>
### `for_each`
This information has moved to
[`for_each`](/language/meta-arguments/for_each).
<div style={{height: '100vh', margin: 0, padding: 0}} />
<a id="provider-selecting-a-non-default-provider-configuration"></a>
### `provider`
This information has moved to
[`provider`](/language/meta-arguments/resource-provider).
<div style={{height: '100vh', margin: 0, padding: 0}} />
<a id="lifecycle-lifecycle-customizations"></a> <a id="prevent_destroy"></a> <a id="create_before_destroy"></a> <a id="ignore_changes"></a>
### `lifecycle`
This information has moved to
[`lifecycle`](/language/meta-arguments/lifecycle).
<div style={{height: '100vh', margin: 0, padding: 0}} />
<a id="provisioner-and-connection-resource-provisioners"></a>
### Provisioners
This information has moved to
[Provisioners](/language/resources/provisioners/).
<div style={{height: '100vh', margin: 0, padding: 0}} />

View File

@ -1,9 +1,9 @@
--- ---
page_title: Archiving Providers layout: "docs"
description: >- page_title: "Archiving Providers"
Terraform is built on a plugin-based architecture, much of which is maintained sidebar_current: "docs-internals"
by our user community. Occasionally, unmaintained providers may archived to description: |-
reduce confusion for users and developers. Terraform is built on a plugin-based architecture, much of which is maintained by our user community. Occasionally, unmaintained providers may archived to reduce confusion for users and developers.
--- ---
<!-- <!--
@ -25,4 +25,4 @@ What does archiving mean?
HashiCorp may archive a provider when we or the community are not able to support it at a level consistent with our open source guidelines and community expectations. HashiCorp may archive a provider when we or the community are not able to support it at a level consistent with our open source guidelines and community expectations.
Archiving is reversible. If anyone from the community is willing to maintain an archived provider, please reach out to the [Terraform Provider Development Program](/guides/terraform-integration-program) at _<terraform-provider-dev@hashicorp.com>_. Archiving is reversible. If anyone from the community is willing to maintain an archived provider, please reach out to the [Terraform Provider Development Program](https://www.terraform.io/guides/terraform-provider-development-program.html) at *terraform-provider-dev@hashicorp.com*.

View File

@ -1,17 +1,18 @@
--- ---
page_title: Credentials Helpers layout: "docs"
description: >- page_title: "Credentials Helpers"
Credentials helpers are external programs that know how to store and retrieve sidebar_current: "docs-internals-credentials-helpers"
API tokens for remote Terraform services. description: |-
Credentials helpers are external programs that know how to store and retrieve API tokens for remote Terraform services.
--- ---
# Credentials Helpers # Credentials Helpers
For Terraform-specific features that interact with remote network services, For Terraform-specific features that interact with remote network services,
such as [module registries](/registry/) and such as [module registries](/docs/registry/) and
[remote operations](/cloud-docs/run/cli), Terraform by default looks for [remote operations](/docs/cloud/run/cli.html), Terraform by default looks for
API credentials to use in these calls in API credentials to use in these calls in
[the CLI configuration](/cli/config/config-file). [the CLI configuration](/docs/cli/config/config-file.html).
Credentials helpers offer an alternative approach that allows you to customize Credentials helpers offer an alternative approach that allows you to customize
how Terraform obtains credentials using an external program, which can then how Terraform obtains credentials using an external program, which can then
@ -19,7 +20,7 @@ directly access an existing secrets management system in your organization.
This page is about how to write and install a credentials helper. To learn This page is about how to write and install a credentials helper. To learn
how to configure a credentials helper that was already installed, see how to configure a credentials helper that was already installed, see
[the CLI config Credentials Helpers section](/cli/config/config-file#credentials-helpers). [the CLI config Credentials Helpers section](/docs/cli/config/config-file.html#credentials-helpers).
## How Terraform finds Credentials Helpers ## How Terraform finds Credentials Helpers
@ -29,7 +30,7 @@ particular location and whose name follows a specific naming convention.
A credentials helper called "credstore", for example, would be implemented as A credentials helper called "credstore", for example, would be implemented as
an executable program named `terraform-credentials-credstore` (with an `.exe` an executable program named `terraform-credentials-credstore` (with an `.exe`
extension on Windows only), and installed in one of the extension on Windows only), and installed in one of the
[default plugin search locations](/plugin/how-terraform-works#plugin-locations). [default plugin search locations](/docs/extend/how-terraform-works.html#plugin-locations).
## How Terraform runs Credentials Helpers ## How Terraform runs Credentials Helpers
@ -56,7 +57,7 @@ The current set of verbs are:
To represent credentials, the credentials helper protocol uses a JSON object To represent credentials, the credentials helper protocol uses a JSON object
whose contents correspond with the contents of whose contents correspond with the contents of
[`credentials` blocks in the CLI configuration](/cli/config/config-file#credentials). [`credentials` blocks in the CLI configuration](/docs/cli/config/config-file.html#credentials).
To represent an API token, the object contains a property called "token" whose To represent an API token, the object contains a property called "token" whose
value is the token string: value is the token string:
@ -159,7 +160,7 @@ other properties as described above.
Terraform does not have any automatic installation mechanism for credentials Terraform does not have any automatic installation mechanism for credentials
helpers. Instead, the user must extract the helper program executable into helpers. Instead, the user must extract the helper program executable into
one of the [default plugin search locations](/plugin/how-terraform-works#plugin-locations). one of the [default plugin search locations](/docs/extend/how-terraform-works.html#plugin-locations).
If you are packaging a credentials helper for distribution, place it in an If you are packaging a credentials helper for distribution, place it in an
named with the expected naming scheme (`terraform-credentials-example`) and, named with the expected naming scheme (`terraform-credentials-example`) and,

View File

@ -1,14 +1,15 @@
--- ---
page_title: Debugging layout: "docs"
description: >- page_title: "Debugging"
Terraform has detailed logs which can be enabled by setting the TF_LOG sidebar_current: "docs-internals-debug"
environment variable to any value. This will cause detailed logs to appear on description: |-
stderr Terraform has detailed logs which can be enabled by setting the TF_LOG environment variable to any value. This will cause detailed logs to appear on stderr
--- ---
# Debugging Terraform # Debugging Terraform
> **Hands-on:** Try the [Create Dynamic Expressions](https://learn.hashicorp.com/tutorials/terraform/troubleshooting-workflow#bug-reporting-best-practices?utm_source=WEBSITE&utm_medium=WEB_IO&utm_offer=ARTICLE_PAGE&utm_content=DOCS) tutorial on HashiCorp Learn. > **Hands-on:** Try the [Create Dynamic Expressions](https://learn.hashicorp.com/tutorials/terraform/troubleshooting-workflow#bug-reporting-best-practices?utm_source=WEBSITE&utm_medium=WEB_IO&utm_offer=ARTICLE_PAGE&utm_content=DOCS) tutorial on HashiCorp Learn.
Terraform has detailed logs which can be enabled by setting the `TF_LOG` environment variable to any value. This will cause detailed logs to appear on stderr. Terraform has detailed logs which can be enabled by setting the `TF_LOG` environment variable to any value. This will cause detailed logs to appear on stderr.

View File

@ -0,0 +1,121 @@
---
layout: "docs"
page_title: "Resource Graph"
sidebar_current: "docs-internals-graph"
description: |-
Terraform builds a dependency graph from the Terraform configurations, and walks this graph to generate plans, refresh state, and more. This page documents the details of what are contained in this graph, what types of nodes there are, and how the edges of the graph are determined.
---
# Resource Graph
Terraform builds a
[dependency graph](https://en.wikipedia.org/wiki/Dependency_graph)
from the Terraform configurations, and walks this graph to
generate plans, refresh state, and more. This page documents
the details of what are contained in this graph, what types
of nodes there are, and how the edges of the graph are determined.
~> **Advanced Topic!** This page covers technical details
of Terraform. You don't need to understand these details to
effectively use Terraform. The details are documented here for
those who wish to learn about them without having to go
spelunking through the source code.
For some background on graph theory, and a summary of how
Terraform applies it, see the HashiCorp 2016 presentation
[_Applying Graph Theory to Infrastructure as Code_](https://www.youtube.com/watch?v=Ce3RNfRbdZ0).
This presentation also covers some similar ideas to the following
guide.
## Graph Nodes
There are only a handful of node types that can exist within the
graph. We'll cover these first before explaining how they're
determined and built:
* **Resource Node** - Represents a single resource. If you have
the `count` metaparameter set, then there will be one resource
node for each count. The configuration, diff, state, etc. of
the resource under change is attached to this node.
* **Provider Configuration Node** - Represents the time to fully
configure a provider. This is when the provider configuration
block is given to a provider, such as AWS security credentials.
* **Resource Meta-Node** - Represents a group of resources, but
does not represent any action on its own. This is done for
convenience on dependencies and making a prettier graph. This
node is only present for resources that have a `count`
parameter greater than 1.
When visualizing a configuration with `terraform graph`, you can
see all of these nodes present.
## Building the Graph
Building the graph is done in a series of sequential steps:
1. Resources nodes are added based on the configuration. If a
diff (plan) or state is present, that meta-data is attached
to each resource node.
1. Resources are mapped to provisioners if they have any
defined. This must be done after all resource nodes are
created so resources with the same provisioner type can
share the provisioner implementation.
1. Explicit dependencies from the `depends_on` meta-parameter
are used to create edges between resources.
1. If a state is present, any "orphan" resources are added to
the graph. Orphan resources are any resources that are no
longer present in the configuration but are present in the
state file. Orphans never have any configuration associated
with them, since the state file does not store configuration.
1. Resources are mapped to providers. Provider configuration
nodes are created for these providers, and edges are created
such that the resources depend on their respective provider
being configured.
1. Interpolations are parsed in resource and provider configurations
to determine dependencies. References to resource attributes
are turned into dependencies from the resource with the interpolation
to the resource being referenced.
1. Create a root node. The root node points to all resources and
is created so there is a single root to the dependency graph. When
traversing the graph, the root node is ignored.
1. If a diff is present, traverse all resource nodes and find resources
that are being destroyed. These resource nodes are split into two:
one node that destroys the resource and another that creates
the resource (if it is being recreated). The reason the nodes must
be split is because the destroy order is often different from the
create order, and so they can't be represented by a single graph
node.
1. Validate the graph has no cycles and has a single root.
## Walking the Graph
<a id="walking-the-graph"></a>
To walk the graph, a standard depth-first traversal is done. Graph
walking is done in parallel: a node is walked as soon as all of its
dependencies are walked.
The amount of parallelism is limited using a semaphore to prevent too many
concurrent operations from overwhelming the resources of the machine running
Terraform. By default, up to 10 nodes in the graph will be processed
concurrently. This number can be set using the `-parallelism` flag on the
[plan](/docs/cli/commands/plan.html), [apply](/docs/cli/commands/apply.html), and
[destroy](/docs/cli/commands/destroy.html) commands.
Setting `-parallelism` is considered an advanced operation and should not be
necessary for normal usage of Terraform. It may be helpful in certain special
use cases or to help debug Terraform issues.
Note that some providers (AWS, for example), handle API rate limiting issues at
a lower level by implementing graceful backoff/retry in their respective API
clients. For this reason, Terraform does not use this `parallelism` feature to
address API rate limits directly.

View File

@ -1,123 +0,0 @@
---
page_title: Resource Graph
description: >-
Terraform builds a dependency graph from the Terraform configurations, and
walks this graph to generate plans, refresh state, and more. This page
documents the details of what are contained in this graph, what types of nodes
there are, and how the edges of the graph are determined.
---
# Resource Graph
Terraform builds a
[dependency graph](https://en.wikipedia.org/wiki/Dependency_graph)
from the Terraform configurations, and walks this graph to
generate plans, refresh state, and more. This page documents
the details of what are contained in this graph, what types
of nodes there are, and how the edges of the graph are determined.
~> **Advanced Topic!** This page covers technical details
of Terraform. You don't need to understand these details to
effectively use Terraform. The details are documented here for
those who wish to learn about them without having to go
spelunking through the source code.
For some background on graph theory, and a summary of how
Terraform applies it, see the HashiCorp 2016 presentation
[_Applying Graph Theory to Infrastructure as Code_](https://www.youtube.com/watch?v=Ce3RNfRbdZ0).
This presentation also covers some similar ideas to the following
guide.
## Graph Nodes
There are only a handful of node types that can exist within the
graph. We'll cover these first before explaining how they're
determined and built:
- **Resource Node** - Represents a single resource. If you have
the `count` metaparameter set, then there will be one resource
node for each count. The configuration, diff, state, etc. of
the resource under change is attached to this node.
- **Provider Configuration Node** - Represents the time to fully
configure a provider. This is when the provider configuration
block is given to a provider, such as AWS security credentials.
- **Resource Meta-Node** - Represents a group of resources, but
does not represent any action on its own. This is done for
convenience on dependencies and making a prettier graph. This
node is only present for resources that have a `count`
parameter greater than 1.
When visualizing a configuration with `terraform graph`, you can
see all of these nodes present.
## Building the Graph
Building the graph is done in a series of sequential steps:
1. Resources nodes are added based on the configuration. If a
diff (plan) or state is present, that meta-data is attached
to each resource node.
1. Resources are mapped to provisioners if they have any
defined. This must be done after all resource nodes are
created so resources with the same provisioner type can
share the provisioner implementation.
1. Explicit dependencies from the `depends_on` meta-parameter
are used to create edges between resources.
1. If a state is present, any "orphan" resources are added to
the graph. Orphan resources are any resources that are no
longer present in the configuration but are present in the
state file. Orphans never have any configuration associated
with them, since the state file does not store configuration.
1. Resources are mapped to providers. Provider configuration
nodes are created for these providers, and edges are created
such that the resources depend on their respective provider
being configured.
1. Interpolations are parsed in resource and provider configurations
to determine dependencies. References to resource attributes
are turned into dependencies from the resource with the interpolation
to the resource being referenced.
1. Create a root node. The root node points to all resources and
is created so there is a single root to the dependency graph. When
traversing the graph, the root node is ignored.
1. If a diff is present, traverse all resource nodes and find resources
that are being destroyed. These resource nodes are split into two:
one node that destroys the resource and another that creates
the resource (if it is being recreated). The reason the nodes must
be split is because the destroy order is often different from the
create order, and so they can't be represented by a single graph
node.
1. Validate the graph has no cycles and has a single root.
## Walking the Graph
<a id="walking-the-graph"></a>
To walk the graph, a standard depth-first traversal is done. Graph
walking is done in parallel: a node is walked as soon as all of its
dependencies are walked.
The amount of parallelism is limited using a semaphore to prevent too many
concurrent operations from overwhelming the resources of the machine running
Terraform. By default, up to 10 nodes in the graph will be processed
concurrently. This number can be set using the `-parallelism` flag on the
[plan](/cli/commands/plan), [apply](/cli/commands/apply), and
[destroy](/cli/commands/destroy) commands.
Setting `-parallelism` is considered an advanced operation and should not be
necessary for normal usage of Terraform. It may be helpful in certain special
use cases or to help debug Terraform issues.
Note that some providers (AWS, for example), handle API rate limiting issues at
a lower level by implementing graceful backoff/retry in their respective API
clients. For this reason, Terraform does not use this `parallelism` feature to
address API rate limits directly.

View File

@ -1,8 +1,8 @@
--- ---
page_title: Internals layout: "docs"
description: >- page_title: "Internals"
Learn the technical details of how Terraform generates and executes sidebar_current: "docs-internals"
infrastructure plans, works with plugins, obtains credentials, etc. description: "Learn the technical details of how Terraform generates and executes infrastructure plans, works with plugins, obtains credentials, etc."
--- ---
# Terraform Internals # Terraform Internals

View File

@ -1,8 +1,9 @@
--- ---
page_title: 'Internals: JSON Output Format' layout: "docs"
description: >- page_title: "Internals: JSON Output Format"
Terraform provides a machine-readable JSON representation of state, sidebar_current: "docs-internals-json"
configuration and plan. description: |-
Terraform provides a machine-readable JSON representation of state, configuration and plan.
--- ---
# JSON Output Format # JSON Output Format
@ -13,7 +14,7 @@ When Terraform plans to make changes, it prints a human-readable summary to the
Since the format of plan files isn't suited for use with external tools (and likely never will be), Terraform can output a machine-readable JSON representation of a plan file's changes. It can also convert state files to the same format, to simplify data loading and provide better long-term compatibility. Since the format of plan files isn't suited for use with external tools (and likely never will be), Terraform can output a machine-readable JSON representation of a plan file's changes. It can also convert state files to the same format, to simplify data loading and provide better long-term compatibility.
Use `terraform show -json <FILE>` to generate a JSON representation of a plan or state file. See [the `terraform show` documentation](/cli/commands/show) for more details. Use `terraform show -json <FILE>` to generate a JSON representation of a plan or state file. See [the `terraform show` documentation](/docs/cli/commands/show.html) for more details.
The output includes a `format_version` key, which as of Terraform 1.1.0 has The output includes a `format_version` key, which as of Terraform 1.1.0 has
value `"1.0"`. The semantics of this version are: value `"1.0"`. The semantics of this version are:
@ -26,7 +27,7 @@ value `"1.0"`. The semantics of this version are:
version. version.
We will introduce new major versions only within the bounds of We will introduce new major versions only within the bounds of
[the Terraform 1.0 Compatibility Promises](/language/v1-compatibility-promises). [the Terraform 1.0 Compatibility Promises](https://www.terraform.io/docs/language/v1-compatibility-promises.html).
## Format Summary ## Format Summary
@ -42,8 +43,8 @@ The JSON output format consists of the following objects and sub-objects:
- [Plan Representation](#plan-representation) — The complete top-level object returned by `terraform show -json <PLAN FILE>`. - [Plan Representation](#plan-representation) — The complete top-level object returned by `terraform show -json <PLAN FILE>`.
- [Values Representation](#values-representation) — A sub-object of both plan and state output that describes current state or planned state. - [Values Representation](#values-representation) — A sub-object of both plan and state output that describes current state or planned state.
- [Configuration Representation](#configuration-representation) — A sub-object of plan output that describes a parsed Terraform configuration. - [Configuration Representation](#configuration-representation) — A sub-object of plan output that describes a parsed Terraform configuration.
- [Expression Representation](#expression-representation) — A sub-object of a configuration representation that describes an unevaluated expression. - [Expression Representation](#expression-representation) — A sub-object of a configuration representation that describes an unevaluated expression.
- [Block Expressions Representation](#block-expressions-representation) — A sub-object of a configuration representation that describes the expressions nested inside a block. - [Block Expressions Representation](#block-expressions-representation) — A sub-object of a configuration representation that describes the expressions nested inside a block.
- [Change Representation](#change-representation) — A sub-object of plan output that describes planned changes to an object. - [Change Representation](#change-representation) — A sub-object of plan output that describes planned changes to an object.
## State Representation ## State Representation
@ -305,7 +306,7 @@ The following example illustrates the structure of a `<values-representation>`:
} }
``` ```
The translation of attribute and output values is the same intuitive mapping from HCL types to JSON types used by Terraform's [`jsonencode`](/language/functions/jsonencode) function. This mapping does lose some information: lists, sets, and tuples all lower to JSON arrays while maps and objects both lower to JSON objects. Unknown values and null values are both treated as absent or null. The translation of attribute and output values is the same intuitive mapping from HCL types to JSON types used by Terraform's [`jsonencode`](/docs/language/functions/jsonencode.html) function. This mapping does lose some information: lists, sets, and tuples all lower to JSON arrays while maps and objects both lower to JSON objects. Unknown values and null values are both treated as absent or null.
Only the "current" object for each resource instance is described. "Deposed" objects are not reflected in this structure at all; in plan representations, you can refer to the change representations for further details. Only the "current" object for each resource instance is described. "Deposed" objects are not reflected in this structure at all; in plan representations, you can refer to the change representations for further details.

View File

@ -0,0 +1,58 @@
---
layout: "docs"
page_title: "Resource Lifecycle"
sidebar_current: "docs-internals-lifecycle"
description: |-
Resources have a strict lifecycle, and can be thought of as basic state machines. Understanding this lifecycle can help better understand how Terraform generates an execution plan, how it safely executes that plan, and what the resource provider is doing throughout all of this.
---
# Resource Lifecycle
Resources have a strict lifecycle, and can be thought of as basic
state machines. Understanding this lifecycle can help better understand
how Terraform generates an execution plan, how it safely executes that
plan, and what the resource provider is doing throughout all of this.
~> **Advanced Topic!** This page covers technical details
of Terraform. You don't need to understand these details to
effectively use Terraform. The details are documented here for
those who wish to learn about them without having to go
spelunking through the source code.
## Lifecycle
A resource roughly follows the steps below:
1. `ValidateResource` is called to do a high-level structural
validation of a resource's configuration. The configuration
at this point is raw and the interpolations have not been processed.
The value of any key is not guaranteed and is just meant to be
a quick structural check.
1. `Diff` is called with the current state and the configuration.
The resource provider inspects this and returns a diff, outlining
all the changes that need to occur to the resource. The diff includes
details such as whether or not the resource is being destroyed, what
attribute necessitates the destroy, old values and new values, whether
a value is computed, etc. It is up to the resource provider to
have this knowledge.
1. `Apply` is called with the current state and the diff. Apply does
not have access to the configuration. This is a safety mechanism
that limits the possibility that a provider changes a diff on the
fly. `Apply` must apply a diff as prescribed and do nothing else
to remain true to the Terraform execution plan. Apply returns the
new state of the resource (or nil if the resource was destroyed).
1. If a resource was just created and did not exist before, and the
apply succeeded without error, then the provisioners are executed
in sequence. If any provisioner errors, the resource is marked as
_tainted_, so that it will be destroyed on the next apply.
## Partial State and Error Handling
If an error happens at any stage in the lifecycle of a resource,
Terraform stores a partial state of the resource. This behavior is
critical for Terraform to ensure that you don't end up with any
_zombie_ resources: resources that were created by Terraform but
no longer managed by Terraform due to a loss of state.

View File

@ -1,59 +0,0 @@
---
page_title: Resource Lifecycle
description: >-
Resources have a strict lifecycle, and can be thought of as basic state
machines. Understanding this lifecycle can help better understand how
Terraform generates an execution plan, how it safely executes that plan, and
what the resource provider is doing throughout all of this.
---
# Resource Lifecycle
Resources have a strict lifecycle, and can be thought of as basic
state machines. Understanding this lifecycle can help better understand
how Terraform generates an execution plan, how it safely executes that
plan, and what the resource provider is doing throughout all of this.
~> **Advanced Topic!** This page covers technical details
of Terraform. You don't need to understand these details to
effectively use Terraform. The details are documented here for
those who wish to learn about them without having to go
spelunking through the source code.
## Lifecycle
A resource roughly follows the steps below:
1. `ValidateResource` is called to do a high-level structural
validation of a resource's configuration. The configuration
at this point is raw and the interpolations have not been processed.
The value of any key is not guaranteed and is just meant to be
a quick structural check.
1. `Diff` is called with the current state and the configuration.
The resource provider inspects this and returns a diff, outlining
all the changes that need to occur to the resource. The diff includes
details such as whether or not the resource is being destroyed, what
attribute necessitates the destroy, old values and new values, whether
a value is computed, etc. It is up to the resource provider to
have this knowledge.
1. `Apply` is called with the current state and the diff. Apply does
not have access to the configuration. This is a safety mechanism
that limits the possibility that a provider changes a diff on the
fly. `Apply` must apply a diff as prescribed and do nothing else
to remain true to the Terraform execution plan. Apply returns the
new state of the resource (or nil if the resource was destroyed).
1. If a resource was just created and did not exist before, and the
apply succeeded without error, then the provisioners are executed
in sequence. If any provisioner errors, the resource is marked as
_tainted_, so that it will be destroyed on the next apply.
## Partial State and Error Handling
If an error happens at any stage in the lifecycle of a resource,
Terraform stores a partial state of the resource. This behavior is
critical for Terraform to ensure that you don't end up with any
_zombie_ resources: resources that were created by Terraform but
no longer managed by Terraform due to a loss of state.

View File

@ -1,25 +1,26 @@
--- ---
page_title: Login Protocol layout: "docs"
description: >- page_title: "Login Protocol"
The login protocol is used for authenticating Terraform against servers sidebar_current: "docs-internals-login-protocol"
providing Terraform-native services. description: |-
The login protocol is used for authenticating Terraform against servers providing Terraform-native services.
--- ---
# Server-side Login Protocol # Server-side Login Protocol
~> **Note:** You don't need to read these docs to _use_ ~> **Note:** You don't need to read these docs to _use_
[`terraform login`](/cli/commands/login). The information below is for [`terraform login`](/docs/cli/commands/login.html). The information below is for
anyone intending to implement the server side of `terraform login` in order to anyone intending to implement the server side of `terraform login` in order to
offer Terraform-native services in a third-party system. offer Terraform-native services in a third-party system.
The `terraform login` command supports performing an OAuth 2.0 authorization The `terraform login` command supports performing an OAuth 2.0 authorization
request using configuration provided by the target host. You may wish to request using configuration provided by the target host. You may wish to
implement this protocol if you are producing a third-party implementation of implement this protocol if you are producing a third-party implementation of
any [Terraform-native services](/internals/remote-service-discovery), any [Terraform-native services](/docs/internals/remote-service-discovery.html),
such as a Terraform module registry. such as a Terraform module registry.
First, Terraform uses First, Terraform uses
[remote service discovery](/internals/remote-service-discovery) to [remote service discovery](/docs/internals/remote-service-discovery.html) to
find the OAuth configuration for the host. The host must support the service find the OAuth configuration for the host. The host must support the service
name `login.v1` and define for it an object containing OAuth client name `login.v1` and define for it an object containing OAuth client
configuration values, like this: configuration values, like this:
@ -107,7 +108,7 @@ authorization errors once the token expires, after which the user can run
-> **Note:** As a special case, Terraform can use a -> **Note:** As a special case, Terraform can use a
[Resource Owner Password Credentials Grant](https://tools.ietf.org/html/rfc6749#section-4.3) [Resource Owner Password Credentials Grant](https://tools.ietf.org/html/rfc6749#section-4.3)
only when interacting with `app.terraform.io` ([Terraform Cloud](/cloud-docs/)), only when interacting with `app.terraform.io` ([Terraform Cloud](/docs/cloud/index.html)),
under the recommendation in the OAuth specification to use this grant type only under the recommendation in the OAuth specification to use this grant type only
when the client and server are closely related. The `password` grant type is when the client and server are closely related. The `password` grant type is
not supported for any other hostname and will be ignored. not supported for any other hostname and will be ignored.

View File

@ -1,8 +1,9 @@
--- ---
page_title: 'Internals: Machine-Readable UI' layout: "docs"
description: >- page_title: "Internals: Machine-Readable UI"
Terraform provides a machine-readable streaming JSON UI output for plan, sidebar_current: "docs-internals-machine-readable-ui"
apply, and refresh operations. description: |-
Terraform provides a machine-readable streaming JSON UI output for plan, apply, and refresh operations.
--- ---
# Machine-Readable UI # Machine-Readable UI
@ -24,7 +25,7 @@ value `"1.0"`. The semantics of this version are:
version. version.
We will introduce new major versions only within the bounds of We will introduce new major versions only within the bounds of
[the Terraform 1.0 Compatibility Promises](/language/v1-compatibility-promises). [the Terraform 1.0 Compatibility Promises](https://www.terraform.io/docs/language/v1-compatibility-promises.html).
## Sample JSON Output ## Sample JSON Output
@ -60,7 +61,7 @@ The following message types are supported:
- `version`: information about the Terraform version and the version of the schema used for the following messages - `version`: information about the Terraform version and the version of the schema used for the following messages
- `log`: unstructured human-readable log lines - `log`: unstructured human-readable log lines
- `diagnostic`: diagnostic warning or error messages; [see the `terraform validate` docs for more details on the format](/cli/commands/validate#json) - `diagnostic`: diagnostic warning or error messages; [see the `terraform validate` docs for more details on the format](/docs/cli/commands/validate.html#json)
### Operation Results ### Operation Results
@ -103,7 +104,7 @@ If drift is detected during planning, Terraform will emit a `resource_drift` mes
- `resource`: object describing the address of the resource to be changed; see [resource object](#resource-object) below for details - `resource`: object describing the address of the resource to be changed; see [resource object](#resource-object) below for details
- `action`: the action planned to be taken for the resource. Values: `update`, `delete`. - `action`: the action planned to be taken for the resource. Values: `update`, `delete`.
This message does not include details about the exact changes which caused the change to be planned. That information is available in [the JSON plan output](/internals/json-format). This message does not include details about the exact changes which caused the change to be planned. That information is available in [the JSON plan output](./json-format.html).
### Example ### Example
@ -137,16 +138,16 @@ At the end of a plan or before an apply, Terraform will emit a `planned_change`
- `previous_resource`: object describing the previous address of the resource, if this change includes a configuration-driven move - `previous_resource`: object describing the previous address of the resource, if this change includes a configuration-driven move
- `action`: the action planned to be taken for the resource. Values: `noop`, `create`, `read`, `update`, `replace`, `delete`, `move`. - `action`: the action planned to be taken for the resource. Values: `noop`, `create`, `read`, `update`, `replace`, `delete`, `move`.
- `reason`: an optional reason for the change, currently only used when the action is `replace` or `delete`. Values: - `reason`: an optional reason for the change, currently only used when the action is `replace` or `delete`. Values:
- `tainted`: resource was marked as tainted - `tainted`: resource was marked as tainted
- `requested`: user requested that the resource be replaced, for example via the `-replace` plan flag - `requested`: user requested that the resource be replaced, for example via the `-replace` plan flag
- `cannot_update`: changes to configuration force the resource to be deleted and created rather than updated - `cannot_update`: changes to configuration force the resource to be deleted and created rather than updated
- `delete_because_no_resource_config`: no matching resource in configuration - `delete_because_no_resource_config`: no matching resource in configuration
- `delete_because_wrong_repetition`: resource instance key has no corresponding `count` or `for_each` in configuration - `delete_because_wrong_repetition`: resource instance key has no corresponding `count` or `for_each` in configuration
- `delete_because_count_index`: resource instance key is outside the range of the `count` argument - `delete_because_count_index`: resource instance key is outside the range of the `count` argument
- `delete_because_each_key`: resource instance key is not included in the `for_each` argument - `delete_because_each_key`: resource instance key is not included in the `for_each` argument
- `delete_because_no_module`: enclosing module instance is not in configuration - `delete_because_no_module`: enclosing module instance is not in configuration
This message does not include details about the exact changes which caused the change to be planned. That information is available in [the JSON plan output](/internals/json-format). This message does not include details about the exact changes which caused the change to be planned. That information is available in [the JSON plan output](./json-format.html).
### Example ### Example

View File

@ -1,5 +1,7 @@
--- ---
page_title: Module Registry Protocol layout: "docs"
page_title: "Module Registry Protocol"
sidebar_current: "docs-internals-module-registry-protocol"
description: |- description: |-
The module registry protocol is implemented by a host intending to be the The module registry protocol is implemented by a host intending to be the
host of one or more Terraform modules, specifying which modules are available host of one or more Terraform modules, specifying which modules are available
@ -23,7 +25,7 @@ publishing them on the public Terraform Registry.
The public Terraform Registry implements a superset of the API described on The public Terraform Registry implements a superset of the API described on
this page, in order to capture additional information used in the registry UI. this page, in order to capture additional information used in the registry UI.
For information on those extensions, see For information on those extensions, see
[Terraform Registry HTTP API](/registry/api-docs). Third-party registry [Terraform Registry HTTP API](/docs/registry/api.html). Third-party registry
implementations may choose to implement those extensions if desired, but implementations may choose to implement those extensions if desired, but
Terraform CLI itself does not use them. Terraform CLI itself does not use them.
@ -32,14 +34,14 @@ Terraform CLI itself does not use them.
Each Terraform module has an associated address. A module address has the Each Terraform module has an associated address. A module address has the
syntax `hostname/namespace/name/system`, where: syntax `hostname/namespace/name/system`, where:
- `hostname` is the hostname of the module registry that serves this module. * `hostname` is the hostname of the module registry that serves this module.
- `namespace` is the name of a namespace, unique on a particular hostname, that * `namespace` is the name of a namespace, unique on a particular hostname, that
can contain one or more modules that are somehow related. On the public can contain one or more modules that are somehow related. On the public
Terraform Registry the "namespace" represents the organization that is Terraform Registry the "namespace" represents the organization that is
packaging and distributing the module. packaging and distributing the module.
- `name` is the module name, which generally names the abstraction that the * `name` is the module name, which generally names the abstraction that the
module is intending to create. module is intending to create.
- `system` is the name of a remote system that the module is primarily written * `system` is the name of a remote system that the module is primarily written
to target. For multi-cloud abstractions, there can be multiple modules with to target. For multi-cloud abstractions, there can be multiple modules with
addresses that differ only in "system" to reflect provider-specific addresses that differ only in "system" to reflect provider-specific
implementations of the abstraction, like implementations of the abstraction, like
@ -55,10 +57,10 @@ is optional, and if omitted defaults to `registry.terraform.io/`.
For example: For example:
- `hashicorp/consul/aws` is a shorthand for * `hashicorp/consul/aws` is a shorthand for
`registry.terraform.io/hashicorp/consul/aws`, which is a module on the `registry.terraform.io/hashicorp/consul/aws`, which is a module on the
public registry for deploying Consul clusters in Amazon Web Services. public registry for deploying Consul clusters in Amazon Web Services.
- `example.com/awesomecorp/consul/happycloud` is a hypothetical module published * `example.com/awesomecorp/consul/happycloud` is a hypothetical module published
on a third-party registry. on a third-party registry.
If you intend to share a module you've developed for use by all Terraform If you intend to share a module you've developed for use by all Terraform
@ -81,7 +83,7 @@ blocks have the same source address.
## Service Discovery ## Service Discovery
The module registry protocol begins with Terraform CLI using The module registry protocol begins with Terraform CLI using
[Terraform's remote service discovery protocol](/internals/remote-service-discovery), [Terraform's remote service discovery protocol](./remote-service-discovery.html),
with the hostname in the module address acting as the "User-facing Hostname". with the hostname in the module address acting as the "User-facing Hostname".
The service identifier for the module registry protocol is `modules.v1`. The service identifier for the module registry protocol is `modules.v1`.
@ -121,9 +123,9 @@ the string "versions".
This is the primary endpoint for resolving module sources, returning the This is the primary endpoint for resolving module sources, returning the
available versions for a given fully-qualified module. available versions for a given fully-qualified module.
| Method | Path | Produces | | Method | Path | Produces |
| ------ | ------------------------------------- | ------------------ | | ------ | ------------------------------------- | -------------------------- |
| `GET` | `:namespace/:name/:provider/versions` | `application/json` | | `GET` | `:namespace/:name/:provider/versions` | `application/json` |
### Parameters ### Parameters
@ -175,9 +177,9 @@ requested namespace, name, and provider
This endpoint downloads the specified version of a module for a single provider. This endpoint downloads the specified version of a module for a single provider.
| Method | Path | Produces | | Method | Path | Produces |
| ------ | -------------------------------------------- | ------------------ | | ------ | ------------------------------------------------------ | -------------------------- |
| `GET` | `:namespace/:name/:system/:version/download` | `application/json` | | `GET` | `:namespace/:name/:system/:version/download` | `application/json` |
### Parameters ### Parameters
@ -211,10 +213,10 @@ A successful response has no body, and includes the location from which the
module version's source can be downloaded in the `X-Terraform-Get` header. module version's source can be downloaded in the `X-Terraform-Get` header.
The value of this header accepts the same values as the `source` argument The value of this header accepts the same values as the `source` argument
in a `module` block in Terraform configuration, as described in in a `module` block in Terraform configuration, as described in
[Module Sources](/language/modules/sources), [Module Sources](https://www.terraform.io/docs/language/modules/sources.html),
except that it may not recursively refer to another module registry address. except that it may not recursively refer to another module registry address.
The value of `X-Terraform-Get` may instead be a relative URL, indicated by The value of `X-Terraform-Get` may instead be a relative URL, indicated by
beginning with `/`, `./` or `../`, in which case it is resolved relative to beginning with `/`, `./` or `../`, in which case it is resolved relative to
the full URL of the download endpoint to produce the full URL of the download endpoint to produce
[an HTTP URL module source](/language/modules/sources#http-urls). [an HTTP URL module source](/docs/language/modules/sources.html#http-urls).

View File

@ -1,8 +1,9 @@
--- ---
page_title: Provider Metadata layout: "docs"
description: >- page_title: "Provider Metadata"
For advanced use cases, modules can provide some pre-defined metadata for sidebar_current: "docs-internals-provider-meta"
providers. description: |-
For advanced use cases, modules can provide some pre-defined metadata for providers.
--- ---
# Provider Metadata # Provider Metadata

View File

@ -1,5 +1,7 @@
--- ---
page_title: Provider Network Mirror Protocol layout: "docs"
page_title: "Provider Network Mirror Protocol"
sidebar_current: "docs-internals-provider-network-mirror-protocol"
description: |- description: |-
The provider network mirror protocol is implemented by a server intending The provider network mirror protocol is implemented by a server intending
to provide a mirror or read-through caching proxy for Terraform providers, to provide a mirror or read-through caching proxy for Terraform providers,
@ -16,7 +18,7 @@ implement to provide an alternative installation source for Terraform providers,
regardless of their origin registries. regardless of their origin registries.
Terraform uses network mirrors only if you activate them explicitly in Terraform uses network mirrors only if you activate them explicitly in
[the CLI configuration's `provider_installation` block](/cli/config/config-file#provider-installation). [the CLI configuration's `provider_installation` block](/docs/cli/config/config-file.html#provider-installation).
When enabled, a network mirror can serve providers belonging to any registry When enabled, a network mirror can serve providers belonging to any registry
hostname, which can allow an organization to serve all of the Terraform hostname, which can allow an organization to serve all of the Terraform
providers they intend to use from an internal server, rather than from each providers they intend to use from an internal server, rather than from each
@ -26,7 +28,7 @@ This is _not_ the protocol that should be implemented by a host intending to
serve as an origin registry for Terraform Providers. To provide an origin serve as an origin registry for Terraform Providers. To provide an origin
registry (whose hostname would then be included in the source addresses of the registry (whose hostname would then be included in the source addresses of the
providers it hosts), implement providers it hosts), implement
[the provider registry protocol](/internals/provider-registry-protocol) [the provider registry protocol](./provider-registry-protocol.html)
instead. instead.
## Provider Addresses ## Provider Addresses
@ -34,7 +36,7 @@ instead.
Each Terraform provider has an associated address which uniquely identifies it Each Terraform provider has an associated address which uniquely identifies it
within Terraform. A provider address has the syntax `hostname/namespace/type`, within Terraform. A provider address has the syntax `hostname/namespace/type`,
which is described in more detail in which is described in more detail in
[the Provider Requirements documentation](/language/providers/requirements). [the Provider Requirements documentation](/docs/language/providers/requirements.html).
By default, the `hostname` portion of a provider address serves both as part By default, the `hostname` portion of a provider address serves both as part
of its unique identifier _and_ as the location of the registry to retrieve it of its unique identifier _and_ as the location of the registry to retrieve it
@ -52,7 +54,7 @@ the hostname where the provider network mirror is deployed.
## Protocol Base URL ## Protocol Base URL
Most Terraform-native services use Most Terraform-native services use
[the remote service discovery protocol](/internals/remote-service-discovery) so [the remote service discovery protocol](./remote-service-discovery.html) so
that the physical location of the endpoints can potentially be separated from that the physical location of the endpoints can potentially be separated from
the hostname used in identifiers. The Provider Network Mirror protocol does the hostname used in identifiers. The Provider Network Mirror protocol does
_not_ use the service discovery indirection, because a network mirror location _not_ use the service discovery indirection, because a network mirror location
@ -94,7 +96,7 @@ base URL from the above CLI configuration example.
### Authentication ### Authentication
If the CLI configuration includes If the CLI configuration includes
[credentials](/cli/config/config-file#credentials) for the hostname [credentials](/docs/cli/config/config-file.html#credentials) for the hostname
given in the network mirror base URL, Terraform will include those credentials given in the network mirror base URL, Terraform will include those credentials
in its requests for operations described below. in its requests for operations described below.
@ -115,7 +117,7 @@ This operation determines which versions are currently available for a
particular provider. particular provider.
| Method | Path | Produces | | Method | Path | Produces |
| ------ | --------------------------------------- | ------------------ | |--------|-----------------------------------------|--------------------|
| `GET` | `:hostname/:namespace/:type/index.json` | `application/json` | | `GET` | `:hostname/:namespace/:type/index.json` | `application/json` |
### Parameters ### Parameters
@ -173,7 +175,7 @@ version matching the configured version constraints, in order to find a zip
archive containing the plugin itself. archive containing the plugin itself.
| Method | Path | Produces | | Method | Path | Produces |
| ------ | ------------------------------------------ | ------------------ | |--------|--------------------------------------------|--------------------|
| `GET` | `:hostname/:namespace/:type/:version.json` | `application/json` | | `GET` | `:hostname/:namespace/:type/:version.json` | `application/json` |
### Parameters ### Parameters
@ -229,13 +231,13 @@ the following properties:
* `url` (required): a string specifying the URL from which Terraform should * `url` (required): a string specifying the URL from which Terraform should
download the `.zip` archive containing the requested provider plugin version. download the `.zip` archive containing the requested provider plugin version.
Terraform resolves the URL relative to the URL from which the current Terraform resolves the URL relative to the URL from which the current
JSON document was returned, so the examples above containing only a JSON document was returned, so the examples above containing only a
filename would cause Terraform to construct a URL like: filename would cause Terraform to construct a URL like:
``` ```
https://terraform.example.com/providers/registry.terraform.io/hashicorp/random/terraform-provider-random_2.0.0_darwin_amd64.zip https://terraform.example.com/providers/registry.terraform.io/hashicorp/random/terraform-provider-random_2.0.0_darwin_amd64.zip
``` ```
* `hashes` (optional): a JSON array of strings containing one or more hash * `hashes` (optional): a JSON array of strings containing one or more hash
values for the indicated archive. These hashes use Terraform's provider values for the indicated archive. These hashes use Terraform's provider
@ -244,11 +246,11 @@ the following properties:
command, as described in a later section, which will include the calculated command, as described in a later section, which will include the calculated
hashes of each provider. hashes of each provider.
If the response includes at least one hash, Terraform will select the hash If the response includes at least one hash, Terraform will select the hash
whose algorithm it considers to be strongest and verify that the downloaded whose algorithm it considers to be strongest and verify that the downloaded
package matches that hash. If the response does not include a `hashes` package matches that hash. If the response does not include a `hashes`
property then Terraform will install the indicated archive with no property then Terraform will install the indicated archive with no
verification. verification.
Terraform CLI will only attempt to download versions that it has previously Terraform CLI will only attempt to download versions that it has previously
seen in response to [List Available Versions](#list-available-versions). seen in response to [List Available Versions](#list-available-versions).
@ -262,7 +264,7 @@ in the appropriate nested subdirectories, and ensure that your system is
configured to serve `.json` files with the `application/json` media type. configured to serve `.json` files with the `application/json` media type.
As a convenience, Terraform CLI includes As a convenience, Terraform CLI includes
[the `terraform providers mirror` subcommand](/cli/commands/providers/mirror), [the `terraform providers mirror` subcommand](https://www.terraform.io/docs/cli/commands/providers/mirror.html),
which will analyze the current configuration for the providers it requires, which will analyze the current configuration for the providers it requires,
download the packages for those providers from their origin registries, and download the packages for those providers from their origin registries, and
place them into a local directory suitable for use as a mirror. place them into a local directory suitable for use as a mirror.

View File

@ -1,5 +1,7 @@
--- ---
page_title: Provider Registry Protocol layout: "docs"
page_title: "Provider Registry Protocol"
sidebar_current: "docs-internals-provider-registry-protocol"
description: |- description: |-
The provider registry protocol is implemented by a host intending to be the The provider registry protocol is implemented by a host intending to be the
origin host for one or more Terraform providers, specifying which providers origin host for one or more Terraform providers, specifying which providers
@ -40,7 +42,7 @@ where:
* `hostname` is the registry host that the provider is considered to have * `hostname` is the registry host that the provider is considered to have
originated from, and the default location Terraform will consult for originated from, and the default location Terraform will consult for
information about the provider information about the provider
[unless overridden in the CLI configuration](/cli/config/config-file#provider-installation). [unless overridden in the CLI configuration](/docs/cli/config/config-file.html#provider-installation).
* `namespace` is the name of a namespace, unique on a particular hostname, that * `namespace` is the name of a namespace, unique on a particular hostname, that
can contain one or more providers that are somehow related. On the public can contain one or more providers that are somehow related. On the public
Terraform Registry the "namespace" represents the organization that is Terraform Registry the "namespace" represents the organization that is
@ -76,7 +78,7 @@ to see it as an entirely separate provider that will _not_ be usable by modules
that declare a dependency on `hashicorp/azurerm`. If your goal is to create that declare a dependency on `hashicorp/azurerm`. If your goal is to create
an alternative local distribution source for an existing provider -- that is, an alternative local distribution source for an existing provider -- that is,
a _mirror_ of the provider -- refer to a _mirror_ of the provider -- refer to
[the provider installation method configuration](/cli/config/config-file#provider-installation) [the provider installation method configuration](/docs/cli/config/config-file.html#provider-installation)
instead. instead.
## Provider Versions ## Provider Versions
@ -96,7 +98,7 @@ version selection.
## Service Discovery ## Service Discovery
The providers protocol begins with Terraform CLI using The providers protocol begins with Terraform CLI using
[Terraform's remote service discovery protocol](/internals/remote-service-discovery), [Terraform's remote service discovery protocol](./remote-service-discovery.html),
with the hostname in the provider address acting as the "User-facing Hostname". with the hostname in the provider address acting as the "User-facing Hostname".
The service identifier for the provider registry protocol is `providers.v1`. The service identifier for the provider registry protocol is `providers.v1`.
@ -137,7 +139,7 @@ This operation determines which versions are currently available for a
particular provider. particular provider.
| Method | Path | Produces | | Method | Path | Produces |
| ------ | --------------------------- | ------------------ | |--------|-----------------------------|--------------------|
| `GET` | `:namespace/:type/versions` | `application/json` | | `GET` | `:namespace/:type/versions` | `application/json` |
### Parameters ### Parameters
@ -196,29 +198,29 @@ with the following properties:
version supported. For example, `5.1` means that the provider supports both version supported. For example, `5.1` means that the provider supports both
protocol `5.0` and protocol `5.1`. protocol `5.0` and protocol `5.1`.
Terraform uses this information, when available, to provide hints to users Terraform uses this information, when available, to provide hints to users
about upgrading or downgrading their version of a particular provider to about upgrading or downgrading their version of a particular provider to
work with their current version of Terraform, if their currently-selected work with their current version of Terraform, if their currently-selected
versions are not compatible. versions are not compatible.
Which API versions are supported is, for most providers, decided by which Which API versions are supported is, for most providers, decided by which
version of the Terraform SDK they are built against. Consult the Terraform version of the Terraform SDK they are built against. Consult the Terraform
SDK documentation for more information. SDK documentation for more information.
Only Terraform 0.13 and later support third-party provider registries and Only Terraform 0.13 and later support third-party provider registries and
that Terraform version requires API version `5.0` or later, so in practice that Terraform version requires API version `5.0` or later, so in practice
it isn't useful to list major versions 4 or earlier in a third-party it isn't useful to list major versions 4 or earlier in a third-party
provider registry. provider registry.
* `platforms` (recommended): an array of objects describing platforms that have * `platforms` (recommended): an array of objects describing platforms that have
packages available for this version. packages available for this version.
Terraform may use this information, when available, to provide hints to Terraform may use this information, when available, to provide hints to
users about upgrading or downgrading their version of a particular provider users about upgrading or downgrading their version of a particular provider
for compatibility with their current platform. for compatibility with their current platform.
The `platforms` objects have properties `os` and `arch`, whose values match The `platforms` objects have properties `os` and `arch`, whose values match
the properties of the same name in the response to the properties of the same name in the response to
[Find a Provider Package](#find-a-provider-package). [Find a Provider Package](#find-a-provider-package).
Return `404 Not Found` to signal that the registry does not have a provider Return `404 Not Found` to signal that the registry does not have a provider
with the given namespace and type. with the given namespace and type.
@ -234,7 +236,7 @@ version matching the configured version constraints, in order to find the zip
archive containing the plugin itself. archive containing the plugin itself.
| Method | Path | Produces | | Method | Path | Produces |
| ------ | ---------------------------------------------- | ------------------ | |--------|------------------------------------------------|--------------------|
| `GET` | `:namespace/:type/:version/download/:os/:arch` | `application/json` | | `GET` | `:namespace/:type/:version/download/:os/:arch` | `application/json` |
### Parameters ### Parameters
@ -290,9 +292,9 @@ A successful result is a JSON object with the following properties:
the provider supports, in the same format as for the provider supports, in the same format as for
[List Available Versions](#list-available-versions). [List Available Versions](#list-available-versions).
While this property is optional when listing available options, it is While this property is optional when listing available options, it is
_required_ for describing an individual provider package so that Terraform _required_ for describing an individual provider package so that Terraform
CLI can avoid downloading a package that will not be compatible with it. CLI can avoid downloading a package that will not be compatible with it.
* `os` (required): this must currently echo back the `os` parameter from the * `os` (required): this must currently echo back the `os` parameter from the
request. Other possibilities may come in later versions of this protocol. request. Other possibilities may come in later versions of this protocol.
@ -312,9 +314,9 @@ A successful result is a JSON object with the following properties:
document recording expected SHA256 checksums for this package and possibly document recording expected SHA256 checksums for this package and possibly
other packages for the same provider version on other platforms. other packages for the same provider version on other platforms.
The indicated document must be in the format generated by the `sha256` The indicated document must be in the format generated by the `sha256`
command available on many Unix systems, with one entry recording the command available on many Unix systems, with one entry recording the
same filename given in the `filename` property (case sensitive). same filename given in the `filename` property (case sensitive).
* `shasums_signature_url` (required): a URL from which Terraform can retrieve * `shasums_signature_url` (required): a URL from which Terraform can retrieve
a binary, detached GPG signature for the document at `shasums_url`, signed a binary, detached GPG signature for the document at `shasums_url`, signed
@ -324,16 +326,16 @@ A successful result is a JSON object with the following properties:
provider package, one of which must have been used to produce the signature provider package, one of which must have been used to produce the signature
at `shasums_signature_url`. The object has the following nested properties: at `shasums_signature_url`. The object has the following nested properties:
* `gpg_public_keys` (required): an array of objects, each describing one * `gpg_public_keys` (required): an array of objects, each describing one
GPG signing key that is allowed to sign the checksums for this provider GPG signing key that is allowed to sign the checksums for this provider
version. At least one element must be included, representing the key that version. At least one element must be included, representing the key that
produced the signature at `shasums_signature_url`. These objects have produced the signature at `shasums_signature_url`. These objects have
the following nested properties: the following nested properties:
* `key_id` (required): uppercase-hexadecimal-formatted ID for this GPG key * `key_id` (required): uppercase-hexadecimal-formatted ID for this GPG key
* `ascii_armor` (required): an "ascii-armor" encoding of the **public key** * `ascii_armor` (required): an "ascii-armor" encoding of the **public key**
associated with this GPG key. associated with this GPG key.
Return `404 Not Found` to signal that the given provider version isn't Return `404 Not Found` to signal that the given provider version isn't
available for the requested operating system and/or architecture. Terraform available for the requested operating system and/or architecture. Terraform

View File

@ -1,5 +1,7 @@
--- ---
page_title: 'Internals: Remote Service Discovery' layout: "docs"
page_title: "Internals: Remote Service Discovery"
sidebar_current: "docs-internals-remote-service-discovery"
description: |- description: |-
Remote service discovery is a protocol used to locate Terraform-native Remote service discovery is a protocol used to locate Terraform-native
services provided at a user-friendly hostname. services provided at a user-friendly hostname.
@ -83,14 +85,14 @@ version 1 of the module registry protocol:
At present, the following service identifiers are in use: At present, the following service identifiers are in use:
* `login.v1`: [login protocol version 1](/cli/commands/login) * `login.v1`: [login protocol version 1](/docs/cli/commands/login.html)
* `modules.v1`: [module registry API version 1](/internals/module-registry-protocol) * `modules.v1`: [module registry API version 1](module-registry-protocol.html)
* `providers.v1`: [provider registry API version 1](/internals/provider-registry-protocol) * `providers.v1`: [provider registry API version 1](provider-registry-protocol.html)
## Authentication ## Authentication
If credentials for the given hostname are available in If credentials for the given hostname are available in
[the CLI config](/cli/config/config-file) then they will be included [the CLI config](/docs/cli/config/config-file.html) then they will be included
in the request for the discovery document. in the request for the discovery document.
The credentials may also be provided to endpoints declared in the discovery The credentials may also be provided to endpoints declared in the discovery

View File

@ -1,11 +1,10 @@
--- ---
page_title: Attributes as Blocks - Configuration Language layout: "language"
description: >- page_title: "Attributes as Blocks - Configuration Language"
For historical reasons, certain arguments within resource blocks can use sidebar_current: "docs-config-attr-as-blocks"
either description: |-
For historical reasons, certain arguments within resource blocks can use either
block or attribute syntax. block or attribute syntax.
sidebar_title: Attributes as Blocks
--- ---
# Attributes as Blocks # Attributes as Blocks
@ -26,28 +25,28 @@ is set to an empty list (`<ATTR> = []`).
Most users do not need to know any further details of this "nested block or Most users do not need to know any further details of this "nested block or
empty list" behavior. However, read further if you need to: empty list" behavior. However, read further if you need to:
- Use Terraform's [JSON syntax](/language/syntax/json) with this - Use Terraform's [JSON syntax](/docs/language/syntax/json.html) with this
type of resource. type of resource.
- Create a reusable module that wraps this type of resource. - Create a reusable module that wraps this type of resource.
## Details ## Details
In Terraform v0.12 and later, the language makes a distinction between In Terraform v0.12 and later, the language makes a distinction between
[argument syntax and nested block syntax](/language/syntax/configuration#arguments-and-blocks) [argument syntax and nested block syntax](/docs/language/syntax/configuration.html#arguments-and-blocks)
within blocks: within blocks:
- Argument syntax sets a named argument for the containing object. If the * Argument syntax sets a named argument for the containing object. If the
attribute has a default value then an explicitly-specified value entirely attribute has a default value then an explicitly-specified value entirely
overrides that default. overrides that default.
- Nested block syntax represents a related child object of the container that * Nested block syntax represents a related child object of the container that
has its own set of arguments. Where multiple such objects are possible, multiple has its own set of arguments. Where multiple such objects are possible, multiple
blocks of the same type can be present. If the nested attributes themselves blocks of the same type can be present. If the nested attributes themselves
have default values, they are honored for each nested block separately, have default values, they are honored for each nested block separately,
merging in with any explicitly-defined arguments. merging in with any explicitly-defined arguments.
The distinction between these is particularly important for The distinction between these is particularly important for
[JSON syntax](/language/syntax/json) [JSON syntax](/docs/language/syntax/json.html)
because the same primitive JSON constructs (lists and objects) will be because the same primitive JSON constructs (lists and objects) will be
interpreted differently depending on whether a particular name is an argument interpreted differently depending on whether a particular name is an argument
or a nested block type. or a nested block type.
@ -154,7 +153,7 @@ example = [
For the arguments that use the attributes-as-blocks usage mode, the above is For the arguments that use the attributes-as-blocks usage mode, the above is
a better pattern than using a better pattern than using
[`dynamic` blocks](/language/expressions/dynamic-blocks) [`dynamic` blocks](/docs/language/expressions/dynamic-blocks.html)
because the case where the because the case where the
caller provides an empty list will result in explicitly assigning an empty caller provides an empty list will result in explicitly assigning an empty
list value, rather than assigning no value at all and thus retaining and list value, rather than assigning no value at all and thus retaining and
@ -164,7 +163,7 @@ dynamically-generating _normal_ nested blocks, though.
## In JSON syntax ## In JSON syntax
Arguments that use this special mode are specified in JSON syntax always using Arguments that use this special mode are specified in JSON syntax always using
the [JSON expression mapping](/language/syntax/json#expression-mapping) the [JSON expression mapping](/docs/language/syntax/json.html#expression-mapping)
to produce a list of objects. to produce a list of objects.
The interpretation of these values in JSON syntax is, therefore, equivalent The interpretation of these values in JSON syntax is, therefore, equivalent

View File

@ -1,10 +1,8 @@
--- ---
page_title: Data Sources - Configuration Language layout: "language"
description: >- page_title: "Data Sources - Configuration Language"
Data sources allow Terraform to use external data, function output, and data sidebar_current: "docs-config-data-sources"
from other configurations. Learn data resource arguments, behavior, and description: "Data sources allow Terraform to use external data, function output, and data from other configurations. Learn data resource arguments, behavior, and lifecycle."
lifecycle.
sidebar_title: Data Sources
--- ---
# Data Sources # Data Sources
@ -14,8 +12,8 @@ defined by another separate Terraform configuration, or modified by functions.
> **Hands-on:** Try the [Query Data Sources](https://learn.hashicorp.com/tutorials/terraform/data-sources) tutorial on HashiCorp Learn. > **Hands-on:** Try the [Query Data Sources](https://learn.hashicorp.com/tutorials/terraform/data-sources) tutorial on HashiCorp Learn.
Each [provider](/language/providers/) may offer data sources Each [provider](/docs/language/providers/index.html) may offer data sources
alongside its set of [resource](/language/resources/) alongside its set of [resource](/docs/language/resources/index.html)
types. types.
## Using Data Sources ## Using Data Sources
@ -62,14 +60,14 @@ Each data resource is associated with a single data source, which determines
the kind of object (or objects) it reads and what query constraint arguments the kind of object (or objects) it reads and what query constraint arguments
are available. are available.
Each data source in turn belongs to a [provider](/language/providers/), Each data source in turn belongs to a [provider](/docs/language/providers/index.html),
which is a plugin for Terraform that offers a collection of resource types and which is a plugin for Terraform that offers a collection of resource types and
data sources that most often belong to a single cloud or on-premises data sources that most often belong to a single cloud or on-premises
infrastructure platform. infrastructure platform.
Most of the items within the body of a `data` block are defined by and Most of the items within the body of a `data` block are defined by and
specific to the selected data source, and these arguments can make full specific to the selected data source, and these arguments can make full
use of [expressions](/language/expressions/) and other dynamic use of [expressions](/docs/language/expressions/index.html) and other dynamic
Terraform language features. Terraform language features.
However, there are some "meta-arguments" that are defined by Terraform itself However, there are some "meta-arguments" that are defined by Terraform itself
@ -111,7 +109,7 @@ operation, and is re-calculated each time a new plan is created.
## Data Resource Dependencies ## Data Resource Dependencies
Data resources have the same dependency resolution behavior Data resources have the same dependency resolution behavior
[as defined for managed resources](/language/resources/behavior#resource-dependencies). [as defined for managed resources](/docs/language/resources/behavior.html#resource-dependencies).
Setting the `depends_on` meta-argument within `data` blocks defers reading of Setting the `depends_on` meta-argument within `data` blocks defers reading of
the data source until after all changes to the dependencies have been applied. the data source until after all changes to the dependencies have been applied.
@ -123,10 +121,11 @@ referencing the managed resource values through a `local` value.
~> **NOTE:** **In Terraform 0.12 and earlier**, due to the data resource behavior of deferring the read until the apply phase when depending on values that are not yet known, using `depends_on` with `data` resources will force the read to always be deferred to the apply phase, and therefore a configuration that uses `depends_on` with a `data` resource can never converge. Due to this behavior, we do not recommend using `depends_on` with data resources. ~> **NOTE:** **In Terraform 0.12 and earlier**, due to the data resource behavior of deferring the read until the apply phase when depending on values that are not yet known, using `depends_on` with `data` resources will force the read to always be deferred to the apply phase, and therefore a configuration that uses `depends_on` with a `data` resource can never converge. Due to this behavior, we do not recommend using `depends_on` with data resources.
## Multiple Resource Instances ## Multiple Resource Instances
Data resources support [`count`](/language/meta-arguments/count) Data resources support [`count`](/docs/language/meta-arguments/count.html)
and [`for_each`](/language/meta-arguments/for_each) and [`for_each`](/docs/language/meta-arguments/for_each.html)
meta-arguments as defined for managed resources, with the same syntax and behavior. meta-arguments as defined for managed resources, with the same syntax and behavior.
As with managed resources, when `count` or `for_each` is present it is important to As with managed resources, when `count` or `for_each` is present it is important to
@ -136,7 +135,7 @@ own variant of the constraint arguments, producing an indexed result.
## Selecting a Non-default Provider Configuration ## Selecting a Non-default Provider Configuration
Data resources support [the `provider` meta-argument](/language/meta-arguments/resource-provider) Data resources support [the `provider` meta-argument](/docs/language/meta-arguments/resource-provider.html)
as defined for managed resources, with the same syntax and behavior. as defined for managed resources, with the same syntax and behavior.
## Lifecycle Customizations ## Lifecycle Customizations
@ -174,7 +173,7 @@ and name must be unique.
Within the block (the `{ }`) is configuration for the data instance. The Within the block (the `{ }`) is configuration for the data instance. The
configuration is dependent on the type; as with configuration is dependent on the type; as with
[resources](/language/resources/), each provider on the [resources](/docs/language/resources/index.html), each provider on the
[Terraform Registry](https://registry.terraform.io/browse/providers) has its own [Terraform Registry](https://registry.terraform.io/browse/providers) has its own
documentation for configuring and using the data types it provides. documentation for configuring and using the data types it provides.
@ -192,13 +191,13 @@ resource "aws_instance" "web" {
## Meta-Arguments ## Meta-Arguments
As data sources are essentially a read only subset of resources, they also As data sources are essentially a read only subset of resources, they also
support the same [meta-arguments](/language/resources/syntax#meta-arguments) of resources support the same [meta-arguments](/docs/language/resources/syntax.html#meta-arguments) of resources
with the exception of the with the exception of the
[`lifecycle` configuration block](/language/meta-arguments/lifecycle). [`lifecycle` configuration block](/docs/language/meta-arguments/lifecycle.html).
### Non-Default Provider Configurations ### Non-Default Provider Configurations
Similarly to [resources](/language/resources/), when Similarly to [resources](/docs/language/resources/index.html), when
a module has multiple configurations for the same provider you can specify which a module has multiple configurations for the same provider you can specify which
configuration to use with the `provider` meta-argument: configuration to use with the `provider` meta-argument:
@ -211,7 +210,7 @@ data "aws_ami" "web" {
``` ```
See See
[The Resource `provider` Meta-Argument](/language/meta-arguments/resource-provider) [The Resource `provider` Meta-Argument](/docs/language/meta-arguments/resource-provider.html)
for more information. for more information.
## Data Source Lifecycle ## Data Source Lifecycle

View File

@ -1,9 +1,7 @@
--- ---
page_title: Dependency Lock File (.terraform.lock.hcl) - Configuration Language layout: "language"
description: >- page_title: "Dependency Lock File (.terraform.lock.hcl) - Configuration Language"
Terraform uses the dependency lock file .teraform.lock.hcl to track and select description: "Terraform uses the dependency lock file .teraform.lock.hcl to track and select provider versions. Learn about dependency installation and lock file changes."
provider versions. Learn about dependency installation and lock file changes.
sidebar_title: Dependency Lock File (.terraform.lock.hcl)
--- ---
# Dependency Lock File # Dependency Lock File
@ -17,9 +15,9 @@ information here is not relevant to those versions.
A Terraform configuration may refer to two different kinds of external A Terraform configuration may refer to two different kinds of external
dependency that come from outside of its own codebase: dependency that come from outside of its own codebase:
- [Providers](/language/providers/requirements), which are plugins for Terraform * [Providers](/docs/language/providers/requirements.html), which are plugins for Terraform
that extend it with support for interacting with various external systems. that extend it with support for interacting with various external systems.
- [Modules](/language/modules/), which allow * [Modules](/docs/language/modules/index.html), which allow
splitting out groups of Terraform configuration constructs (written in the splitting out groups of Terraform configuration constructs (written in the
Terraform language) into reusable abstractions. Terraform language) into reusable abstractions.
@ -29,7 +27,7 @@ reason, Terraform must determine which versions of those dependencies are
potentially compatible with the current configuration and which versions are potentially compatible with the current configuration and which versions are
currently selected for use. currently selected for use.
[Version constraints](/language/expressions/version-constraints) within the configuration [Version constraints](/docs/language/expressions/version-constraints.html) within the configuration
itself determine which versions of dependencies are _potentially_ compatible, itself determine which versions of dependencies are _potentially_ compatible,
but after selecting a specific version of each dependency Terraform remembers but after selecting a specific version of each dependency Terraform remembers
the decisions it made in a _dependency lock file_ so that it can (by default) the decisions it made in a _dependency lock file_ so that it can (by default)
@ -54,7 +52,7 @@ to signify that it is a lock file for various items that Terraform caches in
the `.terraform` subdirectory of your working directory. the `.terraform` subdirectory of your working directory.
Terraform automatically creates or updates the dependency lock file each time Terraform automatically creates or updates the dependency lock file each time
you run [the `terraform init` command](/cli/commands/init). You should you run [the `terraform init` command](/docs/cli/commands/init.html). You should
include this file in your version control repository so that you can discuss include this file in your version control repository so that you can discuss
potential changes to your external dependencies via code review, just as you potential changes to your external dependencies via code review, just as you
would discuss potential changes to your configuration itself. would discuss potential changes to your configuration itself.
@ -119,33 +117,33 @@ provider version.
There are two special considerations with the "trust on first use" model: There are two special considerations with the "trust on first use" model:
- If you install a provider from an origin registry which provides checksums * If you install a provider from an origin registry which provides checksums
that are signed with a cryptographic signature, Terraform will treat all that are signed with a cryptographic signature, Terraform will treat all
of the signed checksums as valid as long as one checksum matches. The lock of the signed checksums as valid as long as one checksum matches. The lock
file will therefore include checksums for both the package you installed for file will therefore include checksums for both the package you installed for
your current platform _and_ any other packages that might be available for your current platform _and_ any other packages that might be available for
other platforms. other platforms.
In this case, the `terraform init` output will include the fingerprint of In this case, the `terraform init` output will include the fingerprint of
the key that signed the checksums, with a message like the key that signed the checksums, with a message like
`(signed by a HashiCorp partner, key ID DC9FC6B1FCE47986)`. You may wish to `(signed by a HashiCorp partner, key ID DC9FC6B1FCE47986)`. You may wish to
confirm that you trust the holder of the given key before committing the confirm that you trust the holder of the given key before committing the
lock file containing the signed checksums, or to retrieve and verify the lock file containing the signed checksums, or to retrieve and verify the
full set of available packages for the given provider version. full set of available packages for the given provider version.
- If you install a provider for the first time using an alternative * If you install a provider for the first time using an alternative
installation method, such as a filesystem or network mirror, Terraform will installation method, such as a filesystem or network mirror, Terraform will
not be able to verify the checksums for any platform other than the one not be able to verify the checksums for any platform other than the one
where you ran `terraform init`, and so it will not record the checksums where you ran `terraform init`, and so it will not record the checksums
for other platforms and so the configuration will not be usable on any other for other platforms and so the configuration will not be usable on any other
platform. platform.
To avoid this problem you can pre-populate checksums for a variety of To avoid this problem you can pre-populate checksums for a variety of
different platforms in your lock file using different platforms in your lock file using
[the `terraform providers lock` command](/cli/commands/providers/lock), [the `terraform providers lock` command](/docs/cli/commands/providers/lock.html),
which will then allow future calls to `terraform init` to verify that the which will then allow future calls to `terraform init` to verify that the
packages available in your chosen mirror match the official packages from packages available in your chosen mirror match the official packages from
the provider's origin registry. the provider's origin registry.
## Understanding Lock File Changes ## Understanding Lock File Changes
@ -160,7 +158,7 @@ proposed changes. The following sections will describe these common situations.
### Dependency on a new provider ### Dependency on a new provider
If you add a new entry to the If you add a new entry to the
[provider requirements](/language/providers/requirements) for any module in your [provider requirements](/docs/language/providers/requirements.html) for any module in your
configuration, or if you add an external module that includes a new provider configuration, or if you add an external module that includes a new provider
dependency itself, `terraform init` will respond to that by selecting the dependency itself, `terraform init` will respond to that by selecting the
newest version of that provider which meets all of the version constraints newest version of that provider which meets all of the version constraints
@ -201,13 +199,13 @@ block in the dependency lock file.
The new lock file entry records several pieces of information: The new lock file entry records several pieces of information:
- `version`: the exact version that Terraform selected based on the version * `version`: the exact version that Terraform selected based on the version
constraints in the configuration. constraints in the configuration.
- `constraints`: all of the version constraints that Terraform considered when * `constraints`: all of the version constraints that Terraform considered when
making this selection. (Terraform doesn't actually use this information to making this selection. (Terraform doesn't actually use this information to
make installation decisions, but includes it to help explain to human readers make installation decisions, but includes it to help explain to human readers
how the previous decision was made.) how the previous decision was made.)
- `hashes`: a number of checksums that are all considered to be valid for * `hashes`: a number of checksums that are all considered to be valid for
packages implementing the selected version of this provider on different packages implementing the selected version of this provider on different
platforms. The meaning of these hashes is explained more under platforms. The meaning of these hashes is explained more under
_[New provider package checksums](#new-provider-package-checksums)_ below. _[New provider package checksums](#new-provider-package-checksums)_ below.
@ -299,31 +297,31 @@ additional benefit.
The two hashing schemes currently supported are: The two hashing schemes currently supported are:
- `zh:`: a mnemonic for "zip hash", this is a legacy hash format which is * `zh:`: a mnemonic for "zip hash", this is a legacy hash format which is
part of the Terraform provider registry protocol and is therefore used for part of the Terraform provider registry protocol and is therefore used for
providers that you install directly from an origin registry. providers that you install directly from an origin registry.
This hashing scheme captures a SHA256 hash of each of the official `.zip` This hashing scheme captures a SHA256 hash of each of the official `.zip`
packages indexed in the origin registry. This is an effective scheme for packages indexed in the origin registry. This is an effective scheme for
verifying the official release packages when installed from a registry, but verifying the official release packages when installed from a registry, but
it's not suitable for verifying packages that come from other it's not suitable for verifying packages that come from other
[provider installation methods](/cli/config/config-file#provider-installation), [provider installation methods](/docs/cli/config/config-file.html#provider-installation),
such as filesystem mirrors using the unpacked directory layout. such as filesystem mirrors using the unpacked directory layout.
- `h1:`: a mnemonic for "hash scheme 1", which is the current preferred hashing * `h1:`: a mnemonic for "hash scheme 1", which is the current preferred hashing
scheme. scheme.
Hash scheme 1 is also a SHA256 hash, but is one computed from the _contents_ Hash scheme 1 is also a SHA256 hash, but is one computed from the _contents_
of the provider distribution package, rather than of the `.zip` archive of the provider distribution package, rather than of the `.zip` archive
it's contained within. This scheme therefore has the advantage that it can it's contained within. This scheme therefore has the advantage that it can
be calculated for an official `.zip` file, an unpacked directory with the be calculated for an official `.zip` file, an unpacked directory with the
same contents, or a recompressed `.zip` file which contains the same files same contents, or a recompressed `.zip` file which contains the same files
but potentially different metadata or compression schemes. but potentially different metadata or compression schemes.
Due to the limited scope of the `zh:` scheme, Terraform will Due to the limited scope of the `zh:` scheme, Terraform will
opportunistically add in the corresponding `h1:` checksums as it learns opportunistically add in the corresponding `h1:` checksums as it learns
of them, which is what caused the addition of a second `h1:` checksum of them, which is what caused the addition of a second `h1:` checksum
in the example change shown above. in the example change shown above.
Terraform will add a new hash to an existing provider only if the hash is Terraform will add a new hash to an existing provider only if the hash is
calculated from a package that _also_ matches one of the existing hashes. In calculated from a package that _also_ matches one of the existing hashes. In
@ -348,7 +346,7 @@ your configuration on new target platforms, or if you are installing providers
from a mirror that therefore can't provide official signed checksums, you from a mirror that therefore can't provide official signed checksums, you
can ask Terraform to pre-populate hashes for a chosen set of platforms can ask Terraform to pre-populate hashes for a chosen set of platforms
using using
[the `terraform providers lock` command](/cli/commands/providers/lock): [the `terraform providers lock` command](/docs/cli/commands/providers/lock.html):
``` ```
terraform providers lock \ terraform providers lock \

View File

@ -1,9 +1,7 @@
--- ---
page_title: Conditional Expressions - Configuration Language layout: "language"
description: >- page_title: "Conditional Expressions - Configuration Language"
Conditional expressions select one of two values. You can use them to define description: "Conditional expressions select one of two values. You can use them to define defaults to replace invalid values."
defaults to replace invalid values.
sidebar_title: Conditional Expressions
--- ---
# Conditional Expressions # Conditional Expressions
@ -65,7 +63,7 @@ be some uncertainty about the expected result type.
The following example is contrived because it would be easier to write the The following example is contrived because it would be easier to write the
constant `"12"` instead of the type conversion in this case, but shows how to constant `"12"` instead of the type conversion in this case, but shows how to
use [`tostring`](/language/functions/tostring) to explicitly convert a number to use [`tostring`](/docs/language/functions/tostring.html) to explicitly convert a number to
a string. a string.
```hcl ```hcl

View File

@ -1,11 +1,10 @@
--- ---
page_title: Dynamic Blocks - Configuration Language layout: "language"
description: >- page_title: "Dynamic Blocks - Configuration Language"
Dynamic blocks automatically construct multi-level, nested block structures. description: "Dynamic blocks automatically construct multi-level, nested block structures. Learn to configure dynamic blocks and understand their behavior."
Learn to configure dynamic blocks and understand their behavior.
sidebar_title: Dynamic Blocks
--- ---
# `dynamic` Blocks # `dynamic` Blocks
Within top-level block constructs like resources, expressions can usually be Within top-level block constructs like resources, expressions can usually be
@ -45,7 +44,7 @@ resource "aws_elastic_beanstalk_environment" "tfenvtest" {
} }
``` ```
A `dynamic` block acts much like a [`for` expression](/language/expressions/for), but produces A `dynamic` block acts much like a [`for` expression](for.html), but produces
nested blocks instead of a complex typed value. It iterates over a given nested blocks instead of a complex typed value. It iterates over a given
complex value, and generates a nested block for each element of that complex complex value, and generates a nested block for each element of that complex
value. value.
@ -69,10 +68,10 @@ collection.
The iterator object (`setting` in the example above) has two attributes: The iterator object (`setting` in the example above) has two attributes:
- `key` is the map key or list element index for the current element. If the * `key` is the map key or list element index for the current element. If the
`for_each` expression produces a _set_ value then `key` is identical to `for_each` expression produces a _set_ value then `key` is identical to
`value` and should not be used. `value` and should not be used.
- `value` is the value of the current element. * `value` is the value of the current element.
A `dynamic` block can only generate arguments that belong to the resource type, A `dynamic` block can only generate arguments that belong to the resource type,
data source, provider or provisioner being configured. It is _not_ possible data source, provider or provisioner being configured. It is _not_ possible
@ -85,9 +84,9 @@ nested block. If you need to declare resource instances based on a nested
data structure or combinations of elements from multiple data structures you data structure or combinations of elements from multiple data structures you
can use Terraform expressions and functions to derive a suitable value. can use Terraform expressions and functions to derive a suitable value.
For some common examples of such situations, see the For some common examples of such situations, see the
[`flatten`](/language/functions/flatten) [`flatten`](/docs/language/functions/flatten.html)
and and
[`setproduct`](/language/functions/setproduct) [`setproduct`](/docs/language/functions/setproduct.html)
functions. functions.
## Multi-level Nested Block Structures ## Multi-level Nested Block Structures
@ -152,5 +151,5 @@ nested blocks using directly-corresponding attributes from an input variable
then that might suggest that your module is not creating a useful abstraction. then that might suggest that your module is not creating a useful abstraction.
It may be better for the calling module to define the resource itself then It may be better for the calling module to define the resource itself then
pass information about it into your module. For more information on this design pass information about it into your module. For more information on this design
tradeoff, see [When to Write a Module](/language/modules/develop/#when-to-write-a-module) tradeoff, see [When to Write a Module](/docs/language/modules/develop/index.html#when-to-write-a-module)
and [Module Composition](/language/modules/develop/composition). and [Module Composition](/docs/language/modules/develop/composition.html).

View File

@ -1,9 +1,7 @@
--- ---
page_title: For Expressions - Configuration Language layout: "language"
description: >- page_title: "For Expressions - Configuration Language"
For expressions transform complex input values into complex output values. description: "For expressions transform complex input values into complex output values. Learn how to filter inputs and how to group results."
Learn how to filter inputs and how to group results.
sidebar_title: For Expressions
--- ---
# `for` Expressions # `for` Expressions
@ -132,7 +130,7 @@ For sets of other types, Terraform uses an arbitrary ordering that may change
in future versions of Terraform. For that reason, we recommend converting the in future versions of Terraform. For that reason, we recommend converting the
result of such an expression to itself be a set so that it's clear elsewhere result of such an expression to itself be a set so that it's clear elsewhere
in the configuration that the result is unordered. You can use in the configuration that the result is unordered. You can use
[the `toset` function](/language/functions/toset) [the `toset` function](/docs/language/functions/toset.html)
to concisely convert a `for` expression result to be of a set type. to concisely convert a `for` expression result to be of a set type.
```hcl ```hcl
@ -209,4 +207,4 @@ Some resource types also define _nested block types_, which typically represent
separate objects that belong to the containing resource in some way. You can't separate objects that belong to the containing resource in some way. You can't
dynamically generate nested blocks using `for` expressions, but you _can_ dynamically generate nested blocks using `for` expressions, but you _can_
generate nested blocks for a resource dynamically using generate nested blocks for a resource dynamically using
[`dynamic` blocks](/language/expressions/dynamic-blocks). [`dynamic` blocks](dynamic-blocks.html).

View File

@ -1,9 +1,7 @@
--- ---
page_title: Function Calls - Configuration Language layout: "language"
description: >- page_title: "Function Calls - Configuration Language"
Functions transform and combine values. Learn about Terraform's built-in description: "Functions transform and combine values. Learn about Terraform's built-in functions."
functions.
sidebar_title: Function Calls
--- ---
# Function Calls # Function Calls
@ -11,7 +9,7 @@ sidebar_title: Function Calls
> **Hands-on:** Try the [Perform Dynamic Operations with Functions](https://learn.hashicorp.com/tutorials/terraform/functions?in=terraform/configuration-language&utm_source=WEBSITE&utm_medium=WEB_IO&utm_offer=ARTICLE_PAGE&utm_content=DOCS) tutorial on HashiCorp Learn. > **Hands-on:** Try the [Perform Dynamic Operations with Functions](https://learn.hashicorp.com/tutorials/terraform/functions?in=terraform/configuration-language&utm_source=WEBSITE&utm_medium=WEB_IO&utm_offer=ARTICLE_PAGE&utm_content=DOCS) tutorial on HashiCorp Learn.
The Terraform language has a number of The Terraform language has a number of
[built-in functions](/language/functions/) that can be used [built-in functions](/docs/language/functions/index.html) that can be used
in expressions to transform and combine values. These in expressions to transform and combine values. These
are similar to the operators but all follow a common syntax: are similar to the operators but all follow a common syntax:
@ -36,7 +34,7 @@ A function call expression evaluates to the function's return value.
## Available Functions ## Available Functions
For a full list of available functions, see For a full list of available functions, see
[the function reference](/language/functions/). [the function reference](/docs/language/functions/index.html).
## Expanding Function Arguments ## Expanding Function Arguments
@ -53,8 +51,8 @@ The expansion symbol is three periods (`...`), not a Unicode ellipsis character
## Using Sensitive Data as Function Arguments ## Using Sensitive Data as Function Arguments
When using sensitive data, such as [an input variable](/language/values/variables#suppressing-values-in-cli-output) When using sensitive data, such as [an input variable](https://www.terraform.io/docs/language/values/variables.html#suppressing-values-in-cli-output)
or [an output defined](/language/values/outputs#sensitive-suppressing-values-in-cli-output) as sensitive or [an output defined](https://www.terraform.io/docs/language/values/outputs.html#sensitive-suppressing-values-in-cli-output) as sensitive
as function arguments, the result of the function call will be marked as sensitive. as function arguments, the result of the function call will be marked as sensitive.
This is a conservative behavior that is true irrespective of the function being This is a conservative behavior that is true irrespective of the function being
@ -83,10 +81,10 @@ those it can be helpful to know when Terraform will call them in relation to
other events that occur in a Terraform run. other events that occur in a Terraform run.
The small set of special functions includes The small set of special functions includes
[`file`](/language/functions/file), [`file`](/docs/language/functions/file.html),
[`templatefile`](/language/functions/templatefile), [`templatefile`](/docs/language/functions/templatefile.html),
[`timestamp`](/language/functions/timestamp), [`timestamp`](/docs/language/functions/timestamp.html),
and [`uuid`](/language/functions/uuid). and [`uuid`](/docs/language/functions/uuid.html).
If you are not working with these functions then you don't need If you are not working with these functions then you don't need
to read this section, although the information here may still be interesting to read this section, although the information here may still be interesting
background information. background information.
@ -105,7 +103,7 @@ both cause the final configuration during the apply step not to match the
actions shown in the plan, which violates the Terraform execution model. actions shown in the plan, which violates the Terraform execution model.
For that reason, Terraform arranges for both of those functions to produce For that reason, Terraform arranges for both of those functions to produce
[unknown value](/language/expressions/references#values-not-yet-known) results during the [unknown value](references.html#values-not-yet-known) results during the
plan step, with the real result being decided only during the apply step. plan step, with the real result being decided only during the apply step.
For `timestamp` in particular, this means that the recorded time will be For `timestamp` in particular, this means that the recorded time will be
the instant when Terraform began applying the change, rather than when the instant when Terraform began applying the change, rather than when

View File

@ -1,9 +1,7 @@
--- ---
page_title: Expressions - Configuration Language layout: "language"
description: >- page_title: "Expressions - Configuration Language"
An overview of expressions to reference or compute values in Terraform description: "An overview of expressions to reference or compute values in Terraform configurations, including types, operators, and functions."
configurations, including types, operators, and functions.
sidebar_title: Expressions
--- ---
# Expressions # Expressions
@ -19,54 +17,54 @@ and a number of built-in functions.
Expressions can be used in a number of places in the Terraform language, Expressions can be used in a number of places in the Terraform language,
but some contexts limit which expression constructs are allowed, but some contexts limit which expression constructs are allowed,
such as requiring a literal value of a particular type or forbidding such as requiring a literal value of a particular type or forbidding
[references to resource attributes](/language/expressions/references#references-to-resource-attributes). [references to resource attributes](/docs/language/expressions/references.html#references-to-resource-attributes).
Each language feature's documentation describes any restrictions it places on Each language feature's documentation describes any restrictions it places on
expressions. expressions.
You can experiment with the behavior of Terraform's expressions from You can experiment with the behavior of Terraform's expressions from
the Terraform expression console, by running the Terraform expression console, by running
[the `terraform console` command](/cli/commands/console). [the `terraform console` command](/docs/cli/commands/console.html).
The other pages in this section describe the features of Terraform's The other pages in this section describe the features of Terraform's
expression syntax. expression syntax.
- [Types and Values](/language/expressions/types) - [Types and Values](/docs/language/expressions/types.html)
documents the data types that Terraform expressions can resolve to, and the documents the data types that Terraform expressions can resolve to, and the
literal syntaxes for values of those types. literal syntaxes for values of those types.
- [Strings and Templates](/language/expressions/strings) - [Strings and Templates](/docs/language/expressions/strings.html)
documents the syntaxes for string literals, including interpolation sequences documents the syntaxes for string literals, including interpolation sequences
and template directives. and template directives.
- [References to Values](/language/expressions/references) - [References to Values](/docs/language/expressions/references.html)
documents how to refer to named values like variables and resource attributes. documents how to refer to named values like variables and resource attributes.
- [Operators](/language/expressions/operators) - [Operators](/docs/language/expressions/operators.html)
documents the arithmetic, comparison, and logical operators. documents the arithmetic, comparison, and logical operators.
- [Function Calls](/language/expressions/function-calls) - [Function Calls](/docs/language/expressions/function-calls.html)
documents the syntax for calling Terraform's built-in functions. documents the syntax for calling Terraform's built-in functions.
- [Conditional Expressions](/language/expressions/conditionals) - [Conditional Expressions](/docs/language/expressions/conditionals.html)
documents the `<CONDITION> ? <TRUE VAL> : <FALSE VAL>` expression, which documents the `<CONDITION> ? <TRUE VAL> : <FALSE VAL>` expression, which
chooses between two values based on a bool condition. chooses between two values based on a bool condition.
- [For Expressions](/language/expressions/for) - [For Expressions](/docs/language/expressions/for.html)
documents expressions like `[for s in var.list : upper(s)]`, which can documents expressions like `[for s in var.list : upper(s)]`, which can
transform a complex type value into another complex type value. transform a complex type value into another complex type value.
- [Splat Expressions](/language/expressions/splat) - [Splat Expressions](/docs/language/expressions/splat.html)
documents expressions like `var.list[*].id`, which can extract simpler documents expressions like `var.list[*].id`, which can extract simpler
collections from more complicated expressions. collections from more complicated expressions.
- [Dynamic Blocks](/language/expressions/dynamic-blocks) - [Dynamic Blocks](/docs/language/expressions/dynamic-blocks.html)
documents a way to create multiple repeatable nested blocks within a resource documents a way to create multiple repeatable nested blocks within a resource
or other construct. or other construct.
- [Type Constraints](/language/expressions/type-constraints) - [Type Constraints](/docs/language/expressions/type-constraints.html)
documents the syntax for referring to a type, rather than a value of that documents the syntax for referring to a type, rather than a value of that
type. Input variables expect this syntax in their `type` argument. type. Input variables expect this syntax in their `type` argument.
- [Version Constraints](/language/expressions/version-constraints) - [Version Constraints](/docs/language/expressions/version-constraints.html)
documents the syntax of special strings that define a set of allowed software documents the syntax of special strings that define a set of allowed software
versions. Terraform uses version constraints in several places. versions. Terraform uses version constraints in several places.

View File

@ -1,9 +1,7 @@
--- ---
page_title: Operators - Configuration Language layout: "language"
description: >- page_title: "Operators - Configuration Language"
Operators transform or combine expressions. Learn about arithmetic, logical, description: "Operators transform or combine expressions. Learn about arithmetic, logical, equality, and comparison operators."
equality, and comparison operators.
sidebar_title: Operators
--- ---
# Arithmetic and Logical Operators # Arithmetic and Logical Operators
@ -57,9 +55,9 @@ as results:
* `-a` returns the result of multiplying `a` by `-1`. * `-a` returns the result of multiplying `a` by `-1`.
Terraform supports some other less-common numeric operations as Terraform supports some other less-common numeric operations as
[functions](/language/expressions/function-calls). For example, you can calculate exponents [functions](function-calls.html). For example, you can calculate exponents
using using
[the `pow` function](/language/functions/pow). [the `pow` function](/docs/language/functions/pow.html).
## Equality Operators ## Equality Operators

Some files were not shown because too many files have changed in this diff Show More