Merge pull request #30001 from hashicorp/revert-commit
Revert "migrate docs to mdx"
This commit is contained in:
commit
ce1dbd7d2c
|
@ -1,23 +1,21 @@
|
|||
---
|
||||
page_title: Authentication - Terraform CLI
|
||||
description: >-
|
||||
Documentation about the login and logout commands that help automate getting
|
||||
an API token for your Terraform Cloud account.
|
||||
sidebar_title: Authentication
|
||||
layout: "docs"
|
||||
page_title: "Authentication - Terraform CLI"
|
||||
description: "Documentation about the login and logout commands that help automate getting an API token for your Terraform Cloud account."
|
||||
---
|
||||
|
||||
# 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.
|
||||
|
||||
[Terraform Cloud](/cloud-docs/) and
|
||||
[Terraform Enterprise](/enterprise/) are platforms that perform
|
||||
[Terraform Cloud](/docs/cloud/index.html) and
|
||||
[Terraform Enterprise](/docs/enterprise/index.html) are platforms that perform
|
||||
Terraform runs to provision infrastructure, offering a collaboration-focused
|
||||
environment that makes it easier for teams to use Terraform together. (For
|
||||
expediency, the content below refers to both products as "Terraform Cloud.")
|
||||
|
||||
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
|
||||
registry. All of these integrations require you to authenticate Terraform CLI
|
||||
with your Terraform Cloud account.
|
||||
|
@ -28,5 +26,5 @@ Terraform Cloud user account.
|
|||
|
||||
For details, see:
|
||||
|
||||
- [The `terraform login` command](/cli/commands/login)
|
||||
- [The `terraform logout` command](/cli/commands/logout)
|
||||
- [The `terraform login` command](/docs/cli/commands/login.html)
|
||||
- [The `terraform logout` command](/docs/cli/commands/logout.html)
|
|
@ -1,14 +1,12 @@
|
|||
---
|
||||
page_title: Writing and Modifying Code - Terraform CLI
|
||||
description: >-
|
||||
Learn commands that help validate, format, and upgrade code written in the
|
||||
Terraform Configuration Language.
|
||||
sidebar_title: Writing and Modifying Code
|
||||
layout: "docs"
|
||||
page_title: "Writing and Modifying Code - Terraform CLI"
|
||||
description: "Learn commands that help validate, format, and upgrade code written in the Terraform Configuration Language."
|
||||
---
|
||||
|
||||
# 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
|
||||
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
|
||||
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
|
||||
[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.
|
||||
|
||||
- [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
|
||||
waste time making minor adjustments for readability and consistency. It works
|
||||
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,
|
||||
including argument and attribute names and types for resources and modules.
|
||||
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
|
||||
continuous integration pipeline.
|
||||
|
||||
- [The `0.13upgrade` command](/cli/commands/0.13upgrade) and
|
||||
[the `0.12upgrade` command](/cli/commands/0.12upgrade) can automatically
|
||||
- [The `0.13upgrade` command](/docs/cli/commands/0.13upgrade.html) and
|
||||
[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
|
||||
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
|
||||
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
|
||||
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.
|
|
@ -1,8 +1,9 @@
|
|||
---
|
||||
page_title: 'Command: 0.12upgrade'
|
||||
description: >-
|
||||
The 0.12upgrade subcommand automatically rewrites existing configurations for
|
||||
Terraform 0.12 compatibility.
|
||||
layout: "docs"
|
||||
page_title: "Command: 0.12upgrade"
|
||||
sidebar_current: "docs-commands-012upgrade"
|
||||
description: |-
|
||||
The 0.12upgrade subcommand automatically rewrites existing configurations for Terraform 0.12 compatibility.
|
||||
---
|
||||
|
||||
# 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
|
||||
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
|
||||
|
||||
|
@ -70,13 +71,13 @@ the change.
|
|||
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
|
||||
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
|
||||
[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
|
||||
change for v0.11 callers. If a module is installed directly from a version
|
||||
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.
|
||||
|
||||
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
|
||||
```
|
||||
|
||||
Once installed, run the above command line using `gfind` instead of `find`.
|
||||
|
||||
|
||||
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.
|
||||
|
|
@ -1,8 +1,9 @@
|
|||
---
|
||||
page_title: 'Command: 0.13upgrade'
|
||||
description: >-
|
||||
The 0.13upgrade subcommand updates existing configurations to use the new
|
||||
provider source features from Terraform 0.13.
|
||||
layout: "docs"
|
||||
page_title: "Command: 0.13upgrade"
|
||||
sidebar_current: "docs-commands-013upgrade"
|
||||
description: |-
|
||||
The 0.13upgrade subcommand updates existing configurations to use the new provider source features from Terraform 0.13.
|
||||
---
|
||||
|
||||
# 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
|
||||
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
|
||||
|
||||
|
@ -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
|
||||
[`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.
|
||||
|
|
@ -1,8 +1,8 @@
|
|||
---
|
||||
page_title: 'Command: apply'
|
||||
description: >-
|
||||
The terraform apply command executes the actions proposed in a Terraform plan
|
||||
to create, update, or destroy infrastructure.
|
||||
layout: "docs"
|
||||
page_title: "Command: apply"
|
||||
sidebar_current: "docs-commands-apply"
|
||||
description: "The terraform apply command executes the actions proposed in a Terraform plan to create, update, or destroy infrastructure."
|
||||
---
|
||||
|
||||
# Command: apply
|
||||
|
@ -33,15 +33,15 @@ you pass it the filename of a previously-saved plan file.
|
|||
### Automatic Plan Mode
|
||||
|
||||
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
|
||||
taking the described actions, unless you waive that prompt by using the
|
||||
`-auto-approve` option.
|
||||
|
||||
When performing its own plan, `terraform apply` supports all of the same
|
||||
[planning modes](/cli/commands/plan#planning-modes) and
|
||||
[planning options](/cli/commands/plan#planning-options) that `terraform plan` would
|
||||
[planning modes](./plan.html#planning-modes) and
|
||||
[planning options](./plan.html#planning-options) that `terraform plan` would
|
||||
accept, so you can customize how Terraform will create the plan.
|
||||
|
||||
### 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`
|
||||
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
|
||||
[`terraform show`](/cli/commands/show).
|
||||
[`terraform show`](./show.html).
|
||||
|
||||
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
|
||||
|
@ -61,8 +61,8 @@ decisions.
|
|||
When run without a saved plan file, `terraform apply` supports all of `terraform
|
||||
plan`'s planning modes and planning options. For details, see:
|
||||
|
||||
* [Planning Modes](/cli/commands/plan#planning-modes)
|
||||
* [Planning Options](/cli/commands/plan#planning-options)
|
||||
- [Planning Modes](./plan.html#planning-modes)
|
||||
- [Planning Options](./plan.html#planning-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
|
||||
`terraform apply` _without_ a previously-saved plan file, these options are
|
||||
_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
|
||||
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
|
||||
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
|
||||
dangerous if others might concurrently run commands against the same
|
||||
workspace.
|
||||
dangerous if others might concurrently run commands against the same
|
||||
workspace.
|
||||
|
||||
* `-lock-timeout=DURATION` - Unless locking is disabled with `-lock=false`,
|
||||
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.
|
||||
|
||||
* `-parallelism=n` - Limit the number of concurrent operation as Terraform
|
||||
[walks the graph](/internals/graph#walking-the-graph). Defaults to
|
||||
10\.
|
||||
[walks the graph](/docs/internals/graph.html#walking-the-graph). Defaults to
|
||||
10.
|
||||
|
||||
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
|
||||
[`-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
|
||||
|
||||
|
@ -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.
|
||||
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
|
||||
in the given directory for all files it would normally read or write in the
|
||||
current working directory.
|
||||
|
@ -135,6 +135,6 @@ current working directory.
|
|||
If your previous use of this legacy pattern was also relying on Terraform
|
||||
writing the `.terraform` subdirectory into the current working directory even
|
||||
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
|
||||
than the current working directory.
|
|
@ -1,36 +1,37 @@
|
|||
---
|
||||
page_title: 'Command: console'
|
||||
description: >-
|
||||
The terraform console command provides an interactive console for evaluating
|
||||
expressions.
|
||||
layout: "docs"
|
||||
page_title: "Command: console"
|
||||
sidebar_current: "docs-commands-console"
|
||||
description: "The terraform console command provides an interactive console for
|
||||
evaluating expressions."
|
||||
---
|
||||
|
||||
# Command: console
|
||||
|
||||
The `terraform console` command provides an interactive console for
|
||||
evaluating [expressions](/language/expressions/).
|
||||
evaluating [expressions](/docs/language/expressions/index.html).
|
||||
|
||||
## Usage
|
||||
|
||||
Usage: `terraform console [options]`
|
||||
|
||||
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,
|
||||
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
|
||||
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
|
||||
or Control-D.
|
||||
|
||||
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
|
||||
[`-state`](/language/settings/backends/local#command-line-arguments).
|
||||
[`-state`](/docs/language/settings/backends/local.html#command-line-arguments).
|
||||
|
||||
## Scripting
|
||||
|
||||
|
@ -51,7 +52,7 @@ tolist([
|
|||
|
||||
## 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
|
||||
before evaluating any expressions.
|
||||
|
|
@ -1,8 +1,8 @@
|
|||
---
|
||||
page_title: 'Command: destroy'
|
||||
description: >-
|
||||
The terraform destroy command destroys all objects managed by a Terraform
|
||||
configuration.
|
||||
layout: "docs"
|
||||
page_title: "Command: destroy"
|
||||
sidebar_current: "docs-commands-destroy"
|
||||
description: "The terraform destroy command destroys all objects managed by a Terraform configuration."
|
||||
---
|
||||
|
||||
# Command: destroy
|
||||
|
@ -27,7 +27,7 @@ terraform apply -destroy
|
|||
```
|
||||
|
||||
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"
|
||||
planning mode.
|
||||
|
||||
|
@ -38,7 +38,7 @@ destroying would be, by running the following command:
|
|||
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.
|
||||
|
||||
-> **Note:** The `-destroy` option to `terraform apply` exists only in
|
|
@ -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.
|
|
@ -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.
|
|
@ -1,15 +1,15 @@
|
|||
---
|
||||
page_title: 'Command: fmt'
|
||||
description: >-
|
||||
The terraform fmt command rewrites configuration files to a canonical format
|
||||
and style.
|
||||
layout: "docs"
|
||||
page_title: "Command: fmt"
|
||||
sidebar_current: "docs-commands-fmt"
|
||||
description: "The terraform fmt command rewrites configuration files to a canonical format and style."
|
||||
---
|
||||
|
||||
# Command: fmt
|
||||
|
||||
The `terraform fmt` command is used to rewrite Terraform configuration files
|
||||
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.
|
||||
|
||||
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.)
|
||||
* `-diff` - Display diffs of formatting changes
|
||||
* `-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.
|
|
@ -1,8 +1,8 @@
|
|||
---
|
||||
page_title: 'Command: force-unlock'
|
||||
description: >-
|
||||
The terraform force-unlock command unlocks the state for a configuration. It
|
||||
does not modify your infrastructure.
|
||||
layout: "docs"
|
||||
page_title: "Command: force-unlock"
|
||||
sidebar_current: "docs-commands-force-unlock"
|
||||
description: "The terraform force-unlock command unlocks the state for a configuration. It does not modify your infrastructure."
|
||||
---
|
||||
|
||||
# Command: force-unlock
|
||||
|
@ -27,4 +27,4 @@ process.
|
|||
|
||||
Options:
|
||||
|
||||
* `-force` - Don't ask for input for unlock confirmation.
|
||||
* `-force` - Don't ask for input for unlock confirmation.
|
|
@ -1,12 +1,14 @@
|
|||
---
|
||||
page_title: 'Command: get'
|
||||
description: The terraform get command downloads and updates modules.
|
||||
layout: "docs"
|
||||
page_title: "Command: get"
|
||||
sidebar_current: "docs-commands-get"
|
||||
description: "The terraform get command downloads and updates modules."
|
||||
---
|
||||
|
||||
# Command: get
|
||||
|
||||
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
|
||||
|
||||
|
@ -19,6 +21,6 @@ repository.
|
|||
The `get` command supports the following option:
|
||||
|
||||
* `-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.
|
|
@ -1,8 +1,8 @@
|
|||
---
|
||||
page_title: 'Command: graph'
|
||||
description: >-
|
||||
The terraform graph command generates a visual representation of a
|
||||
configuration or execution plan that you can use to generate charts.
|
||||
layout: "docs"
|
||||
page_title: "Command: graph"
|
||||
sidebar_current: "docs-commands-graph"
|
||||
description: "The terraform graph command generates a visual representation of a configuration or execution plan that you can use to generate charts."
|
||||
---
|
||||
|
||||
# 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
|
||||
[GraphViz](http://www.graphviz.org) to generate charts.
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
Usage: `terraform graph [options]`
|
||||
|
@ -32,16 +33,16 @@ argument.
|
|||
Options:
|
||||
|
||||
* `-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.
|
||||
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`,
|
||||
`validate`, `input`, `refresh`.
|
||||
`validate`, `input`, `refresh`.
|
||||
|
||||
* `-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
|
||||
|
||||
|
@ -54,4 +55,4 @@ $ terraform graph | dot -Tsvg > graph.svg
|
|||
```
|
||||
|
||||
Here is an example graph output:
|
||||
![Graph Example](/img/docs/graph-example.png)
|
||||
![Graph Example](docs/graph-example.png)
|
|
@ -1,6 +1,8 @@
|
|||
---
|
||||
page_title: 'Command: import'
|
||||
description: The terraform import command brings existing resources into Terraform state.
|
||||
layout: "docs"
|
||||
page_title: "Command: import"
|
||||
sidebar_current: "docs-commands-import"
|
||||
description: "The terraform import command brings existing resources into Terraform state."
|
||||
---
|
||||
|
||||
# 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.
|
||||
|
||||
The `terraform import` command is used to
|
||||
[import existing resources](/cli/import/)
|
||||
[import existing resources](/docs/cli/import/index.html)
|
||||
into Terraform.
|
||||
|
||||
## 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
|
||||
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
|
||||
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.
|
||||
If you import the same object multiple times, Terraform may exhibit unwanted
|
||||
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:
|
||||
|
||||
|
@ -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.
|
||||
|
||||
* `-lock=false` - Don't hold a state lock during the operation. This is
|
||||
dangerous if others might concurrently run commands against the same
|
||||
workspace.
|
||||
dangerous if others might concurrently run commands against the same
|
||||
workspace.
|
||||
|
||||
* `-lock-timeout=0s` - Duration to retry a state lock.
|
||||
|
||||
* `-no-color` - If specified, output won't contain any color.
|
||||
|
||||
* `-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.
|
||||
|
||||
* `-provider=provider` - **Deprecated** Override the provider configuration to
|
||||
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.
|
||||
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.
|
||||
|
||||
* `-var 'foo=bar'` - Set a variable in the Terraform configuration. This flag
|
||||
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.
|
||||
This is only useful with the `-config` flag.
|
||||
|
||||
* `-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
|
||||
directory, they will be automatically loaded. `terraform.tfvars` is loaded
|
||||
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.
|
||||
|
||||
For configurations using
|
||||
[the `remote` backend](/language/settings/backends/remote)
|
||||
[the `remote` backend](/docs/language/settings/backends/remote.html)
|
||||
only, `terraform import`
|
||||
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
|
||||
[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
|
||||
[`-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
|
||||
|
||||
|
@ -133,7 +135,7 @@ $ terraform import module.foo.aws_instance.bar i-abcd1234
|
|||
## 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
|
||||
[`count`](/language/meta-arguments/count):
|
||||
[`count`](/docs/language/meta-arguments/count.html):
|
||||
|
||||
```shell
|
||||
$ 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
|
||||
|
||||
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:
|
||||
|
|
@ -1,6 +1,8 @@
|
|||
---
|
||||
page_title: Basic CLI Features
|
||||
description: An introduction to the terraform command and its available subcommands.
|
||||
layout: "docs"
|
||||
page_title: "Basic CLI Features"
|
||||
sidebar_current: "docs-commands"
|
||||
description: "An introduction to the terraform command and its available subcommands."
|
||||
---
|
||||
|
||||
# Basic CLI Features
|
||||
|
@ -15,8 +17,8 @@ of this page.
|
|||
We refer to the `terraform` command line tool as "Terraform CLI" elsewhere
|
||||
in the documentation. This terminology is often used to distinguish it from
|
||||
other components you might use in the Terraform product family, such as
|
||||
[Terraform Cloud](/cloud-docs/) or
|
||||
the various [Terraform providers](/language/providers/), which
|
||||
[Terraform Cloud](/docs/cloud/) or
|
||||
the various [Terraform providers](/docs/language/providers/index.html), which
|
||||
are developed and released separately from Terraform CLI.
|
||||
|
||||
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
|
||||
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`
|
||||
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.
|
||||
|
||||
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
|
||||
supported in this file:
|
||||
|
|
@ -1,8 +1,8 @@
|
|||
---
|
||||
page_title: 'Command: init'
|
||||
description: >-
|
||||
The terraform init command initializes a working directory containing
|
||||
configuration files and installs plugins for required providers.
|
||||
layout: "docs"
|
||||
page_title: "Command: init"
|
||||
sidebar_current: "docs-commands-init"
|
||||
description: "The terraform init command initializes a working directory containing configuration files and installs plugins for required providers."
|
||||
---
|
||||
|
||||
# Command: init
|
||||
|
@ -74,7 +74,7 @@ activating credentials) before running `terraform init`.
|
|||
## Backend Initialization
|
||||
|
||||
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.
|
||||
|
||||
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.
|
||||
|
||||
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
|
||||
be statically specified in the configuration file.
|
||||
|
||||
## Child Module Installation
|
||||
|
||||
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.
|
||||
|
||||
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
|
||||
wish to install providers from their origin registries, you can customize how
|
||||
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
|
||||
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
|
||||
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
|
||||
when you run `terraform init` again in future Terraform will select exactly
|
||||
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:
|
||||
|
||||
* `-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
|
||||
cause Terraform to ignore any selections recorded in the dependency lock
|
||||
file, and to take the newest available version matching the configured
|
||||
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
|
||||
[`provider_installation`](/cli/config/config-file#provider-installation) and
|
||||
[`plugin_cache_dir`](/cli/config/config-file#plugin_cache_dir) settings.
|
||||
It should not be used in Terraform versions 0.13+, and this option
|
||||
was removed in Terraform 0.15.
|
||||
* `-plugin-dir=PATH` — Force plugin installation to read plugins _only_ from
|
||||
-> Note: Since Terraform 0.13, this option has been superseded by the
|
||||
[`provider_installation`](/docs/cli/config/config-file.html#provider-installation) and
|
||||
[`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
|
||||
was removed in Terraform 0.15.
|
||||
- `-plugin-dir=PATH` — Force plugin installation to read plugins _only_ from
|
||||
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
|
||||
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,
|
||||
such as if you are testing a local build of a provider plugin you are
|
||||
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:
|
||||
|
||||
* 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
|
||||
update the lockfile with third-party dependency management tools, it would be
|
||||
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
|
||||
plan to remove it in Terraform v0.15. 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
|
||||
in the given directory for all files it would normally read or write in the
|
||||
current working directory.
|
||||
|
@ -200,6 +200,6 @@ current working directory.
|
|||
If your previous use of this legacy pattern was also relying on Terraform
|
||||
writing the `.terraform` subdirectory into the current working directory even
|
||||
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
|
||||
than the current working directory.
|
|
@ -1,9 +1,9 @@
|
|||
---
|
||||
page_title: 'Command: login'
|
||||
description: >-
|
||||
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.
|
||||
layout: "docs"
|
||||
page_title: "Command: login"
|
||||
sidebar_current: "docs-commands-login"
|
||||
description: |-
|
||||
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
|
||||
|
@ -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
|
||||
is running. If you are running Terraform in an unattended automation scenario,
|
||||
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
|
||||
|
||||
|
@ -34,12 +34,12 @@ not as desired.
|
|||
|
||||
If you don't wish to store your API token in the default location, you can
|
||||
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
|
||||
your organization's existing secrets management system.
|
||||
|
||||
## Login Server Support
|
||||
|
||||
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.
|
|
@ -1,8 +1,9 @@
|
|||
---
|
||||
page_title: 'Command: logout'
|
||||
description: >-
|
||||
The terraform logout command is used to remove credentials stored by terraform
|
||||
login.
|
||||
layout: "docs"
|
||||
page_title: "Command: logout"
|
||||
sidebar_current: "docs-commands-logout"
|
||||
description: |-
|
||||
The terraform logout command is used to remove credentials stored by terraform login.
|
||||
---
|
||||
|
||||
# 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
|
||||
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.
|
|
@ -1,8 +1,9 @@
|
|||
---
|
||||
page_title: 'Command: output'
|
||||
description: >-
|
||||
The `terraform output` command is used to extract the value of an output
|
||||
variable from the state file.
|
||||
layout: "docs"
|
||||
page_title: "Command: output"
|
||||
sidebar_current: "docs-commands-output"
|
||||
description: |-
|
||||
The `terraform output` command is used to extract the value of an output variable from the state file.
|
||||
---
|
||||
|
||||
# Command: output
|
||||
|
@ -21,20 +22,20 @@ output is printed.
|
|||
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
|
||||
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.
|
||||
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.
|
||||
* `-raw` - If specified, Terraform will convert the specified output value to a
|
||||
string and print that string directly to the output, without any special
|
||||
formatting. This can be convenient when working with shell scripts, but
|
||||
it only supports string, number, and boolean values. Use `-json` instead
|
||||
for processing complex data types.
|
||||
string and print that string directly to the output, without any special
|
||||
formatting. This can be convenient when working with shell scripts, but
|
||||
it only supports string, number, and boolean values. Use `-json` instead
|
||||
for processing complex data types.
|
||||
* `-no-color` - If specified, output won't contain any color.
|
||||
* `-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
|
||||
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
|
||||
|
|
@ -1,8 +1,8 @@
|
|||
---
|
||||
page_title: 'Command: plan'
|
||||
description: >-
|
||||
The terraform plan command creates an execution plan with a preview of the
|
||||
changes that Terraform will make to your infrastructure.
|
||||
layout: "docs"
|
||||
page_title: "Command: plan"
|
||||
sidebar_current: "docs-commands-plan"
|
||||
description: "The terraform plan command creates an execution plan with a preview of the changes that Terraform will make to your infrastructure."
|
||||
---
|
||||
|
||||
# Command: plan
|
||||
|
@ -31,12 +31,12 @@ to be taken.
|
|||
|
||||
If you are using Terraform directly in an interactive terminal and you expect
|
||||
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.
|
||||
|
||||
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
|
||||
[`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
|
||||
[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
|
||||
modes, there are also some options you can set in order to customize the
|
||||
planning process for unusual needs.
|
||||
* **[Resource Targeting](#resource-targeting)** is one particular
|
||||
special planning option that has some important caveats associated
|
||||
with it.
|
||||
* **[Resource Targeting](#resource-targeting)** is one particular
|
||||
special planning option that has some important caveats associated
|
||||
with it.
|
||||
* **[Other Options](#other-options)**: These change the behavior of the planning
|
||||
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
|
||||
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
|
||||
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
|
||||
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
|
||||
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
|
||||
supported only by the `terraform plan` command, and not by the
|
||||
`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
|
||||
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
|
||||
Terraform state with remote objects before checking for configuration changes.
|
||||
|
||||
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
|
||||
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.
|
||||
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
|
||||
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.
|
||||
|
||||
This option is not available in the "refresh only" planning mode, because
|
||||
it would effectively disable the entirety of the planning operation in that
|
||||
case.
|
||||
This option is not available in the "refresh only" planning mode, because
|
||||
it would effectively disable the entirety of the planning operation in that
|
||||
case.
|
||||
|
||||
* `-replace=ADDRESS` - Instructs Terraform to plan to replace the single
|
||||
resource instance with the given address. If the given instance would
|
||||
normally have caused only an "update" action, or no action at all, then
|
||||
Terraform will choose a "replace" action instead.
|
||||
|
||||
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
|
||||
patterns then you may wish to respond to that by replacing the
|
||||
malfunctioning object with a new object that has the same configuration.
|
||||
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
|
||||
patterns then you may wish to respond to that by replacing the
|
||||
malfunctioning object with a new object that has the same configuration.
|
||||
|
||||
This option is allowed only in the normal planning mode, so this option
|
||||
is incompatible with the `-destroy` option.
|
||||
This option is allowed only in the normal planning mode, so this option
|
||||
is incompatible with the `-destroy` option.
|
||||
|
||||
The `-replace=...` option is available only from Terraform v0.15.2 onwards.
|
||||
For earlier versions, you can achieve a similar effect (with some caveats)
|
||||
using [`terraform taint`](/cli/commands/taint).
|
||||
The `-replace=...` option is available only from Terraform v0.15.2 onwards.
|
||||
For earlier versions, you can achieve a similar effect (with some caveats)
|
||||
using [`terraform taint`](./taint.html).
|
||||
|
||||
* `-target=ADDRESS` - Instructs Terraform to focus its planning efforts only
|
||||
on resource instances which match the given address and on any objects that
|
||||
those instances depend on.
|
||||
|
||||
This command is for exceptional use only. See
|
||||
[Resource Targeting](#resource-targeting)
|
||||
below for more information.
|
||||
This command is for exceptional use only. See
|
||||
[Resource Targeting](#resource-targeting)
|
||||
below for more information.
|
||||
|
||||
* `-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
|
||||
more than one variable. For more information see
|
||||
[Input Variables on the Command Line](#input-variables-on-the-command-line),
|
||||
below.
|
||||
|
||||
* `-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
|
||||
["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.
|
||||
|
||||
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,
|
||||
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
|
||||
|
||||
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.
|
||||
|
||||
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.
|
||||
|
||||
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
|
||||
value with no special punctuation except that required by your shell, as
|
||||
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
|
||||
variables. For more information on the various methods for setting root module
|
||||
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
|
||||
|
||||
|
@ -270,7 +271,7 @@ input variables, see
|
|||
|
||||
You can use the `-target` option to focus Terraform's attention on only a
|
||||
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:
|
||||
|
||||
* 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
|
||||
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
|
||||
of resources relates to configuration.
|
||||
|
||||
Instead of using `-target` as a means to operate on isolated portions of very
|
||||
large configurations, prefer instead to break large configurations into
|
||||
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
|
||||
a complex system architecture to be broken down into more manageable parts
|
||||
that can be updated independently.
|
||||
|
@ -338,11 +339,11 @@ The available options are:
|
|||
This implies `-input=false`, so the configuration must have no unassigned
|
||||
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
|
||||
dangerous if others might concurrently run commands against the same
|
||||
workspace.
|
||||
dangerous if others might concurrently run commands against the same
|
||||
workspace.
|
||||
|
||||
* `-lock-timeout=DURATION` - Unless locking is disabled with `-lock=false`,
|
||||
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
|
||||
saved plan files.
|
||||
|
||||
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
|
||||
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
|
||||
file, which will then cause syntax errors for subsequent commands.
|
||||
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
|
||||
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
|
||||
file, which will then cause syntax errors for subsequent commands.
|
||||
|
||||
The generated file is not in any standard format intended for consumption
|
||||
by other software, but the file _does_ contain your full configuration,
|
||||
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
|
||||
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
|
||||
saved plan files as potentially-sensitive artifacts.
|
||||
The generated file is not in any standard format intended for consumption
|
||||
by other software, but the file _does_ contain your full configuration,
|
||||
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
|
||||
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
|
||||
saved plan files as potentially-sensitive artifacts.
|
||||
|
||||
* `-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.
|
||||
|
||||
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
|
||||
[`-state`](/language/settings/backends/local#command-line-arguments).
|
||||
[`-state`](/docs/language/settings/backends/local.html#command-line-arguments).
|
||||
|
||||
### 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.
|
||||
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
|
||||
in the given directory for all files it would normally read or write in the
|
||||
current working directory.
|
||||
|
@ -397,6 +398,6 @@ current working directory.
|
|||
If your previous use of this legacy pattern was also relying on Terraform
|
||||
writing the `.terraform` subdirectory into the current working directory even
|
||||
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
|
||||
than the current working directory.
|
|
@ -1,14 +1,14 @@
|
|||
---
|
||||
page_title: 'Command: providers'
|
||||
description: >-
|
||||
The terraform providers command prints information about the providers
|
||||
required in the current configuration.
|
||||
layout: "docs"
|
||||
page_title: "Command: providers"
|
||||
sidebar_current: "docs-commands-providers"
|
||||
description: "The terraform providers command prints information about the providers required in the current configuration."
|
||||
---
|
||||
|
||||
# Command: providers
|
||||
|
||||
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
|
||||
where each requirement was detected from.
|
||||
|
|
@ -1,5 +1,7 @@
|
|||
---
|
||||
page_title: 'Command: providers lock'
|
||||
layout: "docs"
|
||||
page_title: "Command: providers lock"
|
||||
sidebar_current: "docs-commands-providers-lock"
|
||||
description: |-
|
||||
The `terraform providers lock` command adds new provider selection information
|
||||
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
|
||||
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
|
||||
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:
|
||||
|
||||
* 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
|
||||
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
|
||||
provider versions.
|
||||
|
||||
If you use `terraform lock` to write the official release checksums for a
|
||||
provider into the dependency lock file then future `terraform init` runs
|
||||
will verify the packages available in your selected mirror against the
|
||||
official checksums previously recorded, giving additional certainty that
|
||||
the mirror is serving the provider packages it is claiming to.
|
||||
If you use `terraform lock` to write the official release checksums for a
|
||||
provider into the dependency lock file then future `terraform init` runs
|
||||
will verify the packages available in your selected mirror against the
|
||||
official checksums previously recorded, giving additional certainty that
|
||||
the mirror is serving the provider packages it is claiming to.
|
||||
|
||||
* 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
|
||||
to provide signed checksums using the latest hashing scheme, subsequent runs
|
||||
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
|
||||
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
|
||||
the providers it depends on, and it will fetch the necessary data about those
|
||||
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
|
||||
that are covered by the provider developer's cryptographic signature.
|
||||
|
||||
~> **Warning:** The `terraform providers lock` command prints information
|
||||
about what it has fetched and whether each package was signed using a
|
||||
cryptographic signature, but it cannot automatically verify that the
|
||||
providers are trustworthy and that they comply with your local system
|
||||
policies or relevant regulations. Review the signing key information
|
||||
in the output to confirm that you trust all of the signers before committing
|
||||
the updated lock file to your version control system.
|
||||
about what it has fetched and whether each package was signed using a
|
||||
cryptographic signature, but it cannot automatically verify that the
|
||||
providers are trustworthy and that they comply with your local system
|
||||
policies or relevant regulations. Review the signing key information
|
||||
in the output to confirm that you trust all of the signers before committing
|
||||
the updated lock file to your version control system.
|
||||
|
||||
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,
|
||||
|
@ -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
|
||||
given network mirror service, instead of in upstream registries. The
|
||||
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
|
||||
Terraform configuration. Terraform will ensure that the providers are all
|
||||
available for the given platform and will save enough package checksums in
|
||||
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
|
||||
systems.
|
||||
Target platform names consist of an operating system and a CPU
|
||||
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
|
||||
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.
|
||||
There is more detail on this option in the following section.
|
||||
|
||||
## 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
|
||||
`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
|
||||
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
|
||||
without any special options or additional CLI configuration. For more
|
||||
information, see
|
||||
[the provider registry protocol](/internals/provider-registry-protocol).
|
||||
[the provider registry protocol](/docs/internals/provider-registry-protocol.html).
|
|
@ -1,5 +1,7 @@
|
|||
---
|
||||
page_title: 'Command: providers mirror'
|
||||
layout: "docs"
|
||||
page_title: "Command: providers mirror"
|
||||
sidebar_current: "docs-commands-providers-mirror"
|
||||
description: |-
|
||||
The `terraform providers mirror` command downloads the providers required
|
||||
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,
|
||||
such as on an isolated network without access to the Terraform Registry. In
|
||||
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
|
||||
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.
|
||||
|
@ -39,7 +41,7 @@ themselves.
|
|||
|
||||
Terraform will also generate various `.json` index files which contain suitable
|
||||
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
|
||||
ignores those index files when using the directory as a filesystem mirror,
|
||||
because the directory entries themselves are authoritative in that case.
|
|
@ -1,9 +1,9 @@
|
|||
---
|
||||
page_title: 'Command: providers schema'
|
||||
description: >-
|
||||
The `terraform providers schema` command prints detailed schemas for the
|
||||
providers used
|
||||
|
||||
layout: "docs"
|
||||
page_title: "Command: providers schema"
|
||||
sidebar_current: "docs-commands-providers-schema"
|
||||
description: |-
|
||||
The `terraform providers schema` command prints detailed schemas for the providers used
|
||||
in the current configuration.
|
||||
---
|
||||
|
||||
|
@ -19,7 +19,7 @@ Usage: `terraform providers schema [options]`
|
|||
|
||||
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.
|
||||
|
||||
|
@ -34,7 +34,7 @@ value `"1.0"`. The semantics of this version are:
|
|||
version.
|
||||
|
||||
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
|
||||
|
|
@ -1,14 +1,16 @@
|
|||
---
|
||||
page_title: 'Command: push'
|
||||
description: >-
|
||||
DISCONTINUED. Terraform Cloud and the modern "remote" backend have replaced
|
||||
the old `terraform push` command.
|
||||
layout: "docs"
|
||||
page_title: "Command: push"
|
||||
sidebar_current: "docs-commands-push"
|
||||
description: |-
|
||||
DISCONTINUED. Terraform Cloud and the modern "remote" backend have replaced the old `terraform push` command.
|
||||
---
|
||||
|
||||
# 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 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.
|
||||
|
|
@ -1,5 +1,7 @@
|
|||
---
|
||||
page_title: 'Command: refresh'
|
||||
layout: "docs"
|
||||
page_title: "Command: refresh"
|
||||
sidebar_current: "docs-commands-refresh"
|
||||
description: |-
|
||||
The `terraform refresh` command reads the current settings from all managed
|
||||
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
|
||||
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.
|
||||
See below for more information and recommended alternatives.
|
||||
|
||||
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
|
||||
automatically performs the same refreshing actions as a part of creating
|
||||
a plan in both the
|
||||
[`terraform plan`](/cli/commands/plan)
|
||||
[`terraform plan`](./plan.html)
|
||||
and
|
||||
[`terraform apply`](/cli/commands/apply)
|
||||
[`terraform apply`](./apply.html)
|
||||
commands. This command is here primarily for backward compatibility, but
|
||||
we don't recommend using it because it provides no opportunity to review
|
||||
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
|
||||
[`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",
|
||||
and `-auto-approve` is always enabled.
|
||||
|
|
@ -1,10 +1,9 @@
|
|||
---
|
||||
page_title: 'Command: show'
|
||||
description: >-
|
||||
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.
|
||||
layout: "docs"
|
||||
page_title: "Command: show"
|
||||
sidebar_current: "docs-commands-show"
|
||||
description: |-
|
||||
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.
|
||||
---
|
||||
|
||||
# Command: show
|
||||
|
@ -19,7 +18,7 @@ flag.
|
|||
|
||||
-> **Note:** When using the `-json` command-line flag, any sensitive values in
|
||||
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
|
||||
|
||||
|
@ -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`
|
||||
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
|
||||
|
|
@ -1,13 +1,16 @@
|
|||
---
|
||||
page_title: 'Command: state'
|
||||
description: The `terraform state` command is used for advanced state management.
|
||||
layout: "docs"
|
||||
page_title: "Command: state"
|
||||
sidebar_current: "docs-commands-state-index"
|
||||
description: |-
|
||||
The `terraform state` command is used for advanced state management.
|
||||
---
|
||||
|
||||
# State Command
|
||||
|
||||
The `terraform state` command is used for advanced state management.
|
||||
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
|
||||
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
|
||||
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.
|
||||
|
||||
Note that backups for state modification _can not be disabled_. Due to
|
|
@ -1,14 +1,15 @@
|
|||
---
|
||||
page_title: 'Command: state list'
|
||||
description: >-
|
||||
The terraform state list command is used to list resources within a Terraform
|
||||
state.
|
||||
layout: "docs"
|
||||
page_title: "Command: state list"
|
||||
sidebar_current: "docs-commands-state-sub-list"
|
||||
description: |-
|
||||
The terraform state list command is used to list resources within a Terraform state.
|
||||
---
|
||||
|
||||
# Command: state list
|
||||
|
||||
The `terraform state list` command is used to list resources within a
|
||||
[Terraform state](/language/state/).
|
||||
[Terraform state](/docs/language/state/index.html).
|
||||
|
||||
## Usage
|
||||
|
||||
|
@ -24,12 +25,12 @@ within modules are listed last.
|
|||
|
||||
For complex infrastructures, the state can contain thousands of resources.
|
||||
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:
|
||||
|
||||
* `-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.
|
||||
|
||||
## Example: All Resources
|
|
@ -1,13 +1,14 @@
|
|||
---
|
||||
page_title: 'Command: state mv'
|
||||
description: >-
|
||||
The `terraform state mv` command changes bindings in Terraform state,
|
||||
associating existing remote objects with new resource instances.
|
||||
layout: "docs"
|
||||
page_title: "Command: state mv"
|
||||
sidebar_current: "docs-commands-state-sub-mv"
|
||||
description: |-
|
||||
The `terraform state mv` command changes bindings in Terraform state, associating existing remote objects with new resource instances.
|
||||
---
|
||||
|
||||
# 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
|
||||
and the remote objects they represent. Normally Terraform automatically
|
||||
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.
|
||||
|
||||
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
|
||||
instance to another resource instance, a whole module instance to another
|
||||
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
|
||||
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
|
||||
purpose you communicate carefully with your coworkers to ensure that nobody
|
||||
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.
|
||||
|
||||
* `-lock=false` - Don't hold a state lock during the operation. This is
|
||||
dangerous if others might concurrently run commands against the same
|
||||
workspace.
|
||||
dangerous if others might concurrently run commands against the same
|
||||
workspace.
|
||||
|
||||
* `-lock-timeout=DURATION` - Unless locking is disabled with `-lock=false`,
|
||||
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.
|
||||
|
||||
For configurations using
|
||||
[the `remote` backend](/language/settings/backends/remote)
|
||||
[the `remote` backend](/docs/language/settings/backends/remote.html)
|
||||
only, `terraform state mv`
|
||||
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
|
||||
[the `remote` backend](/language/settings/backends/remote)
|
||||
must specify a local state file with the [`-state`](/language/settings/backends/local#command-line-arguments)
|
||||
option in order to use the [`-backup` and `-backup-out`](/language/settings/backends/local#command-line-arguments)
|
||||
[the `remote` backend](/docs/language/settings/backends/remote.html)
|
||||
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`](/docs/language/settings/backends/local.html#command-line-arguments)
|
||||
options.
|
||||
|
||||
|
||||
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
|
||||
[`-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
|
||||
|
||||
|
@ -134,7 +136,7 @@ terraform state mv module.app module.parent.module.app
|
|||
|
||||
## 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
|
||||
select a particular instance by including an explicit index in your given
|
||||
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
|
||||
|
||||
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
|
||||
select a particular instance by including an explicit key in your given
|
||||
address.
|
|
@ -1,14 +1,15 @@
|
|||
---
|
||||
page_title: 'Command: state pull'
|
||||
description: >-
|
||||
The `terraform state pull` command is used to manually download and output the
|
||||
state from remote state.
|
||||
layout: "docs"
|
||||
page_title: "Command: state pull"
|
||||
sidebar_current: "docs-commands-state-sub-pull"
|
||||
description: |-
|
||||
The `terraform state pull` command is used to manually download and output the state from remote state.
|
||||
---
|
||||
|
||||
# Command: state pull
|
||||
|
||||
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.
|
||||
|
||||
## Usage
|
|
@ -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).
|
|
@ -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).
|
|
@ -1,14 +1,15 @@
|
|||
---
|
||||
page_title: 'Command: state replace-provider'
|
||||
description: >-
|
||||
The `terraform state replace-provider` command replaces the provider for
|
||||
resources in the Terraform state.
|
||||
layout: "docs"
|
||||
page_title: "Command: state replace-provider"
|
||||
sidebar_current: "docs-commands-state-sub-replace-provider"
|
||||
description: |-
|
||||
The `terraform state replace-provider` command replaces the provider for resources in the Terraform state.
|
||||
---
|
||||
|
||||
# Command: state replace-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
|
||||
|
||||
|
@ -27,21 +28,22 @@ This command also accepts the following options:
|
|||
* `-auto-approve` - Skip interactive approval.
|
||||
|
||||
* `-lock=false` - Don't hold a state lock during the operation. This is
|
||||
dangerous if others might concurrently run commands against the same
|
||||
workspace.
|
||||
dangerous if others might concurrently run commands against the same
|
||||
workspace.
|
||||
|
||||
* `-lock-timeout=0s` - Duration to retry a state lock.
|
||||
|
||||
For configurations using
|
||||
[the `remote` backend](/language/settings/backends/remote)
|
||||
[the `remote` backend](/docs/language/settings/backends/remote.html)
|
||||
only, `terraform state replace-provider`
|
||||
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
|
||||
[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
|
||||
[`-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
|
||||
|
|
@ -1,13 +1,14 @@
|
|||
---
|
||||
page_title: 'Command: state rm'
|
||||
description: >-
|
||||
The `terraform state rm` command removes bindings from the Terraform state,
|
||||
causing Terraform to "forget about" existing objects.
|
||||
layout: "docs"
|
||||
page_title: "Command: state rm"
|
||||
sidebar_current: "docs-commands-state-sub-rm"
|
||||
description: |-
|
||||
The `terraform state rm` command removes bindings from the Terraform state, causing Terraform to "forget about" existing objects.
|
||||
---
|
||||
|
||||
# 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
|
||||
and the remote objects they represent. Normally Terraform automatically
|
||||
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...`
|
||||
|
||||
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
|
||||
corresponding remote objects.
|
||||
|
||||
This means that although the objects will still continue to exist in the
|
||||
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"
|
||||
instances. Depending on the constraints imposed by the remote system, creating
|
||||
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.
|
||||
|
||||
* `-lock=false` - Don't hold a state lock during the operation. This is
|
||||
dangerous if others might concurrently run commands against the same
|
||||
workspace.
|
||||
dangerous if others might concurrently run commands against the same
|
||||
workspace.
|
||||
|
||||
* `-lock-timeout=DURATION` - Unless locking is disabled with `-lock=false`,
|
||||
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.
|
||||
|
||||
For configurations using
|
||||
[the `remote` backend](/language/settings/backends/remote)
|
||||
[the `remote` backend](/docs/language/settings/backends/remote.html)
|
||||
only, `terraform state rm`
|
||||
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
|
||||
[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
|
||||
[`-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
|
||||
|
||||
|
@ -93,7 +94,7 @@ $ terraform state rm 'module.foo'
|
|||
|
||||
## 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
|
||||
select a particular instance by including an explicit index in your given
|
||||
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`
|
||||
|
||||
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
|
||||
select a particular instance by including an explicit key in your given
|
||||
address.
|
|
@ -1,15 +1,16 @@
|
|||
---
|
||||
page_title: 'Command: state show'
|
||||
description: >-
|
||||
The `terraform state show` command is used to show the attributes of a single
|
||||
resource in the Terraform state.
|
||||
layout: "docs"
|
||||
page_title: "Command: state show"
|
||||
sidebar_current: "docs-commands-state-sub-show"
|
||||
description: |-
|
||||
The `terraform state show` command is used to show the attributes of a single resource in the Terraform state.
|
||||
---
|
||||
|
||||
# Command: state show
|
||||
|
||||
The `terraform state show` command is used to show the attributes of a
|
||||
single resource in the
|
||||
[Terraform state](/language/state/).
|
||||
[Terraform state](/docs/language/state/index.html).
|
||||
|
||||
## 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
|
||||
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:
|
||||
|
||||
* `-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
|
||||
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.
|
||||
|
||||
## Example: Show a Resource
|
||||
|
@ -60,7 +61,7 @@ $ terraform state show 'module.foo.packet_device.worker'
|
|||
## Example: Show a Resource configured with count
|
||||
|
||||
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
|
||||
$ 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
|
||||
|
||||
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:
|
||||
|
|
@ -1,5 +1,7 @@
|
|||
---
|
||||
page_title: 'Command: taint'
|
||||
layout: "docs"
|
||||
page_title: "Command: taint"
|
||||
sidebar_current: "docs-commands-taint"
|
||||
description: |-
|
||||
The `terraform taint` command informs Terraform that a particular object
|
||||
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
|
||||
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.
|
||||
|
||||
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
|
||||
to use the `-replace` option with [`terraform apply`](/cli/commands/apply).
|
||||
to use the `-replace` option with [`terraform apply`](./apply.html).
|
||||
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 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:
|
||||
|
||||
* `aws_instance.foo`
|
||||
* `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)
|
||||
* `module.foo.module.bar.aws_instance.qux`
|
||||
* `aws_instance.foo`
|
||||
* `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)
|
||||
* `module.foo.module.bar.aws_instance.qux`
|
||||
|
||||
This command accepts the following options:
|
||||
|
||||
|
@ -66,12 +68,12 @@ This command accepts the following options:
|
|||
unit letter, such as "3s" for three seconds.
|
||||
|
||||
For configurations using
|
||||
[the `remote` backend](/language/settings/backends/remote)
|
||||
[the `remote` backend](/docs/language/settings/backends/remote.html)
|
||||
only, `terraform taint`
|
||||
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
|
||||
[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
|
||||
[`-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).
|
|
@ -1,12 +1,15 @@
|
|||
---
|
||||
page_title: 'Command: test'
|
||||
description: Part of the ongoing design research for module integration testing.
|
||||
layout: "docs"
|
||||
page_title: "Command: test"
|
||||
sidebar_current: "docs-commands-test"
|
||||
description: |-
|
||||
Part of the ongoing design research for module integration testing.
|
||||
---
|
||||
|
||||
# Command: test
|
||||
|
||||
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
|
||||
prototype functionality then we'd love to hear your feedback. See the
|
|
@ -1,5 +1,7 @@
|
|||
---
|
||||
page_title: 'Command: untaint'
|
||||
layout: "docs"
|
||||
page_title: "Command: untaint"
|
||||
sidebar_current: "docs-commands-untaint"
|
||||
description: |-
|
||||
The `terraform untaint` command tells Terraform that an object is functioning
|
||||
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.
|
||||
|
||||
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.
|
||||
|
||||
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`
|
||||
|
||||
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.
|
||||
|
||||
This command also accepts the following options:
|
||||
|
@ -49,8 +51,8 @@ This command also accepts the following options:
|
|||
the state.
|
||||
|
||||
* `-lock=false` - Don't hold a state lock during the operation. This is
|
||||
dangerous if others might concurrently run commands against the same
|
||||
workspace.
|
||||
dangerous if others might concurrently run commands against the same
|
||||
workspace.
|
||||
|
||||
* `-lock-timeout=DURATION` - Unless locking is disabled with `-lock=false`,
|
||||
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.
|
||||
|
||||
For configurations using
|
||||
[the `remote` backend](/language/settings/backends/remote)
|
||||
[the `remote` backend](/docs/language/settings/backends/remote.html)
|
||||
only, `terraform untaint`
|
||||
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
|
||||
[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
|
||||
[`-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).
|
|
@ -1,8 +1,9 @@
|
|||
---
|
||||
page_title: 'Command: validate'
|
||||
description: >-
|
||||
The `terraform validate` command is used to validate the syntax of the
|
||||
terraform files.
|
||||
layout: "docs"
|
||||
page_title: "Command: validate"
|
||||
sidebar_current: "docs-commands-validate"
|
||||
description: |-
|
||||
The `terraform validate` command is used to validate the syntax of the terraform files.
|
||||
---
|
||||
|
||||
# Command: validate
|
||||
|
@ -38,11 +39,11 @@ Usage: `terraform validate [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
|
||||
color.
|
||||
|
||||
* `-no-color` - If specified, output won't contain any color.
|
||||
- `-no-color` - If specified, output won't contain any color.
|
||||
|
||||
## 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
|
||||
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
|
||||
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
|
||||
version.
|
||||
|
||||
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
|
||||
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
|
||||
`"warning"`, indicating the diagnostic severity.
|
||||
|
||||
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
|
||||
block working with the configuration. Later versions of Terraform may
|
||||
introduce new severity keywords, so consumers should be prepared to accept
|
||||
and ignore severity values they don't understand.
|
||||
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
|
||||
block working with the configuration. Later versions of Terraform may
|
||||
introduce new severity keywords, so consumers should be prepared to accept
|
||||
and ignore severity values they don't understand.
|
||||
|
||||
* `summary` (string): A short description of the nature of the problem that
|
||||
the diagnostic is reporting.
|
||||
|
||||
In Terraform's usual human-oriented diagnostic messages, the summary serves
|
||||
as a sort of "heading" for the diagnostic, printed after the "Error:" or
|
||||
"Warning:" indicator.
|
||||
In Terraform's usual human-oriented diagnostic messages, the summary serves
|
||||
as a sort of "heading" for the diagnostic, printed after the "Error:" or
|
||||
"Warning:" indicator.
|
||||
|
||||
Summaries are typically short, single sentences, but can sometimes be longer
|
||||
as a result of returning errors from subsystems that are not designed to
|
||||
return full diagnostics, where the entire error message therefore becomes the
|
||||
summary. In those cases, the summary might include newline characters which
|
||||
a renderer should honor when presenting the message visually to a user.
|
||||
Summaries are typically short, single sentences, but can sometimes be longer
|
||||
as a result of returning errors from subsystems that are not designed to
|
||||
return full diagnostics, where the entire error message therefore becomes the
|
||||
summary. In those cases, the summary might include newline characters which
|
||||
a renderer should honor when presenting the message visually to a user.
|
||||
|
||||
* `detail` (string): An optional additional message giving more detail about
|
||||
the problem.
|
||||
|
||||
In Terraform's usual human-oriented diagnostic messages, the detail provides
|
||||
the paragraphs of text that appear after the heading and the source location
|
||||
reference.
|
||||
In Terraform's usual human-oriented diagnostic messages, the detail provides
|
||||
the paragraphs of text that appear after the heading and the source location
|
||||
reference.
|
||||
|
||||
Detail messages are often multiple paragraphs and possibly interspersed with
|
||||
non-paragraph lines, so tools which aim to present detail messages to the
|
||||
user should distinguish between lines without leading spaces, treating them
|
||||
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
|
||||
rendering container, but leave the preformatted lines unwrapped.
|
||||
Detail messages are often multiple paragraphs and possibly interspersed with
|
||||
non-paragraph lines, so tools which aim to present detail messages to the
|
||||
user should distinguish between lines without leading spaces, treating them
|
||||
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
|
||||
rendering container, but leave the preformatted lines unwrapped.
|
||||
|
||||
Some Terraform detail messages currently contain an approximation of bullet
|
||||
lists using ASCII characters to mark the bullets. This is not currently a
|
||||
contractural formatting convention and so renderers should avoid depending on
|
||||
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
|
||||
additional rules for processing other text conventions, but will do so within
|
||||
the bounds of the rules above to achieve backward-compatibility.
|
||||
Some Terraform detail messages currently contain an approximation of bullet
|
||||
lists using ASCII characters to mark the bullets. This is not currently a
|
||||
contractural formatting convention and so renderers should avoid depending on
|
||||
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
|
||||
additional rules for processing other text conventions, but will do so within
|
||||
the bounds of the rules above to achieve backward-compatibility.
|
||||
|
||||
* `range` (object): An optional object referencing a portion of the configuration
|
||||
source code that the diagnostic message relates to. For errors, this will
|
||||
typically indicate the bounds of the specific block header, attribute, or
|
||||
expression which was detected as invalid.
|
||||
|
||||
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
|
||||
two properties `start` and `end` which are both themselves objects
|
||||
describing source positions, as described below.
|
||||
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
|
||||
two properties `start` and `end` which are both themselves objects
|
||||
describing source positions, as described below.
|
||||
|
||||
Not all diagnostic messages are connected with specific portions of the
|
||||
configuration, so `range` will be omitted or `null` for diagnostic messages
|
||||
where it isn't relevant.
|
||||
Not all diagnostic messages are connected with specific portions of the
|
||||
configuration, so `range` will be omitted or `null` for diagnostic messages
|
||||
where it isn't relevant.
|
||||
|
||||
* `snippet` (object): An optional object including an excerpt of the
|
||||
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
|
||||
diagnostic. For example, this might be the resource block containing the
|
||||
expression which triggered the diagnostic. For some diagnostics this
|
||||
information is not available, and then this property will be `null`.
|
||||
* `context` (string): An optional summary of the root context of the
|
||||
diagnostic. For example, this might be the resource block containing the
|
||||
expression which triggered the diagnostic. For some diagnostics this
|
||||
information is not available, and then this property will be `null`.
|
||||
|
||||
* `code` (string): A snippet of Terraform configuration including the
|
||||
source of the diagnostic. This can be multiple lines and may include
|
||||
additional configuration source code around the expression which
|
||||
triggered the diagnostic.
|
||||
* `code` (string): A snippet of Terraform configuration including the
|
||||
source of the diagnostic. This can be multiple lines and may include
|
||||
additional configuration source code around the expression which
|
||||
triggered the diagnostic.
|
||||
|
||||
* `start_line` (number): A one-based line count representing the position
|
||||
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
|
||||
`code` to include one or more lines of context before the source of the
|
||||
diagnostic.
|
||||
* `start_line` (number): A one-based line count representing the position
|
||||
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
|
||||
`code` to include one or more lines of context before the source of the
|
||||
diagnostic.
|
||||
|
||||
* `highlight_start_offset` (number): A zero-based character offset into the
|
||||
`code` string, pointing at the start of the expression which triggered
|
||||
the diagnostic.
|
||||
* `highlight_start_offset` (number): A zero-based character offset into the
|
||||
`code` string, pointing at the start of the expression which triggered
|
||||
the diagnostic.
|
||||
|
||||
* `highlight_end_offset` (number): A zero-based character offset into the
|
||||
`code` string, pointing at the end of the expression which triggered the
|
||||
diagnostic.
|
||||
* `highlight_end_offset` (number): A zero-based character offset into the
|
||||
`code` string, pointing at the end of the expression which triggered the
|
||||
diagnostic.
|
||||
|
||||
* `values` (array of objects): Contains zero or more expression values
|
||||
which may be useful in understanding the source of a diagnostic in a
|
||||
complex expression. These expression value objects are described below.
|
||||
* `values` (array of objects): Contains zero or more expression values
|
||||
which may be useful in understanding the source of a diagnostic in a
|
||||
complex expression. These expression value objects are described below.
|
||||
|
||||
### Source Position
|
||||
|
|
@ -1,8 +1,8 @@
|
|||
---
|
||||
page_title: 'Command: version'
|
||||
description: >-
|
||||
The terraform version command displays the Terraform version and the version
|
||||
of all installed plugins.
|
||||
layout: "docs"
|
||||
page_title: "Command: version"
|
||||
sidebar_current: "docs-commands-version"
|
||||
description: "The terraform version command displays the Terraform version and the version of all installed plugins."
|
||||
---
|
||||
|
||||
# Command: version
|
||||
|
@ -16,12 +16,12 @@ Usage: `terraform version [options]`
|
|||
|
||||
With no additional arguments, `version` will display the version of Terraform,
|
||||
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:
|
||||
|
||||
* `-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.
|
||||
|
||||
|
@ -51,4 +51,4 @@ $ terraform version -json
|
|||
},
|
||||
"terraform_outdated": true
|
||||
}
|
||||
```
|
||||
```
|
|
@ -1,6 +1,9 @@
|
|||
---
|
||||
page_title: 'Command: workspace delete'
|
||||
description: The terraform workspace delete command is used to delete a workspace.
|
||||
layout: "docs"
|
||||
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
|
||||
|
@ -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.
|
||||
* `-lock=false` - Don't hold a state lock during the operation. This is
|
||||
dangerous if others might concurrently run commands against the same
|
||||
workspace.
|
||||
dangerous if others might concurrently run commands against the same
|
||||
workspace.
|
||||
* `-lock-timeout=DURATION` - Duration to retry a state lock. Default 0s.
|
||||
|
||||
## Example
|
|
@ -1,12 +1,15 @@
|
|||
---
|
||||
page_title: 'Command: workspace'
|
||||
description: The workspace command helps you manage workspaces.
|
||||
layout: "docs"
|
||||
page_title: "Command: workspace"
|
||||
sidebar_current: "docs-commands-workspace-index"
|
||||
description: "The workspace command helps you manage workspaces."
|
||||
|
||||
---
|
||||
|
||||
# Command: workspace
|
||||
|
||||
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
|
||||
listed in the navigation bar.
|
|
@ -1,6 +1,9 @@
|
|||
---
|
||||
page_title: 'Command: workspace list'
|
||||
description: The terraform workspace list command is used to list all existing workspaces.
|
||||
layout: "docs"
|
||||
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
|
|
@ -1,6 +1,9 @@
|
|||
---
|
||||
page_title: 'Command: workspace new'
|
||||
description: The terraform workspace new command is used to create a new workspace.
|
||||
layout: "docs"
|
||||
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
|
||||
|
@ -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:
|
||||
|
||||
* `-lock=false` - Don't hold a state lock during the operation. This is
|
||||
dangerous if others might concurrently run commands against the same
|
||||
workspace.
|
||||
dangerous if others might concurrently run commands against the same
|
||||
workspace.
|
||||
* `-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.
|
||||
|
|
@ -1,6 +1,9 @@
|
|||
---
|
||||
page_title: 'Command: workspace select'
|
||||
description: The terraform workspace select command is used to choose a workspace.
|
||||
layout: "docs"
|
||||
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
|
|
@ -1,6 +1,9 @@
|
|||
---
|
||||
page_title: 'Command: workspace show'
|
||||
description: The terraform workspace show command is used to output the current workspace.
|
||||
layout: "docs"
|
||||
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
|
|
@ -1,15 +1,15 @@
|
|||
---
|
||||
page_title: CLI Configuration
|
||||
description: >-
|
||||
Learn to use the CLI configuration file to customize your CLI settings,
|
||||
including credentials, plugin caching, provider installation methods, etc.
|
||||
layout: "docs"
|
||||
page_title: "CLI Configuration"
|
||||
sidebar_current: "docs-commands-cli-config"
|
||||
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`)
|
||||
|
||||
The CLI configuration file configures per-user settings for CLI behaviors,
|
||||
which apply across all Terraform working directories. This is separate from
|
||||
[your infrastructure configuration](/language/).
|
||||
[your infrastructure configuration](/docs/language/index.html).
|
||||
|
||||
## Locations
|
||||
|
||||
|
@ -31,7 +31,7 @@ as just `terraform.rc`. Use `dir` from PowerShell or Command Prompt to
|
|||
confirm the filename.
|
||||
|
||||
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`.
|
||||
|
||||
## Configuration File Syntax
|
||||
|
@ -50,38 +50,38 @@ disable_checkpoint = true
|
|||
|
||||
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
|
||||
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.
|
||||
See [Credentials Helpers](#credentials-helpers) below for more information.
|
||||
|
||||
* `disable_checkpoint` — when set to `true`, disables
|
||||
[upgrade and security bulletin checks](/cli/commands/#upgrade-and-security-bulletin-checks)
|
||||
- `disable_checkpoint` — when set to `true`, disables
|
||||
[upgrade and security bulletin checks](/docs/cli/commands/index.html#upgrade-and-security-bulletin-checks)
|
||||
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
|
||||
id used to de-duplicate warning messages.
|
||||
|
||||
* `plugin_cache_dir` — enables
|
||||
- `plugin_cache_dir` — enables
|
||||
[plugin caching](#provider-plugin-cache)
|
||||
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
|
||||
[Provider Installation](#provider-installation) below for more information.
|
||||
|
||||
## 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
|
||||
[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
|
||||
[remote operations](/cloud-docs/run/cli) and a
|
||||
[private module registry](/cloud-docs/registry/).
|
||||
[remote operations](/docs/cloud/run/cli.html) and a
|
||||
[private module registry](/docs/cloud/registry/index.html).
|
||||
|
||||
When interacting with Terraform-specific network services, Terraform expects
|
||||
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
|
||||
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,
|
||||
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
|
||||
[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.
|
||||
|
||||
-> **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.
|
||||
To learn how to write and install your own credentials helpers to integrate
|
||||
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
|
||||
|
||||
|
@ -216,36 +216,36 @@ The following are the two supported installation method types:
|
|||
providers. This method requires the additional argument `path` to indicate
|
||||
which directory to look in.
|
||||
|
||||
Terraform expects the given directory to contain a nested directory structure
|
||||
where the path segments together provide metadata about the available
|
||||
providers. The following two directory structures are supported:
|
||||
Terraform expects the given directory to contain a nested directory structure
|
||||
where the path segments together provide metadata about the available
|
||||
providers. The following two directory structures are supported:
|
||||
|
||||
* Packed layout: `HOSTNAME/NAMESPACE/TYPE/terraform-provider-TYPE_VERSION_TARGET.zip`
|
||||
is the distribution zip file obtained from the provider's origin registry.
|
||||
* Unpacked layout: `HOSTNAME/NAMESPACE/TYPE/VERSION/TARGET` is a directory
|
||||
containing the result of extracting the provider's distribution zip file.
|
||||
* Packed layout: `HOSTNAME/NAMESPACE/TYPE/terraform-provider-TYPE_VERSION_TARGET.zip`
|
||||
is the distribution zip file obtained from the provider's origin registry.
|
||||
* Unpacked layout: `HOSTNAME/NAMESPACE/TYPE/VERSION/TARGET` is a directory
|
||||
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`
|
||||
specifies a particular target platform using a format like `darwin_amd64`,
|
||||
`linux_arm`, `windows_amd64`, etc.
|
||||
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`,
|
||||
`linux_arm`, `windows_amd64`, etc.
|
||||
|
||||
If you use the unpacked layout, Terraform will attempt to create a symbolic
|
||||
link to the mirror directory when installing the provider, rather than
|
||||
creating a deep copy of the directory. The packed layout prevents this
|
||||
because Terraform must extract the zip file during installation.
|
||||
If you use the unpacked layout, Terraform will attempt to create a symbolic
|
||||
link to the mirror directory when installing the provider, rather than
|
||||
creating a deep copy of the directory. The packed layout prevents this
|
||||
because Terraform must extract the zip file during installation.
|
||||
|
||||
You can include multiple `filesystem_mirror` blocks in order to specify
|
||||
several different directories to search.
|
||||
You can include multiple `filesystem_mirror` blocks in order to specify
|
||||
several different directories to search.
|
||||
|
||||
* `network_mirror`: consult a particular HTTPS server for copies of providers,
|
||||
regardless of which registry host they belong to. This method requires the
|
||||
additional argument `url` to indicate the mirror base URL, which should
|
||||
use the `https:` scheme and end with a trailing slash.
|
||||
|
||||
Terraform expects the given URL to be a base URL for an implementation of
|
||||
[the provider network mirror protocol](/internals/provider-network-mirror-protocol),
|
||||
which is designed to be relatively easy to implement using typical static
|
||||
website hosting mechanisms.
|
||||
Terraform expects the given URL to be a base URL for an implementation of
|
||||
[the provider network mirror protocol](/docs/internals/provider-network-mirror-protocol.html),
|
||||
which is designed to be relatively easy to implement using typical static
|
||||
website hosting mechanisms.
|
||||
|
||||
~> **Warning:** Don't configure `network_mirror` URLs that you do not trust.
|
||||
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
|
||||
attempt to select a suitable published version of your provider to install and
|
||||
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
|
||||
`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
|
|
@ -1,8 +1,8 @@
|
|||
---
|
||||
page_title: Environment Variables
|
||||
description: >-
|
||||
Learn to use environment variables to change Terraform's default behavior.
|
||||
Configure log content and output, set variables, and more.
|
||||
layout: "docs"
|
||||
page_title: "Environment Variables"
|
||||
sidebar_current: "docs-commands-environment-variables"
|
||||
description: "Learn to use environment variables to change Terraform's default behavior. Configure log content and output, set variables, and more."
|
||||
---
|
||||
|
||||
# Environment Variables
|
||||
|
@ -27,7 +27,7 @@ To disable, either unset it, or set it to `off`. For example:
|
|||
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
|
||||
|
||||
|
@ -37,7 +37,7 @@ This specifies where the log should persist its output to. Note that even when `
|
|||
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
|
||||
|
||||
|
@ -58,10 +58,9 @@ export TF_VAR_alist='[1,2,3]'
|
|||
export TF_VAR_amap='{ foo = "bar", baz = "qux" }'
|
||||
```
|
||||
|
||||
For more on how to use `TF_VAR_name` in context, check out the section on [Variable Configuration](/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
|
||||
|
||||
<a id="tf-cli-args"></a>
|
||||
|
||||
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.
|
||||
|
||||
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
|
||||
|
||||
|
@ -145,7 +145,7 @@ export TF_REGISTRY_CLIENT_TIMEOUT=15
|
|||
|
||||
## 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
|
||||
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
|
||||
```
|
||||
|
||||
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).
|
|
@ -1,9 +1,7 @@
|
|||
---
|
||||
page_title: CLI Configuration - Terraform CLI
|
||||
description: >-
|
||||
Find documentation about the CLI config file and customizing Terraform
|
||||
environment variables.
|
||||
sidebar_title: CLI Configuration
|
||||
layout: "docs"
|
||||
page_title: "CLI Configuration - Terraform CLI"
|
||||
description: "Find documentation about the CLI config file and customizing Terraform environment variables."
|
||||
---
|
||||
|
||||
# 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
|
||||
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.
|
||||
- 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
|
||||
provide information that is usually passed on the command line or read from
|
||||
the state of the shell.
|
|
@ -1,5 +1,7 @@
|
|||
---
|
||||
page_title: 'Import: Resource Importability'
|
||||
layout: "docs"
|
||||
page_title: "Import: Resource Importability"
|
||||
sidebar_current: "docs-import-importability"
|
||||
description: |-
|
||||
Each resource in Terraform must implement some basic logic to become
|
||||
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.
|
||||
|
||||
To make a resource importable, please see
|
||||
[Extending Terraform: Resources — Import](/plugin/sdkv2/resources/import).
|
||||
[Extending Terraform: Resources — Import](/docs/extend/resources/import.html).
|
|
@ -1,8 +1,8 @@
|
|||
---
|
||||
page_title: Import
|
||||
description: >-
|
||||
Terraform can import and manage existing infrastructure. This can help you
|
||||
transition your infrastructure to Terraform.
|
||||
layout: "docs"
|
||||
page_title: "Import"
|
||||
sidebar_current: "docs-import"
|
||||
description: "Terraform can import and manage existing infrastructure. This can help you transition your infrastructure to Terraform."
|
||||
---
|
||||
|
||||
# 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.
|
||||
If you import the same object multiple times, Terraform may exhibit unwanted
|
||||
behavior. For more information on this assumption, see
|
||||
[the State section](/language/state/).
|
||||
[the State section](/docs/language/state/index.html).
|
||||
|
||||
## Currently State Only
|
||||
|
||||
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.
|
||||
|
||||
Because of this, prior to running `terraform import` it is necessary to write
|
||||
|
@ -41,7 +41,7 @@ importing existing resources.
|
|||
## Remote Backends
|
||||
|
||||
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
|
||||
Terraform Cloud environment. Because of this, the import command will not have
|
||||
access to information from the remote backend, such as workspace variables.
|
|
@ -1,6 +1,9 @@
|
|||
---
|
||||
page_title: 'Import: Usage'
|
||||
description: The `terraform import` command is used to import existing infrastructure.
|
||||
layout: "docs"
|
||||
page_title: "Import: Usage"
|
||||
sidebar_current: "docs-import-usage"
|
||||
description: |-
|
||||
The `terraform import` command is used to import existing infrastructure.
|
||||
---
|
||||
|
||||
# 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.
|
||||
If you import the same object multiple times, Terraform may exhibit unwanted
|
||||
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
|
||||
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,
|
||||
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.
|
||||
|
||||
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.
|
||||
|
||||
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.
|
|
@ -1,8 +1,8 @@
|
|||
---
|
||||
page_title: Terraform CLI Documentation
|
||||
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.
|
||||
layout: "docs"
|
||||
page_title: "Terraform CLI Documentation"
|
||||
sidebar_current: "docs-home"
|
||||
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
|
||||
|
@ -16,4 +16,4 @@ Cloud or Terraform Enterprise.
|
|||
|
||||
Notably, this documentation does not cover the syntax and usage of the Terraform
|
||||
language. For that, see the
|
||||
[Terraform Language Documentation](/language/).
|
||||
[Terraform Language Documentation](/docs/language/index.html).
|
|
@ -1,17 +1,14 @@
|
|||
---
|
||||
page_title: Initializing Working Directories - Terraform CLI
|
||||
description: >-
|
||||
Working directories contain configurations, settings, cached plugins and
|
||||
modules, and state data. Learn how to initialize and manage working
|
||||
directories.
|
||||
sidebar_title: Initializing Working Directories
|
||||
layout: "docs"
|
||||
page_title: "Initializing Working Directories - Terraform CLI"
|
||||
description: "Working directories contain configurations, settings, cached plugins and modules, and state data. Learn how to initialize and manage working directories."
|
||||
---
|
||||
|
||||
# Initializing Working Directories
|
||||
|
||||
Terraform expects to be invoked from a working directory that contains
|
||||
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
|
||||
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.
|
||||
- A hidden `.terraform` directory, which Terraform uses to manage cached
|
||||
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
|
||||
on the next run. This directory is automatically managed by Terraform, and is
|
||||
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
|
||||
confirmation.
|
||||
|
||||
For details, see [the `terraform init` command](/cli/commands/init).
|
||||
For details, see [the `terraform init` command](/docs/cli/commands/init.html).
|
||||
|
||||
## Reinitialization
|
||||
|
|
@ -1,9 +1,7 @@
|
|||
---
|
||||
page_title: Inspecting Infrastructure - Terraform CLI
|
||||
description: >-
|
||||
Learn commands to inspect dependency information, outputs, etc. Use them for
|
||||
integration or to understand your infrastructure.
|
||||
sidebar_title: Inspecting Infrastructure
|
||||
layout: "docs"
|
||||
page_title: "Inspecting Infrastructure - Terraform CLI"
|
||||
description: "Learn commands to inspect dependency information, outputs, etc. Use them for integration or to understand your 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,
|
||||
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.
|
||||
- [The `terraform output` command](/cli/commands/output) can get the
|
||||
values for the top-level [output values](/language/values/outputs) of
|
||||
- [The `terraform output` command](/docs/cli/commands/output.html) can get the
|
||||
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
|
||||
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
|
||||
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,
|
||||
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
|
||||
directory and workspace, including generated read-only attributes like the
|
||||
unique ID assigned by the cloud provider.
|
|
@ -1,8 +1,9 @@
|
|||
---
|
||||
page_title: APT Packages for Debian and Ubuntu
|
||||
description: >-
|
||||
The HashiCorp APT repositories contain distribution-specific Terraform
|
||||
packages for both Debian and Ubuntu systems.
|
||||
layout: "downloads"
|
||||
page_title: "APT Packages for Debian and Ubuntu"
|
||||
sidebar_current: "docs-cli-install-apt"
|
||||
description: |-
|
||||
The HashiCorp APT repositories contain distribution-specific Terraform packages for both Debian and Ubuntu systems.
|
||||
---
|
||||
|
||||
# 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.
|
||||
|
||||
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
|
||||
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
|
||||
`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
|
||||
|
|
@ -1,8 +1,9 @@
|
|||
---
|
||||
page_title: 'Yum Packages for Red Hat Enterprise Linux, Fedora, and Amazon Linux'
|
||||
description: >-
|
||||
The HashiCorp Yum repositories contain distribution-specific Terraform
|
||||
packages for Red Hat Enterprise Linux, Fedora, and Amazon Linux systems.
|
||||
layout: "downloads"
|
||||
page_title: "Yum Packages for Red Hat Enterprise Linux, Fedora, and Amazon Linux"
|
||||
sidebar_current: "docs-cli-install-yum"
|
||||
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
|
||||
|
@ -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.
|
||||
|
||||
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
|
||||
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
|
||||
`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
|
||||
|
|
@ -1,16 +1,14 @@
|
|||
---
|
||||
page_title: Managing Plugins - Terraform CLI
|
||||
description: >-
|
||||
Commands to install, configure, and show information about providers. Also
|
||||
commands to reduce install effort in air-gapped environments.
|
||||
sidebar_title: Managing Plugins
|
||||
layout: "docs"
|
||||
page_title: "Managing Plugins - Terraform CLI"
|
||||
description: "Commands to install, configure, and show information about providers. Also commands to reduce install effort in air-gapped environments."
|
||||
---
|
||||
|
||||
# Managing Plugins
|
||||
|
||||
Terraform relies on plugins called "providers" in order to manage various types
|
||||
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.)
|
||||
|
||||
-> **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.
|
||||
|
||||
Terraform downloads and/or installs any providers
|
||||
[required](/language/providers/requirements) by a configuration
|
||||
when [initializing](/cli/init/) a working directory. By default,
|
||||
[required](/docs/language/providers/requirements.html) by a configuration
|
||||
when [initializing](/docs/cli/init/index.html) a working directory. By default,
|
||||
this works without any additional interaction but requires network access to
|
||||
download providers from their source registry.
|
||||
|
||||
|
@ -33,29 +31,29 @@ environments.
|
|||
|
||||
Terraform's configuration file includes options for caching downloaded plugins,
|
||||
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
|
||||
|
||||
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.
|
||||
|
||||
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
|
||||
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
|
||||
offered by each provider.
|
||||
|
||||
## 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
|
||||
directory's configuration. This directory will use the nested directory layout
|
||||
that Terraform expects when installing plugins from a local source, so you can
|
||||
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
|
||||
using ambiguous provider version constraints.
|
|
@ -1,8 +1,7 @@
|
|||
---
|
||||
page_title: Plugin Signing
|
||||
description: >-
|
||||
Learn about the types of signatures providers can have on the Terraform
|
||||
Registry.
|
||||
layout: "docs"
|
||||
page_title: "Plugin Signing"
|
||||
description: "Learn about the types of signatures providers can have on the Terraform Registry."
|
||||
---
|
||||
|
||||
<!-- 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 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
|
||||
programatically.
|
||||
verified the ownership of the private key and we provide a chain of trust to the CLI to verify this
|
||||
programatically.
|
||||
* **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
|
||||
if you want to ensure you are using a binary you can trust.
|
||||
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.
|
||||
|
||||
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.
|
|
@ -1,14 +1,14 @@
|
|||
---
|
||||
page_title: Provisioning Infrastructure - Terraform CLI
|
||||
description: 'Learn about commands for core provisioning tasks: plan, apply, and destroy.'
|
||||
sidebar_title: Provisioning Infrastructure
|
||||
layout: "docs"
|
||||
page_title: "Provisioning Infrastructure - Terraform CLI"
|
||||
description: "Learn about commands for core provisioning tasks: plan, apply, and destroy."
|
||||
---
|
||||
|
||||
# Provisioning Infrastructure with Terraform
|
||||
|
||||
Terraform's primary function is to create, modify, and destroy infrastructure
|
||||
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
|
||||
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
|
||||
`destroy`. All of these commands require an
|
||||
[initialized](/cli/init/) working directory, and all of them act
|
||||
only upon the currently selected [workspace](/cli/workspaces/).
|
||||
[initialized](/docs/cli/init/index.html) working directory, and all of them act
|
||||
only upon the currently selected [workspace](/docs/cli/workspaces/index.html).
|
||||
|
||||
## 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
|
||||
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
|
||||
|
||||
|
@ -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
|
||||
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
|
||||
|
||||
|
@ -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
|
||||
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).
|
|
@ -1,16 +1,14 @@
|
|||
---
|
||||
page_title: Manipulating State - Terraform CLI
|
||||
description: >-
|
||||
State data tracks which real-world object corresponds to each resource.
|
||||
Inspect state, move or import resources, and more.
|
||||
sidebar_title: Manipulating State
|
||||
layout: "docs"
|
||||
page_title: "Manipulating State - Terraform CLI"
|
||||
description: "State data tracks which real-world object corresponds to each resource. Inspect state, move or import resources, and more."
|
||||
---
|
||||
|
||||
# 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.
|
||||
|
||||
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;
|
||||
this allows it to modify an existing object when its resource declaration
|
||||
changes.
|
||||
|
@ -22,12 +20,12 @@ infrastructure.
|
|||
|
||||
Terraform CLI supports several workflows for interacting with state:
|
||||
|
||||
- [Inspecting State](/cli/state/inspect)
|
||||
- [Forcing Re-creation (Tainting)](/cli/state/taint)
|
||||
- [Moving Resources](/cli/state/move)
|
||||
- [Inspecting State](/docs/cli/state/inspect.html)
|
||||
- [Forcing Re-creation (Tainting)](/docs/cli/state/taint.html)
|
||||
- [Moving Resources](/docs/cli/state/move.html)
|
||||
- Importing Pre-existing Resources (documented in the
|
||||
[Importing Infrastructure](/cli/import/) section)
|
||||
- [Disaster Recovery](/cli/state/recover)
|
||||
[Importing Infrastructure](/docs/cli/import/index.html) section)
|
||||
- [Disaster Recovery](/docs/cli/state/recover.html)
|
||||
|
||||
~> **Important:** Modifying state data outside a normal plan or apply can cause
|
||||
Terraform to lose track of managed resources, which might waste money, annoy
|
|
@ -1,7 +1,7 @@
|
|||
---
|
||||
page_title: Inspecting State - Terraform CLI
|
||||
description: Commands that allow you to read and update state.
|
||||
sidebar_title: Inspecting State
|
||||
layout: "docs"
|
||||
page_title: "Inspecting State - Terraform CLI"
|
||||
description: "Commands that allow you to read and update state."
|
||||
---
|
||||
|
||||
# Inspecting State
|
||||
|
@ -9,14 +9,14 @@ sidebar_title: Inspecting State
|
|||
Terraform includes some commands for reading and updating state without taking
|
||||
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
|
||||
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.
|
||||
|
||||
- [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
|
||||
done automatically during plans and applies, but not when interacting with
|
||||
state directly.
|
|
@ -1,15 +1,13 @@
|
|||
---
|
||||
page_title: Moving Resources - Terraform CLI
|
||||
description: >-
|
||||
Commands that allow you to manage the way that resources are tracked in state.
|
||||
They are helpful when you move or change resources.
|
||||
sidebar_title: Moving Resources
|
||||
layout: "docs"
|
||||
page_title: "Moving Resources - Terraform CLI"
|
||||
description: "Commands that allow you to manage the way that resources are tracked in state. They are helpful when you move or change resources."
|
||||
---
|
||||
|
||||
# Moving Resources
|
||||
|
||||
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
|
||||
of a resource if you change its name, move it to a different module, or change
|
||||
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
|
||||
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
|
||||
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.
|
||||
|
||||
- [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
|
||||
and workspace, _without_ destroying the corresponding real-world object. (You
|
||||
can later use `terraform import` to start managing that resource in a
|
||||
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
|
||||
re-created.
|
|
@ -1,9 +1,7 @@
|
|||
---
|
||||
page_title: Recovering from State Disasters - Terraform CLI
|
||||
descriptin: >-
|
||||
Commands that allow you to restore state backups and override Terraform state
|
||||
protections.
|
||||
sidebar_title: Recovering from State Disasters
|
||||
layout: "docs"
|
||||
page_title: "Recovering from State Disasters - Terraform CLI"
|
||||
descriptin: "Commands that allow you to restore state backups and override Terraform state protections."
|
||||
---
|
||||
|
||||
# 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
|
||||
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
|
||||
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
|
||||
|
@ -20,7 +18,8 @@ your state data.
|
|||
state backend. Do not run this until you are completely certain what happened
|
||||
to the process that caused the lock to get stuck.
|
||||
|
||||
- [The `terraform state pull` command](/cli/commands/state/pull) and
|
||||
[the `terraform state push` command](/cli/commands/state/push) can
|
||||
- [The `terraform state pull` command](/docs/cli/commands/state/pull.html) and
|
||||
[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.
|
||||
You might need this for obtaining or restoring a state backup.
|
||||
|
|
@ -1,5 +1,7 @@
|
|||
---
|
||||
page_title: 'Internals: Resource Address'
|
||||
layout: "docs"
|
||||
page_title: "Internals: Resource Address"
|
||||
sidebar_current: "docs-internals-resource-addressing"
|
||||
description: |-
|
||||
A resource address is a string that identifies zero or more resource
|
||||
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 keyword indicating a child module (non-root). Multiple `module`
|
||||
keywords in a path indicate nesting.
|
||||
- `module_name` - User-defined name of the module.
|
||||
- `[module index]` - (Optional) [Index](#index-values-for-modules-and-resources)
|
||||
to select an instance from a module call that has multiple instances,
|
||||
surrounded by square bracket characters (`[` and `]`).
|
||||
* `module` - Module keyword indicating a child module (non-root). Multiple `module`
|
||||
keywords in a path indicate nesting.
|
||||
* `module_name` - User-defined name of the module.
|
||||
* `[module index]` - (Optional) [Index](#index-values-for-modules-and-resources)
|
||||
to select an instance from a module call that has multiple instances,
|
||||
surrounded by square bracket characters (`[` and `]`).
|
||||
|
||||
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.
|
||||
|
@ -62,11 +64,11 @@ It has the following syntax:
|
|||
resource_type.resource_name[instance index]
|
||||
```
|
||||
|
||||
- `resource_type` - Type of the resource being addressed.
|
||||
- `resource_name` - User-defined name of the resource.
|
||||
- `[instance index]` - (Optional) [Index](#index-values-for-modules-and-resources)
|
||||
to select an instance from a resource that has multiple instances,
|
||||
surrounded by square bracket characters (`[` and `]`).
|
||||
* `resource_type` - Type of the resource being addressed.
|
||||
* `resource_name` - User-defined name of the resource.
|
||||
* `[instance index]` - (Optional) [Index](#index-values-for-modules-and-resources)
|
||||
to select an instance from a resource that has multiple instances,
|
||||
surrounded by square bracket characters (`[` and `]`).
|
||||
|
||||
-> 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
|
||||
|
@ -77,12 +79,12 @@ in any descendent module.
|
|||
|
||||
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
|
||||
instances specified by the `count` meta-argument. Omitting an index when
|
||||
addressing a resource where `count > 1` means that the address references
|
||||
all instances.
|
||||
- `["INDEX"]` where `INDEX` is a alphanumerical key index into a resource with
|
||||
multiple instances specified by the `for_each` meta-argument.
|
||||
* `[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
|
||||
addressing a resource where `count > 1` means that the address references
|
||||
all instances.
|
||||
* `["INDEX"]` where `INDEX` is a alphanumerical key index into a resource with
|
||||
multiple instances specified by the `for_each` meta-argument.
|
||||
|
||||
## Examples
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
---
|
||||
page_title: Forcing Re-creation of Resources (Tainting) - Terraform CLI
|
||||
description: Commands that allow you to destroy and re-create resources manually.
|
||||
sidebar_title: Forcing Re-creation of Resources (Tainting)
|
||||
layout: "docs"
|
||||
page_title: "Forcing Re-creation of Resources (Tainting) - Terraform CLI"
|
||||
description: "Commands that allow you to destroy and re-create resources manually."
|
||||
---
|
||||
|
||||
# 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
|
||||
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
|
||||
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
|
||||
to failed [provisioners](/language/resources/provisioners/syntax).
|
||||
to failed [provisioners](/docs/language/resources/provisioners/syntax.html).
|
|
@ -1,30 +1,28 @@
|
|||
---
|
||||
page_title: Managing Workspaces - Terraform CLI
|
||||
description: >-
|
||||
Commands to list, select, create, and output workspaces. Workspaces help
|
||||
manage different groups of resources with one configuration.
|
||||
sidebar_title: Managing Workspaces
|
||||
layout: "docs"
|
||||
page_title: "Managing Workspaces - Terraform CLI"
|
||||
description: "Commands to list, select, create, and output workspaces. Workspaces help manage different groups of resources with one configuration."
|
||||
---
|
||||
|
||||
# Managing Workspaces
|
||||
|
||||
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
|
||||
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
|
||||
named `default`.)
|
||||
- For a given working directory, only one workspace can be _selected_ at a time.
|
||||
- Most Terraform commands (including [provisioning](/cli/run/)
|
||||
and [state manipulation](/cli/state/) commands) only interact
|
||||
- Most Terraform commands (including [provisioning](/docs/cli/run/index.html)
|
||||
and [state manipulation](/docs/cli/state/index.html) commands) only interact
|
||||
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.
|
||||
- Use the [`terraform workspace list`](/cli/commands/workspace/list),
|
||||
[`terraform workspace new`](/cli/commands/workspace/new), and
|
||||
[`terraform workspace delete`](/cli/commands/workspace/delete) commands
|
||||
- Use the [`terraform workspace list`](/docs/cli/commands/workspace/list.html),
|
||||
[`terraform workspace new`](/docs/cli/commands/workspace/new.html), and
|
||||
[`terraform workspace delete`](/docs/cli/commands/workspace/delete.html) commands
|
||||
to manage the available workspaces in the current working directory.
|
||||
|
||||
-> **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
|
||||
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
|
||||
completely separate state data, Terraform can manage many non-overlapping groups
|
||||
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
|
||||
production deployments), and in other cases you might just want many instances
|
||||
of a particular infrastructure pattern.
|
||||
|
||||
The simplest way to maintain multiple instances of a configuration with
|
||||
completely separate state data is to use multiple
|
||||
[working directories](/cli/init/) (with different
|
||||
[backend](/language/settings/backends/configuration) configurations per directory, if you
|
||||
[working directories](/docs/cli/init/index.html) (with different
|
||||
[backend](/docs/language/settings/backends/configuration.html) configurations per directory, if you
|
||||
aren't using the default `local` backend).
|
||||
|
||||
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
|
||||
CLI as a frontend for Terraform Cloud, you associate the current working
|
||||
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
|
||||
`terraform workspace` commands to select which remote workspace to use.
|
||||
|
||||
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.
|
|
@ -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>
|
|
@ -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}} />
|
|
@ -1,5 +0,0 @@
|
|||
---
|
||||
page_title: Terraform Configuration
|
||||
---
|
||||
|
||||
# Terraform Configuration
|
|
@ -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>
|
|
@ -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}} />
|
|
@ -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>
|
|
@ -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}} />
|
|
@ -1,9 +1,9 @@
|
|||
---
|
||||
page_title: Archiving Providers
|
||||
description: >-
|
||||
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.
|
||||
layout: "docs"
|
||||
page_title: "Archiving Providers"
|
||||
sidebar_current: "docs-internals"
|
||||
description: |-
|
||||
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.
|
||||
|
||||
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*.
|
|
@ -1,17 +1,18 @@
|
|||
---
|
||||
page_title: Credentials Helpers
|
||||
description: >-
|
||||
Credentials helpers are external programs that know how to store and retrieve
|
||||
API tokens for remote Terraform services.
|
||||
layout: "docs"
|
||||
page_title: "Credentials Helpers"
|
||||
sidebar_current: "docs-internals-credentials-helpers"
|
||||
description: |-
|
||||
Credentials helpers are external programs that know how to store and retrieve API tokens for remote Terraform services.
|
||||
---
|
||||
|
||||
# Credentials Helpers
|
||||
|
||||
For Terraform-specific features that interact with remote network services,
|
||||
such as [module registries](/registry/) and
|
||||
[remote operations](/cloud-docs/run/cli), Terraform by default looks for
|
||||
such as [module registries](/docs/registry/) and
|
||||
[remote operations](/docs/cloud/run/cli.html), Terraform by default looks for
|
||||
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
|
||||
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
|
||||
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
|
||||
|
||||
|
@ -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
|
||||
an executable program named `terraform-credentials-credstore` (with an `.exe`
|
||||
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
|
||||
|
||||
|
@ -56,7 +57,7 @@ The current set of verbs are:
|
|||
|
||||
To represent credentials, the credentials helper protocol uses a JSON object
|
||||
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
|
||||
value is the token string:
|
||||
|
||||
|
@ -159,7 +160,7 @@ other properties as described above.
|
|||
|
||||
Terraform does not have any automatic installation mechanism for credentials
|
||||
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
|
||||
named with the expected naming scheme (`terraform-credentials-example`) and,
|
|
@ -1,14 +1,15 @@
|
|||
---
|
||||
page_title: Debugging
|
||||
description: >-
|
||||
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
|
||||
layout: "docs"
|
||||
page_title: "Debugging"
|
||||
sidebar_current: "docs-internals-debug"
|
||||
description: |-
|
||||
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
|
||||
|
||||
> **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.
|
||||
|
|
@ -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.
|
|
@ -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.
|
|
@ -1,8 +1,8 @@
|
|||
---
|
||||
page_title: Internals
|
||||
description: >-
|
||||
Learn the technical details of how Terraform generates and executes
|
||||
infrastructure plans, works with plugins, obtains credentials, etc.
|
||||
layout: "docs"
|
||||
page_title: "Internals"
|
||||
sidebar_current: "docs-internals"
|
||||
description: "Learn the technical details of how Terraform generates and executes infrastructure plans, works with plugins, obtains credentials, etc."
|
||||
---
|
||||
|
||||
# Terraform Internals
|
|
@ -1,8 +1,9 @@
|
|||
---
|
||||
page_title: 'Internals: JSON Output Format'
|
||||
description: >-
|
||||
Terraform provides a machine-readable JSON representation of state,
|
||||
configuration and plan.
|
||||
layout: "docs"
|
||||
page_title: "Internals: JSON Output Format"
|
||||
sidebar_current: "docs-internals-json"
|
||||
description: |-
|
||||
Terraform provides a machine-readable JSON representation of state, configuration and plan.
|
||||
---
|
||||
|
||||
# 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.
|
||||
|
||||
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
|
||||
value `"1.0"`. The semantics of this version are:
|
||||
|
@ -26,7 +27,7 @@ value `"1.0"`. The semantics of this version are:
|
|||
version.
|
||||
|
||||
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
|
||||
|
||||
|
@ -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>`.
|
||||
- [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.
|
||||
- [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.
|
||||
- [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.
|
||||
- [Change Representation](#change-representation) — A sub-object of plan output that describes planned changes to an object.
|
||||
|
||||
## 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.
|
||||
|
|
@ -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.
|
|
@ -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.
|
|
@ -1,25 +1,26 @@
|
|||
---
|
||||
page_title: Login Protocol
|
||||
description: >-
|
||||
The login protocol is used for authenticating Terraform against servers
|
||||
providing Terraform-native services.
|
||||
layout: "docs"
|
||||
page_title: "Login Protocol"
|
||||
sidebar_current: "docs-internals-login-protocol"
|
||||
description: |-
|
||||
The login protocol is used for authenticating Terraform against servers providing Terraform-native services.
|
||||
---
|
||||
|
||||
# Server-side Login Protocol
|
||||
|
||||
~> **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
|
||||
offer Terraform-native services in a third-party system.
|
||||
|
||||
The `terraform login` command supports performing an OAuth 2.0 authorization
|
||||
request using configuration provided by the target host. You may wish to
|
||||
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.
|
||||
|
||||
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
|
||||
name `login.v1` and define for it an object containing OAuth client
|
||||
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
|
||||
[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
|
||||
when the client and server are closely related. The `password` grant type is
|
||||
not supported for any other hostname and will be ignored.
|
|
@ -1,8 +1,9 @@
|
|||
---
|
||||
page_title: 'Internals: Machine-Readable UI'
|
||||
description: >-
|
||||
Terraform provides a machine-readable streaming JSON UI output for plan,
|
||||
apply, and refresh operations.
|
||||
layout: "docs"
|
||||
page_title: "Internals: Machine-Readable UI"
|
||||
sidebar_current: "docs-internals-machine-readable-ui"
|
||||
description: |-
|
||||
Terraform provides a machine-readable streaming JSON UI output for plan, apply, and refresh operations.
|
||||
---
|
||||
|
||||
# Machine-Readable UI
|
||||
|
@ -24,7 +25,7 @@ value `"1.0"`. The semantics of this version are:
|
|||
version.
|
||||
|
||||
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
|
||||
|
||||
|
@ -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
|
||||
- `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
|
||||
|
||||
|
@ -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
|
||||
- `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
|
||||
|
||||
|
@ -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
|
||||
- `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:
|
||||
- `tainted`: resource was marked as tainted
|
||||
- `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
|
||||
- `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_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_no_module`: enclosing module instance is not in configuration
|
||||
- `tainted`: resource was marked as tainted
|
||||
- `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
|
||||
- `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_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_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
|
||||
|
|
@ -1,5 +1,7 @@
|
|||
---
|
||||
page_title: Module Registry Protocol
|
||||
layout: "docs"
|
||||
page_title: "Module Registry Protocol"
|
||||
sidebar_current: "docs-internals-module-registry-protocol"
|
||||
description: |-
|
||||
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
|
||||
|
@ -23,7 +25,7 @@ publishing them on the public Terraform Registry.
|
|||
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.
|
||||
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
|
||||
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
|
||||
syntax `hostname/namespace/name/system`, where:
|
||||
|
||||
- `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
|
||||
* `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
|
||||
can contain one or more modules that are somehow related. On the public
|
||||
Terraform Registry the "namespace" represents the organization that is
|
||||
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.
|
||||
- `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
|
||||
addresses that differ only in "system" to reflect provider-specific
|
||||
implementations of the abstraction, like
|
||||
|
@ -55,10 +57,10 @@ is optional, and if omitted defaults to `registry.terraform.io/`.
|
|||
|
||||
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
|
||||
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.
|
||||
|
||||
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
|
||||
|
||||
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".
|
||||
|
||||
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
|
||||
available versions for a given fully-qualified module.
|
||||
|
||||
| Method | Path | Produces |
|
||||
| ------ | ------------------------------------- | ------------------ |
|
||||
| `GET` | `:namespace/:name/:provider/versions` | `application/json` |
|
||||
| Method | Path | Produces |
|
||||
| ------ | ------------------------------------- | -------------------------- |
|
||||
| `GET` | `:namespace/:name/:provider/versions` | `application/json` |
|
||||
|
||||
### Parameters
|
||||
|
||||
|
@ -175,9 +177,9 @@ requested namespace, name, and provider
|
|||
|
||||
This endpoint downloads the specified version of a module for a single provider.
|
||||
|
||||
| Method | Path | Produces |
|
||||
| ------ | -------------------------------------------- | ------------------ |
|
||||
| `GET` | `:namespace/:name/:system/:version/download` | `application/json` |
|
||||
| Method | Path | Produces |
|
||||
| ------ | ------------------------------------------------------ | -------------------------- |
|
||||
| `GET` | `:namespace/:name/:system/:version/download` | `application/json` |
|
||||
|
||||
### 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.
|
||||
The value of this header accepts the same values as the `source` argument
|
||||
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.
|
||||
|
||||
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
|
||||
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).
|
|
@ -1,8 +1,9 @@
|
|||
---
|
||||
page_title: Provider Metadata
|
||||
description: >-
|
||||
For advanced use cases, modules can provide some pre-defined metadata for
|
||||
providers.
|
||||
layout: "docs"
|
||||
page_title: "Provider Metadata"
|
||||
sidebar_current: "docs-internals-provider-meta"
|
||||
description: |-
|
||||
For advanced use cases, modules can provide some pre-defined metadata for providers.
|
||||
---
|
||||
|
||||
# Provider Metadata
|
|
@ -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: |-
|
||||
The provider network mirror protocol is implemented by a server intending
|
||||
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.
|
||||
|
||||
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
|
||||
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
|
||||
|
@ -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
|
||||
registry (whose hostname would then be included in the source addresses of the
|
||||
providers it hosts), implement
|
||||
[the provider registry protocol](/internals/provider-registry-protocol)
|
||||
[the provider registry protocol](./provider-registry-protocol.html)
|
||||
instead.
|
||||
|
||||
## Provider Addresses
|
||||
|
@ -34,7 +36,7 @@ instead.
|
|||
Each Terraform provider has an associated address which uniquely identifies it
|
||||
within Terraform. A provider address has the syntax `hostname/namespace/type`,
|
||||
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
|
||||
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
|
||||
|
||||
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
|
||||
the hostname used in identifiers. The Provider Network Mirror protocol does
|
||||
_not_ use the service discovery indirection, because a network mirror location
|
||||
|
@ -94,7 +96,7 @@ base URL from the above CLI configuration example.
|
|||
### Authentication
|
||||
|
||||
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
|
||||
in its requests for operations described below.
|
||||
|
||||
|
@ -115,7 +117,7 @@ This operation determines which versions are currently available for a
|
|||
particular provider.
|
||||
|
||||
| Method | Path | Produces |
|
||||
| ------ | --------------------------------------- | ------------------ |
|
||||
|--------|-----------------------------------------|--------------------|
|
||||
| `GET` | `:hostname/:namespace/:type/index.json` | `application/json` |
|
||||
|
||||
### Parameters
|
||||
|
@ -173,7 +175,7 @@ version matching the configured version constraints, in order to find a zip
|
|||
archive containing the plugin itself.
|
||||
|
||||
| Method | Path | Produces |
|
||||
| ------ | ------------------------------------------ | ------------------ |
|
||||
|--------|--------------------------------------------|--------------------|
|
||||
| `GET` | `:hostname/:namespace/:type/:version.json` | `application/json` |
|
||||
|
||||
### Parameters
|
||||
|
@ -229,13 +231,13 @@ the following properties:
|
|||
* `url` (required): a string specifying the URL from which Terraform should
|
||||
download the `.zip` archive containing the requested provider plugin version.
|
||||
|
||||
Terraform resolves the URL relative to the URL from which the current
|
||||
JSON document was returned, so the examples above containing only a
|
||||
filename would cause Terraform to construct a URL like:
|
||||
Terraform resolves the URL relative to the URL from which the current
|
||||
JSON document was returned, so the examples above containing only a
|
||||
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
|
||||
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
|
||||
hashes of each provider.
|
||||
|
||||
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
|
||||
package matches that hash. If the response does not include a `hashes`
|
||||
property then Terraform will install the indicated archive with no
|
||||
verification.
|
||||
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
|
||||
package matches that hash. If the response does not include a `hashes`
|
||||
property then Terraform will install the indicated archive with no
|
||||
verification.
|
||||
|
||||
Terraform CLI will only attempt to download versions that it has previously
|
||||
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.
|
||||
|
||||
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,
|
||||
download the packages for those providers from their origin registries, and
|
||||
place them into a local directory suitable for use as a mirror.
|
|
@ -1,5 +1,7 @@
|
|||
---
|
||||
page_title: Provider Registry Protocol
|
||||
layout: "docs"
|
||||
page_title: "Provider Registry Protocol"
|
||||
sidebar_current: "docs-internals-provider-registry-protocol"
|
||||
description: |-
|
||||
The provider registry protocol is implemented by a host intending to be the
|
||||
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
|
||||
originated from, and the default location Terraform will consult for
|
||||
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
|
||||
can contain one or more providers that are somehow related. On the public
|
||||
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
|
||||
an alternative local distribution source for an existing provider -- that is,
|
||||
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.
|
||||
|
||||
## Provider Versions
|
||||
|
@ -96,7 +98,7 @@ version selection.
|
|||
## Service Discovery
|
||||
|
||||
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".
|
||||
|
||||
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.
|
||||
|
||||
| Method | Path | Produces |
|
||||
| ------ | --------------------------- | ------------------ |
|
||||
|--------|-----------------------------|--------------------|
|
||||
| `GET` | `:namespace/:type/versions` | `application/json` |
|
||||
|
||||
### Parameters
|
||||
|
@ -196,29 +198,29 @@ with the following properties:
|
|||
version supported. For example, `5.1` means that the provider supports both
|
||||
protocol `5.0` and protocol `5.1`.
|
||||
|
||||
Terraform uses this information, when available, to provide hints to users
|
||||
about upgrading or downgrading their version of a particular provider to
|
||||
work with their current version of Terraform, if their currently-selected
|
||||
versions are not compatible.
|
||||
Terraform uses this information, when available, to provide hints to users
|
||||
about upgrading or downgrading their version of a particular provider to
|
||||
work with their current version of Terraform, if their currently-selected
|
||||
versions are not compatible.
|
||||
|
||||
Which API versions are supported is, for most providers, decided by which
|
||||
version of the Terraform SDK they are built against. Consult the Terraform
|
||||
SDK documentation for more information.
|
||||
Which API versions are supported is, for most providers, decided by which
|
||||
version of the Terraform SDK they are built against. Consult the Terraform
|
||||
SDK documentation for more information.
|
||||
|
||||
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
|
||||
it isn't useful to list major versions 4 or earlier in a third-party
|
||||
provider registry.
|
||||
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
|
||||
it isn't useful to list major versions 4 or earlier in a third-party
|
||||
provider registry.
|
||||
* `platforms` (recommended): an array of objects describing platforms that have
|
||||
packages available for this version.
|
||||
|
||||
Terraform may use this information, when available, to provide hints to
|
||||
users about upgrading or downgrading their version of a particular provider
|
||||
for compatibility with their current platform.
|
||||
Terraform may use this information, when available, to provide hints to
|
||||
users about upgrading or downgrading their version of a particular provider
|
||||
for compatibility with their current platform.
|
||||
|
||||
The `platforms` objects have properties `os` and `arch`, whose values match
|
||||
the properties of the same name in the response to
|
||||
[Find a Provider Package](#find-a-provider-package).
|
||||
The `platforms` objects have properties `os` and `arch`, whose values match
|
||||
the properties of the same name in the response to
|
||||
[Find a Provider Package](#find-a-provider-package).
|
||||
|
||||
Return `404 Not Found` to signal that the registry does not have a provider
|
||||
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.
|
||||
|
||||
| Method | Path | Produces |
|
||||
| ------ | ---------------------------------------------- | ------------------ |
|
||||
|--------|------------------------------------------------|--------------------|
|
||||
| `GET` | `:namespace/:type/:version/download/:os/:arch` | `application/json` |
|
||||
|
||||
### 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
|
||||
[List Available Versions](#list-available-versions).
|
||||
|
||||
While this property is optional when listing available options, it is
|
||||
_required_ for describing an individual provider package so that Terraform
|
||||
CLI can avoid downloading a package that will not be compatible with it.
|
||||
While this property is optional when listing available options, it is
|
||||
_required_ for describing an individual provider package so that Terraform
|
||||
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
|
||||
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
|
||||
other packages for the same provider version on other platforms.
|
||||
|
||||
The indicated document must be in the format generated by the `sha256`
|
||||
command available on many Unix systems, with one entry recording the
|
||||
same filename given in the `filename` property (case sensitive).
|
||||
The indicated document must be in the format generated by the `sha256`
|
||||
command available on many Unix systems, with one entry recording the
|
||||
same filename given in the `filename` property (case sensitive).
|
||||
|
||||
* `shasums_signature_url` (required): a URL from which Terraform can retrieve
|
||||
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
|
||||
at `shasums_signature_url`. The object has the following nested properties:
|
||||
|
||||
* `gpg_public_keys` (required): an array of objects, each describing one
|
||||
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
|
||||
produced the signature at `shasums_signature_url`. These objects have
|
||||
the following nested properties:
|
||||
* `gpg_public_keys` (required): an array of objects, each describing one
|
||||
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
|
||||
produced the signature at `shasums_signature_url`. These objects have
|
||||
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**
|
||||
associated with this GPG key.
|
||||
* `ascii_armor` (required): an "ascii-armor" encoding of the **public key**
|
||||
associated with this GPG key.
|
||||
|
||||
Return `404 Not Found` to signal that the given provider version isn't
|
||||
available for the requested operating system and/or architecture. Terraform
|
|
@ -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: |-
|
||||
Remote service discovery is a protocol used to locate Terraform-native
|
||||
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:
|
||||
|
||||
* `login.v1`: [login protocol version 1](/cli/commands/login)
|
||||
* `modules.v1`: [module registry API version 1](/internals/module-registry-protocol)
|
||||
* `providers.v1`: [provider registry API version 1](/internals/provider-registry-protocol)
|
||||
* `login.v1`: [login protocol version 1](/docs/cli/commands/login.html)
|
||||
* `modules.v1`: [module registry API version 1](module-registry-protocol.html)
|
||||
* `providers.v1`: [provider registry API version 1](provider-registry-protocol.html)
|
||||
|
||||
## Authentication
|
||||
|
||||
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.
|
||||
|
||||
The credentials may also be provided to endpoints declared in the discovery
|
|
@ -1,11 +1,10 @@
|
|||
---
|
||||
page_title: Attributes as Blocks - Configuration Language
|
||||
description: >-
|
||||
For historical reasons, certain arguments within resource blocks can use
|
||||
either
|
||||
|
||||
layout: "language"
|
||||
page_title: "Attributes as Blocks - Configuration Language"
|
||||
sidebar_current: "docs-config-attr-as-blocks"
|
||||
description: |-
|
||||
For historical reasons, certain arguments within resource blocks can use either
|
||||
block or attribute syntax.
|
||||
sidebar_title: 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
|
||||
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.
|
||||
- Create a reusable module that wraps this type of resource.
|
||||
|
||||
## Details
|
||||
|
||||
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:
|
||||
|
||||
- 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
|
||||
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
|
||||
blocks of the same type can be present. If the nested attributes themselves
|
||||
have default values, they are honored for each nested block separately,
|
||||
merging in with any explicitly-defined arguments.
|
||||
|
||||
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
|
||||
interpreted differently depending on whether a particular name is an argument
|
||||
or a nested block type.
|
||||
|
@ -154,7 +153,7 @@ example = [
|
|||
|
||||
For the arguments that use the attributes-as-blocks usage mode, the above is
|
||||
a better pattern than using
|
||||
[`dynamic` blocks](/language/expressions/dynamic-blocks)
|
||||
[`dynamic` blocks](/docs/language/expressions/dynamic-blocks.html)
|
||||
because the case where the
|
||||
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
|
||||
|
@ -164,7 +163,7 @@ dynamically-generating _normal_ nested blocks, though.
|
|||
## In JSON syntax
|
||||
|
||||
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.
|
||||
|
||||
The interpretation of these values in JSON syntax is, therefore, equivalent
|
|
@ -1,10 +1,8 @@
|
|||
---
|
||||
page_title: Data Sources - Configuration Language
|
||||
description: >-
|
||||
Data sources allow Terraform to use external data, function output, and data
|
||||
from other configurations. Learn data resource arguments, behavior, and
|
||||
lifecycle.
|
||||
sidebar_title: Data Sources
|
||||
layout: "language"
|
||||
page_title: "Data Sources - Configuration Language"
|
||||
sidebar_current: "docs-config-data-sources"
|
||||
description: "Data sources allow Terraform to use external data, function output, and data from other configurations. Learn data resource arguments, behavior, and lifecycle."
|
||||
---
|
||||
|
||||
# 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.
|
||||
|
||||
Each [provider](/language/providers/) may offer data sources
|
||||
alongside its set of [resource](/language/resources/)
|
||||
Each [provider](/docs/language/providers/index.html) may offer data sources
|
||||
alongside its set of [resource](/docs/language/resources/index.html)
|
||||
types.
|
||||
|
||||
## 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
|
||||
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
|
||||
data sources that most often belong to a single cloud or on-premises
|
||||
infrastructure platform.
|
||||
|
||||
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
|
||||
use of [expressions](/language/expressions/) and other dynamic
|
||||
use of [expressions](/docs/language/expressions/index.html) and other dynamic
|
||||
Terraform language features.
|
||||
|
||||
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 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
|
||||
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.
|
||||
|
||||
|
||||
## Multiple Resource Instances
|
||||
|
||||
Data resources support [`count`](/language/meta-arguments/count)
|
||||
and [`for_each`](/language/meta-arguments/for_each)
|
||||
Data resources support [`count`](/docs/language/meta-arguments/count.html)
|
||||
and [`for_each`](/docs/language/meta-arguments/for_each.html)
|
||||
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
|
||||
|
@ -136,7 +135,7 @@ own variant of the constraint arguments, producing an indexed result.
|
|||
|
||||
## 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.
|
||||
|
||||
## Lifecycle Customizations
|
||||
|
@ -174,7 +173,7 @@ and name must be unique.
|
|||
|
||||
Within the block (the `{ }`) is configuration for the data instance. The
|
||||
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
|
||||
documentation for configuring and using the data types it provides.
|
||||
|
||||
|
@ -192,13 +191,13 @@ resource "aws_instance" "web" {
|
|||
## Meta-Arguments
|
||||
|
||||
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
|
||||
[`lifecycle` configuration block](/language/meta-arguments/lifecycle).
|
||||
[`lifecycle` configuration block](/docs/language/meta-arguments/lifecycle.html).
|
||||
|
||||
### 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
|
||||
configuration to use with the `provider` meta-argument:
|
||||
|
||||
|
@ -211,7 +210,7 @@ data "aws_ami" "web" {
|
|||
```
|
||||
|
||||
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.
|
||||
|
||||
## Data Source Lifecycle
|
|
@ -1,9 +1,7 @@
|
|||
---
|
||||
page_title: Dependency Lock File (.terraform.lock.hcl) - Configuration Language
|
||||
description: >-
|
||||
Terraform uses the dependency lock file .teraform.lock.hcl to track and select
|
||||
provider versions. Learn about dependency installation and lock file changes.
|
||||
sidebar_title: Dependency Lock File (.terraform.lock.hcl)
|
||||
layout: "language"
|
||||
page_title: "Dependency Lock File (.terraform.lock.hcl) - Configuration Language"
|
||||
description: "Terraform uses the dependency lock file .teraform.lock.hcl to track and select provider versions. Learn about dependency installation and lock file changes."
|
||||
---
|
||||
|
||||
# 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
|
||||
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.
|
||||
- [Modules](/language/modules/), which allow
|
||||
* [Modules](/docs/language/modules/index.html), which allow
|
||||
splitting out groups of Terraform configuration constructs (written in the
|
||||
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
|
||||
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,
|
||||
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)
|
||||
|
@ -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.
|
||||
|
||||
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
|
||||
potential changes to your external dependencies via code review, just as you
|
||||
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:
|
||||
|
||||
- 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
|
||||
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
|
||||
your current platform _and_ any other packages that might be available for
|
||||
other platforms.
|
||||
|
||||
In this case, the `terraform init` output will include the fingerprint of
|
||||
the key that signed the checksums, with a message like
|
||||
`(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
|
||||
lock file containing the signed checksums, or to retrieve and verify the
|
||||
full set of available packages for the given provider version.
|
||||
In this case, the `terraform init` output will include the fingerprint of
|
||||
the key that signed the checksums, with a message like
|
||||
`(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
|
||||
lock file containing the signed checksums, or to retrieve and verify the
|
||||
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
|
||||
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
|
||||
for other platforms and so the configuration will not be usable on any other
|
||||
platform.
|
||||
|
||||
To avoid this problem you can pre-populate checksums for a variety of
|
||||
different platforms in your lock file using
|
||||
[the `terraform providers lock` command](/cli/commands/providers/lock),
|
||||
which will then allow future calls to `terraform init` to verify that the
|
||||
packages available in your chosen mirror match the official packages from
|
||||
the provider's origin registry.
|
||||
To avoid this problem you can pre-populate checksums for a variety of
|
||||
different platforms in your lock file using
|
||||
[the `terraform providers lock` command](/docs/cli/commands/providers/lock.html),
|
||||
which will then allow future calls to `terraform init` to verify that the
|
||||
packages available in your chosen mirror match the official packages from
|
||||
the provider's origin registry.
|
||||
|
||||
## Understanding Lock File Changes
|
||||
|
||||
|
@ -160,7 +158,7 @@ proposed changes. The following sections will describe these common situations.
|
|||
### Dependency on a new provider
|
||||
|
||||
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
|
||||
dependency itself, `terraform init` will respond to that by selecting the
|
||||
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:
|
||||
|
||||
- `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`: 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
|
||||
make installation decisions, but includes it to help explain to human readers
|
||||
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
|
||||
platforms. The meaning of these hashes is explained more under
|
||||
_[New provider package checksums](#new-provider-package-checksums)_ below.
|
||||
|
@ -299,31 +297,31 @@ additional benefit.
|
|||
|
||||
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
|
||||
providers that you install directly from an origin registry.
|
||||
|
||||
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
|
||||
verifying the official release packages when installed from a registry, but
|
||||
it's not suitable for verifying packages that come from other
|
||||
[provider installation methods](/cli/config/config-file#provider-installation),
|
||||
such as filesystem mirrors using the unpacked directory layout.
|
||||
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
|
||||
verifying the official release packages when installed from a registry, but
|
||||
it's not suitable for verifying packages that come from other
|
||||
[provider installation methods](/docs/cli/config/config-file.html#provider-installation),
|
||||
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.
|
||||
|
||||
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
|
||||
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
|
||||
same contents, or a recompressed `.zip` file which contains the same files
|
||||
but potentially different metadata or compression schemes.
|
||||
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
|
||||
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
|
||||
same contents, or a recompressed `.zip` file which contains the same files
|
||||
but potentially different metadata or compression schemes.
|
||||
|
||||
Due to the limited scope of the `zh:` scheme, Terraform will
|
||||
opportunistically add in the corresponding `h1:` checksums as it learns
|
||||
of them, which is what caused the addition of a second `h1:` checksum
|
||||
in the example change shown above.
|
||||
Due to the limited scope of the `zh:` scheme, Terraform will
|
||||
opportunistically add in the corresponding `h1:` checksums as it learns
|
||||
of them, which is what caused the addition of a second `h1:` checksum
|
||||
in the example change shown above.
|
||||
|
||||
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
|
||||
|
@ -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
|
||||
can ask Terraform to pre-populate hashes for a chosen set of platforms
|
||||
using
|
||||
[the `terraform providers lock` command](/cli/commands/providers/lock):
|
||||
[the `terraform providers lock` command](/docs/cli/commands/providers/lock.html):
|
||||
|
||||
```
|
||||
terraform providers lock \
|
|
@ -1,9 +1,7 @@
|
|||
---
|
||||
page_title: Conditional Expressions - Configuration Language
|
||||
description: >-
|
||||
Conditional expressions select one of two values. You can use them to define
|
||||
defaults to replace invalid values.
|
||||
sidebar_title: Conditional Expressions
|
||||
layout: "language"
|
||||
page_title: "Conditional Expressions - Configuration Language"
|
||||
description: "Conditional expressions select one of two values. You can use them to define defaults to replace invalid values."
|
||||
---
|
||||
|
||||
# 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
|
||||
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.
|
||||
|
||||
```hcl
|
|
@ -1,11 +1,10 @@
|
|||
---
|
||||
page_title: Dynamic Blocks - Configuration Language
|
||||
description: >-
|
||||
Dynamic blocks automatically construct multi-level, nested block structures.
|
||||
Learn to configure dynamic blocks and understand their behavior.
|
||||
sidebar_title: Dynamic Blocks
|
||||
layout: "language"
|
||||
page_title: "Dynamic Blocks - Configuration Language"
|
||||
description: "Dynamic blocks automatically construct multi-level, nested block structures. Learn to configure dynamic blocks and understand their behavior."
|
||||
---
|
||||
|
||||
|
||||
# `dynamic` Blocks
|
||||
|
||||
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
|
||||
complex value, and generates a nested block for each element of that complex
|
||||
value.
|
||||
|
@ -69,10 +68,10 @@ collection.
|
|||
|
||||
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
|
||||
`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,
|
||||
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
|
||||
can use Terraform expressions and functions to derive a suitable value.
|
||||
For some common examples of such situations, see the
|
||||
[`flatten`](/language/functions/flatten)
|
||||
[`flatten`](/docs/language/functions/flatten.html)
|
||||
and
|
||||
[`setproduct`](/language/functions/setproduct)
|
||||
[`setproduct`](/docs/language/functions/setproduct.html)
|
||||
functions.
|
||||
|
||||
## 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.
|
||||
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
|
||||
tradeoff, see [When to Write a Module](/language/modules/develop/#when-to-write-a-module)
|
||||
and [Module Composition](/language/modules/develop/composition).
|
||||
tradeoff, see [When to Write a Module](/docs/language/modules/develop/index.html#when-to-write-a-module)
|
||||
and [Module Composition](/docs/language/modules/develop/composition.html).
|
|
@ -1,9 +1,7 @@
|
|||
---
|
||||
page_title: For Expressions - Configuration Language
|
||||
description: >-
|
||||
For expressions transform complex input values into complex output values.
|
||||
Learn how to filter inputs and how to group results.
|
||||
sidebar_title: For Expressions
|
||||
layout: "language"
|
||||
page_title: "For Expressions - Configuration Language"
|
||||
description: "For expressions transform complex input values into complex output values. Learn how to filter inputs and how to group results."
|
||||
---
|
||||
|
||||
# `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
|
||||
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
|
||||
[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.
|
||||
|
||||
```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
|
||||
dynamically generate nested blocks using `for` expressions, but you _can_
|
||||
generate nested blocks for a resource dynamically using
|
||||
[`dynamic` blocks](/language/expressions/dynamic-blocks).
|
||||
[`dynamic` blocks](dynamic-blocks.html).
|
|
@ -1,9 +1,7 @@
|
|||
---
|
||||
page_title: Function Calls - Configuration Language
|
||||
description: >-
|
||||
Functions transform and combine values. Learn about Terraform's built-in
|
||||
functions.
|
||||
sidebar_title: Function Calls
|
||||
layout: "language"
|
||||
page_title: "Function Calls - Configuration Language"
|
||||
description: "Functions transform and combine values. Learn about Terraform's built-in functions."
|
||||
---
|
||||
|
||||
# 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.
|
||||
|
||||
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
|
||||
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
|
||||
|
||||
For a full list of available functions, see
|
||||
[the function reference](/language/functions/).
|
||||
[the function reference](/docs/language/functions/index.html).
|
||||
|
||||
## Expanding Function Arguments
|
||||
|
||||
|
@ -53,8 +51,8 @@ The expansion symbol is three periods (`...`), not a Unicode ellipsis character
|
|||
|
||||
## Using Sensitive Data as Function Arguments
|
||||
|
||||
When using sensitive data, such as [an input variable](/language/values/variables#suppressing-values-in-cli-output)
|
||||
or [an output defined](/language/values/outputs#sensitive-suppressing-values-in-cli-output) as sensitive
|
||||
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](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.
|
||||
|
||||
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.
|
||||
|
||||
The small set of special functions includes
|
||||
[`file`](/language/functions/file),
|
||||
[`templatefile`](/language/functions/templatefile),
|
||||
[`timestamp`](/language/functions/timestamp),
|
||||
and [`uuid`](/language/functions/uuid).
|
||||
[`file`](/docs/language/functions/file.html),
|
||||
[`templatefile`](/docs/language/functions/templatefile.html),
|
||||
[`timestamp`](/docs/language/functions/timestamp.html),
|
||||
and [`uuid`](/docs/language/functions/uuid.html).
|
||||
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
|
||||
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.
|
||||
|
||||
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.
|
||||
For `timestamp` in particular, this means that the recorded time will be
|
||||
the instant when Terraform began applying the change, rather than when
|
|
@ -1,9 +1,7 @@
|
|||
---
|
||||
page_title: Expressions - Configuration Language
|
||||
description: >-
|
||||
An overview of expressions to reference or compute values in Terraform
|
||||
configurations, including types, operators, and functions.
|
||||
sidebar_title: Expressions
|
||||
layout: "language"
|
||||
page_title: "Expressions - Configuration Language"
|
||||
description: "An overview of expressions to reference or compute values in Terraform configurations, including types, operators, and functions."
|
||||
---
|
||||
|
||||
# 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,
|
||||
but some contexts limit which expression constructs are allowed,
|
||||
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
|
||||
expressions.
|
||||
|
||||
You can experiment with the behavior of Terraform's expressions from
|
||||
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
|
||||
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
|
||||
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
|
||||
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.
|
||||
|
||||
- [Operators](/language/expressions/operators)
|
||||
- [Operators](/docs/language/expressions/operators.html)
|
||||
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.
|
||||
|
||||
- [Conditional Expressions](/language/expressions/conditionals)
|
||||
- [Conditional Expressions](/docs/language/expressions/conditionals.html)
|
||||
documents the `<CONDITION> ? <TRUE VAL> : <FALSE VAL>` expression, which
|
||||
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
|
||||
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
|
||||
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
|
||||
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
|
||||
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
|
||||
versions. Terraform uses version constraints in several places.
|
|
@ -1,9 +1,7 @@
|
|||
---
|
||||
page_title: Operators - Configuration Language
|
||||
description: >-
|
||||
Operators transform or combine expressions. Learn about arithmetic, logical,
|
||||
equality, and comparison operators.
|
||||
sidebar_title: Operators
|
||||
layout: "language"
|
||||
page_title: "Operators - Configuration Language"
|
||||
description: "Operators transform or combine expressions. Learn about arithmetic, logical, equality, and comparison operators."
|
||||
---
|
||||
|
||||
# Arithmetic and Logical Operators
|
||||
|
@ -57,9 +55,9 @@ as results:
|
|||
* `-a` returns the result of multiplying `a` by `-1`.
|
||||
|
||||
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
|
||||
[the `pow` function](/language/functions/pow).
|
||||
[the `pow` function](/docs/language/functions/pow.html).
|
||||
|
||||
## Equality Operators
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue