Migrating links to new format

This commit is contained in:
Ashlee Boyer 2023-02-23 12:55:56 -05:00
parent c5d0bd40b9
commit 32f7b8ebd0
243 changed files with 1126 additions and 1126 deletions

View File

@ -7,16 +7,16 @@ description: >-
# 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.
> **Hands-on:** Try the [Authenticate the CLI with Terraform Cloud](/terraform/tutorials/cloud/cloud-login?utm_source=WEBSITE&utm_medium=WEB_IO&utm_offer=ARTICLE_PAGE&utm_content=DOCS) tutorial.
[Terraform Cloud](https://cloud.hashicorp.com/products/terraform) and
[Terraform Enterprise](/enterprise) are platforms that perform
[Terraform Enterprise](/terraform/enterprise) 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](/terraform/cloud-docs/run/cli) 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.
@ -27,5 +27,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](/terraform/cli/commands/login)
- [The `terraform logout` command](/terraform/cli/commands/logout)

View File

@ -6,20 +6,20 @@ page_title: Using Terraform Cloud - Terraform CLI
The Terraform CLI integration with Terraform Cloud lets you use Terraform Cloud and Terraform Enterprise on the command line. In the documentation Terraform Cloud instructions also apply to Terraform Enterprise, except where explicitly stated.
Using Terraform Cloud through the command line is called the [CLI-driven run workflow](/cloud-docs/run/cli). When you use the CLI workflow, operations like `terraform plan` or `terraform apply` are remotely executed in Terraform Cloud's run environment by default, with log output streaming to the local terminal. This lets you use Terraform Cloud features within the familiar Terraform CLI workflow, including variables encrypted at rest in a Terraform Cloud workspace, cost estimates, and policy checking.
Using Terraform Cloud through the command line is called the [CLI-driven run workflow](/terraform/cloud-docs/run/cli). When you use the CLI workflow, operations like `terraform plan` or `terraform apply` are remotely executed in Terraform Cloud's run environment by default, with log output streaming to the local terminal. This lets you use Terraform Cloud features within the familiar Terraform CLI workflow, including variables encrypted at rest in a Terraform Cloud workspace, cost estimates, and policy checking.
> **Hands On:** Try the [Migrate State to Terraform Cloud](https://learn.hashicorp.com/tutorials/terraform/cloud-migrate) tutorial.
> **Hands On:** Try the [Migrate State to Terraform Cloud](/terraform/tutorials/cloud/cloud-migrate) tutorial.
Workspaces can also be configured for local execution, in which case Terraform Cloud only stores state. In this mode, Terraform Cloud behaves just like a standard state backend.
-> **Note:** The CLI integration is available in Terraform 1.1.0 and later, and Terraform Enterprise 202201-1 and later. Previous versions can use the [`remote` backend](/language/settings/backends/remote). Refer to [Migrating from the remote
backend](/cli/cloud/migrating) for details about switching to the CLI integration.
-> **Note:** The CLI integration is available in Terraform 1.1.0 and later, and Terraform Enterprise 202201-1 and later. Previous versions can use the [`remote` backend](/terraform/language/settings/backends/remote). Refer to [Migrating from the remote
backend](/terraform/cli/cloud/migrating) for details about switching to the CLI integration.
## Documentation Summary
- [Terraform Cloud Settings](/cli/cloud/settings) documents the `cloud` block that you must add to your configuration to enable Terraform Cloud support.
- [Initializing and Migrating](/cli/cloud/migrating) describes
- [Terraform Cloud Settings](/terraform/cli/cloud/settings) documents the `cloud` block that you must add to your configuration to enable Terraform Cloud support.
- [Initializing and Migrating](/terraform/cli/cloud/migrating) describes
how to start using Terraform Cloud with a working directory that already has state data.
- [Command Line Arguments](/cli/cloud/command-line-arguments) lists the Terraform command flags that are specific to using Terraform with Terraform Cloud.
- [Command Line Arguments](/terraform/cli/cloud/command-line-arguments) lists the Terraform command flags that are specific to using Terraform with Terraform Cloud.
Refer to the [CLI-driven Run Workflow](/cloud-docs/run/cli) for more details about how to use Terraform Cloud from the command line.
Refer to the [CLI-driven Run Workflow](/terraform/cloud-docs/run/cli) for more details about how to use Terraform Cloud from the command line.

View File

@ -4,7 +4,7 @@ page_title: Initializing and Migrating to Terraform Cloud - Terraform CLI
# Initializing and Migrating
After [configuring Terraform Cloud settings](/cli/cloud/settings) for a working directory, you must run `terraform init` to finish setting up. If the working directory has no existing Terraform state, you can start using Terraform with Terraform Cloud right away. Refer to [CLI-driven run workflow](/cloud-docs/run/cli) for more details.
After [configuring Terraform Cloud settings](/terraform/cli/cloud/settings) for a working directory, you must run `terraform init` to finish setting up. If the working directory has no existing Terraform state, you can start using Terraform with Terraform Cloud right away. Refer to [CLI-driven run workflow](/terraform/cloud-docs/run/cli) for more details.
When you run `terraform init` in the following scenarios, Terraform will ask you to choose whether or not to migrate state from any existing workspaces.
@ -14,10 +14,10 @@ When you run `terraform init` in the following scenarios, Terraform will ask you
## Migrating from Local State or State Backends
> **Hands On:** Try the [Migrate State to Terraform Cloud](https://learn.hashicorp.com/tutorials/terraform/cloud-migrate) tutorial.
> **Hands On:** Try the [Migrate State to Terraform Cloud](/terraform/tutorials/cloud/cloud-migrate) tutorial.
If the working directory already has state data available (using either local state or a [state
backend](/language/settings/backends/configuration)), Terraform asks your approval to migrate
backend](/terraform/language/settings/backends/configuration)), Terraform asks your approval to migrate
that state to Terraform Cloud. You will need permission to manage workspaces in the destination Terraform Cloud organization. This process is interactive and self-documenting, and resembles
moving between state backends.
@ -31,13 +31,13 @@ Because of this, Terraform will prompt you to rename the working directory's wor
according to a pattern relative to their existing names. This can indicate the fact that these specific workspaces share configuration. A typical strategy is
`<COMPONENT>-<ENVIRONMENT>-<REGION>` (e.g., `networking-prod-us-east`,
`networking-staging-us-east`). Refer to [Workspace
Naming](/cloud-docs/workspaces/naming) in the Terraform Cloud documentation for more detail.
Naming](/terraform/cloud-docs/workspaces/naming) in the Terraform Cloud documentation for more detail.
## Migrating from the `remote` Backend
If the working directory was already connected to Terraform Cloud with the `remote` backend, Terraform can continue using the same Terraform Cloud workspaces. The local names shown for those workspaces will change to match their remote names.
The [`remote` backend](/language/settings/backends/remote) was the primary implementation of Terraform Cloud's [CLI-driven run workflow](/cloud-docs/run/cli) for Terraform versions 0.11.13 through 1.0.x. We recommend using the native `cloud` integration for Terraform versions 1.1 or later, as it provides an improved user experience and various enhancements.
The [`remote` backend](/terraform/language/settings/backends/remote) was the primary implementation of Terraform Cloud's [CLI-driven run workflow](/terraform/cloud-docs/run/cli) for Terraform versions 0.11.13 through 1.0.x. We recommend using the native `cloud` integration for Terraform versions 1.1 or later, as it provides an improved user experience and various enhancements.
### Block Replacement

View File

@ -7,14 +7,14 @@ description: >-
# Terraform Cloud Settings
Terraform CLI can integrate with Terraform Cloud, acting as a client for Terraform Cloud's
[CLI-driven run workflow](/cloud-docs/run/cli).
[CLI-driven run workflow](/terraform/cloud-docs/run/cli).
> **Hands On:** Try the [Migrate State to Terraform Cloud](https://learn.hashicorp.com/tutorials/terraform/cloud-migrate) tutorial.
> **Hands On:** Try the [Migrate State to Terraform Cloud](/terraform/tutorials/cloud/cloud-migrate) tutorial.
You must configure the following settings to use Terraform Cloud for a particular working directory:
- Provide credentials to access Terraform Cloud, preferably by using the
[`terraform login`](/cli/commands/login) command.
[`terraform login`](/terraform/cli/commands/login) command.
- Add a `cloud` block to the directory's Terraform configuration, to specify
which organization and workspace(s) to use.
- Optionally, use a `.terraformignore` file to specify files that shouldn't be
@ -44,7 +44,7 @@ terraform {
The `cloud` block also has some special restrictions:
- A configuration can only provide one `cloud` block.
- A `cloud` block cannot be used with [state backends](/language/settings/backends/configuration).
- A `cloud` block cannot be used with [state backends](/terraform/language/settings/backends/configuration).
A configuration can use one or the other, but not both.
- A `cloud` block cannot refer to named values (like input variables, locals, or
data source attributes).
@ -66,7 +66,7 @@ The `cloud` block supports the following configuration arguments:
- `tags` - (Optional) A set of Terraform Cloud workspace tags. You will be able to use
this working directory with any workspaces that have all of the specified tags,
and can use [the `terraform workspace` commands](/cli/workspaces)
and can use [the `terraform workspace` commands](/terraform/cli/workspaces)
to switch between them or create new workspaces. New workspaces will automatically have
the specified tags. This option conflicts with `name`.
@ -80,9 +80,9 @@ The `cloud` block supports the following configuration arguments:
- `token` - (Optional) The token used to authenticate with Terraform Cloud.
We recommend omitting the token from the configuration, and instead using
[`terraform login`](/cli/commands/login) or manually configuring
[`terraform login`](/terraform/cli/commands/login) or manually configuring
`credentials` in the
[CLI config file](/cli/config/config-file#credentials).
[CLI config file](/terraform/cli/config/config-file#credentials).
### Environment Variables
@ -90,7 +90,7 @@ The `cloud` block supports the following configuration arguments:
You can use environment variables to configure one or more `cloud` block attributes. This is helpful when you want to configure Terraform as part of a Continuous Integration (CI) pipeline. Terraform only reads these variables if the corresponding attribute is omitted from your configuration file. If you choose to configure the `cloud` block entirely through environment variables, you must still add an empty `cloud` block in your configuration file.
~> **Warning:** Remote execution with non-interactive workflows requires auto-approved deployments. Minimize risk of unpredictable infrastructure changes and configuration drift by making sure that no one can change your infrastructure outside of your automated build pipeline. Refer to [Non-Interactive Workflows](/cloud-docs/run/cli#non-interactive-workflows) for details.
~> **Warning:** Remote execution with non-interactive workflows requires auto-approved deployments. Minimize risk of unpredictable infrastructure changes and configuration drift by making sure that no one can change your infrastructure outside of your automated build pipeline. Refer to [Non-Interactive Workflows](/terraform/cloud-docs/run/cli#non-interactive-workflows) for details.
Use the following environment variables to configure the `cloud` block:
@ -98,11 +98,11 @@ Use the following environment variables to configure the `cloud` block:
- `TF_CLOUD_HOSTNAME` - The hostname of a Terraform Enterprise installation. Terraform reads this when `hostname` is omitted from the `cloud` block. If both are specified, the configuration takes precendence.
- `TF_WORKSPACE` - The name of a single Terraform Cloud workspace. Terraform reads this when `workspaces` is omitted from the `cloud` block. Terraform Cloud will not create a new workspace from this variable; the workspace must exist in the specified organization. You can set `TF_WORKSPACE` if the `cloud` block uses tags. However, the value of `TF_WORKSPACE` must be included in the set of tags. This variable also selects the workspace in your local environment. Refer to [TF_WORKSPACE](/cli/config/environment-variables#tf_workspace) for details.
- `TF_WORKSPACE` - The name of a single Terraform Cloud workspace. Terraform reads this when `workspaces` is omitted from the `cloud` block. Terraform Cloud will not create a new workspace from this variable; the workspace must exist in the specified organization. You can set `TF_WORKSPACE` if the `cloud` block uses tags. However, the value of `TF_WORKSPACE` must be included in the set of tags. This variable also selects the workspace in your local environment. Refer to [TF_WORKSPACE](/terraform/cli/config/environment-variables#tf_workspace) for details.
## Excluding Files from Upload with .terraformignore
When executing a remote `plan` or `apply` in a [CLI-driven run](/cloud-docs/run/cli),
When executing a remote `plan` or `apply` in a [CLI-driven run](/terraform/cloud-docs/run/cli),
a copy of your configuration directory is uploaded to Terraform Cloud. You can define
paths to exclude from upload by adding a `.terraformignore` file at the root of your
configuration directory. If this file is not present, the upload will exclude

View File

@ -7,7 +7,7 @@ description: >-
# Writing and Modifying Terraform Code
The [Terraform language](/language) is Terraform's primary
The [Terraform language](/terraform/language) is Terraform's primary
user interface, and all of Terraform's workflows rely on configurations written
in the Terraform language.
@ -15,17 +15,17 @@ 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](/terraform/cli/commands/console) starts an
interactive shell for evaluating Terraform
[expressions](/language/expressions), which can be a faster way
[expressions](/terraform/language/expressions), 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](/terraform/cli/commands/fmt) 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](/terraform/cli/commands/validate) 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
@ -33,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](/terraform/cli/commands/0.13upgrade) and
[the `0.12upgrade` command](/terraform/cli/commands/0.12upgrade) 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](/language/upgrade-guides) in the Terraform language docs.
guides](/terraform/language/upgrade-guides) in the Terraform language docs.

View File

@ -11,7 +11,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](/language/v1.1.x/upgrade-guides/0-12).
-> **This command is available only in Terraform v0.12 releases.** For more information, see [the Terraform v0.12 upgrade guide](/terraform/language/v1.1.x/upgrade-guides/0-12).
## Usage
@ -70,13 +70,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](/terraform/language/modules/syntax#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](/terraform/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](/terraform/language/modules/sources#selecting-a-revision)
to control which version is used by which caller.
The command-line options are all optional. The available options are:

View File

@ -11,7 +11,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](/language/v1.1.x/upgrade-guides/0-13).
-> **This command is available only in Terraform v0.13 releases.** For more information, see [the Terraform v0.13 upgrade guide](/terraform/language/v1.1.x/upgrade-guides/0-13).
## Usage
@ -22,7 +22,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]: /terraform/language/providers/requirements
~> Note: the command ignores `.tf.json` files and override files in the module.

View File

@ -10,7 +10,7 @@ description: >-
The `terraform apply` command executes the actions proposed in a Terraform
plan.
> **Hands On:** Try the [Apply Terraform Configuration](https://learn.hashicorp.com/tutorials/terraform/apply?utm_source=WEBSITE&utm_medium=WEB_IO&utm_offer=ARTICLE_PAGE&utm_content=DOCS) tutorial to learn how Terraform applies a configuration, how Terraform recovers from errors during apply, and common ways to use this command.
> **Hands On:** Try the [Apply Terraform Configuration](/terraform/tutorials/cli/apply?utm_source=WEBSITE&utm_medium=WEB_IO&utm_offer=ARTICLE_PAGE&utm_content=DOCS) tutorial to learn how Terraform applies a configuration, how Terraform recovers from errors during apply, and common ways to use this command.
## Usage
@ -20,8 +20,8 @@ Usage: `terraform apply [options] [plan file]`
### Automatic Plan Mode
When you run `terraform apply` without passing a saved plan file, Terraform automatically creates a new execution plan as if you had run [`terraform plan`](/cli/commands/plan), prompts you to approve that plan, and takes the indicated actions. You can use all of the [planning modes](/cli/commands/plan#planning-modes) and
[planning options](/cli/commands/plan#planning-options) to customize how Terraform will create the plan.
When you run `terraform apply` without passing a saved plan file, Terraform automatically creates a new execution plan as if you had run [`terraform plan`](/terraform/cli/commands/plan), prompts you to approve that plan, and takes the indicated actions. You can use all of the [planning modes](/terraform/cli/commands/plan#planning-modes) and
[planning options](/terraform/cli/commands/plan#planning-options) to customize how Terraform will create the plan.
You can pass the `-auto-approve` option to instruct Terraform to apply the plan without asking for confirmation.
@ -29,9 +29,9 @@ You can pass the `-auto-approve` option to instruct Terraform to apply the plan
### Saved Plan Mode
When you pass a [saved plan file](/cli/commands/plan#out-filename) to `terraform apply`, Terraform takes the actions in the saved plan without prompting you for confirmation. You may want to use this two-step workflow 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).
When you pass a [saved plan file](/terraform/cli/commands/plan#out-filename) to `terraform apply`, Terraform takes the actions in the saved plan without prompting you for confirmation. You may want to use this two-step workflow when [running Terraform in automation](/terraform/tutorials/automation/automate-terraform?utm_source=WEBSITE&utm_medium=WEB_IO&utm_offer=ARTICLE_PAGE&utm_content=DOCS).
Use [`terraform show`](/cli/commands/show) to inspect a saved plan file before applying it.
Use [`terraform show`](/terraform/cli/commands/show) to inspect a saved plan file before applying it.
When using a saved plan, you cannot specify any additional planning modes or options. These options only affect Terraform's decisions about which
actions to take, and the plan file contains the final results of those
@ -41,8 +41,8 @@ decisions.
Without a saved plan file, `terraform apply` supports all planning modes and planning options available for `terraform plan`.
- **[Planning Modes](/cli/commands/plan#planning-modes):** These include `-destroy`, which creates a plan to destroy all remote objects, and `-refresh-only`, which creates a plan to update Terraform state and root module output values.
- **[Planning Options](/cli/commands/plan#planning-options):** These include specifying which resource instances Terraform should replace, setting Terraform input variables, etc.
- **[Planning Modes](/terraform/cli/commands/plan#planning-modes):** These include `-destroy`, which creates a plan to destroy all remote objects, and `-refresh-only`, which creates a plan to update Terraform state and root module output values.
- **[Planning Options](/terraform/cli/commands/plan#planning-options):** These include specifying which resource instances Terraform should replace, setting Terraform input variables, etc.
### Apply Options
@ -63,7 +63,7 @@ The following options change how the apply command executes and reports on the a
plan, so Terraform will conservatively assume that you do not wish to
apply the plan, causing the operation to fail. If you wish to run Terraform
in a non-interactive context, see
[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) for some
[Running Terraform in Automation](/terraform/tutorials/automation/automate-terraform?utm_source=WEBSITE&utm_medium=WEB_IO&utm_offer=ARTICLE_PAGE&utm_content=DOCS) for some
different approaches.
- `-json` - Enables the [machine readable JSON UI][machine-readable-ui] output.
@ -71,7 +71,7 @@ The following options change how the apply command executes and reports on the a
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]: /terraform/internals/machine-readable-ui
- `-lock=false` - Don't hold a state lock during the operation. This is
dangerous if others might concurrently run commands against the same
@ -87,17 +87,17 @@ The following options change how the apply command executes and reports on the a
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
[walks the graph](/terraform/internals/graph#walking-the-graph). Defaults to
10\.
- All [planning modes](/cli/commands/plan#planning-modes) and
[planning options](/cli/commands/plan#planning-options) for
- All [planning modes](/terraform/cli/commands/plan#planning-modes) and
[planning options](/terraform/cli/commands/plan#planning-options) for
`terraform plan` - Customize how Terraform will create the plan. Only available when you run `terraform apply` without a saved plan file.
For configurations using
[the `local` backend](/language/settings/backends/local) only,
[the `local` backend](/terraform/language/settings/backends/local) 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`](/terraform/language/settings/backends/local#command-line-arguments).
## Passing a Different Configuration Directory
@ -107,7 +107,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](/terraform/cli/commands#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.
@ -115,6 +115,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](/terraform/cli/config/environment-variables#tf_data_dir)
to direct Terraform to write the `.terraform` directory to a location other
than the current working directory.

View File

@ -8,26 +8,26 @@ description: >-
# Command: console
The `terraform console` command provides an interactive console for
evaluating [expressions](/language/expressions).
evaluating [expressions](/terraform/language/expressions).
## Usage
Usage: `terraform console [options]`
This command provides an interactive command-line console for evaluating and
experimenting with [expressions](/language/expressions).
experimenting with [expressions](/terraform/language/expressions).
You can use it to test interpolations before using them in configurations
and to interact with any values currently saved in
[state](/language/state). If the current state is empty or has not yet been created, you can use the console to experiment with the expression syntax and
[built-in functions](/language/functions). The console holds a [lock on the state](/language/state/locking), and you will not be able to use the console while performing other actions that modify state.
[state](/terraform/language/state). If the current state is empty or has not yet been created, you can use the console to experiment with the expression syntax and
[built-in functions](/terraform/language/functions). The console holds a [lock on the state](/terraform/language/state/locking), and you will not be able to use the console while performing other actions that modify state.
To close the console, enter the `exit` command or press Control-C
or Control-D.
For configurations using
[the `local` backend](/language/settings/backends/local) only,
[the `local` backend](/terraform/language/settings/backends/local) only,
`terraform console` accepts the legacy command line option
[`-state`](/language/settings/backends/local#command-line-arguments).
[`-state`](/terraform/language/settings/backends/local#command-line-arguments).
## Scripting
@ -48,7 +48,7 @@ tolist([
## Remote State
If [remote state](/language/state/remote) is used by the current backend,
If [remote state](/terraform/language/state/remote) is used by the current backend,
Terraform will read the state for the current workspace from the backend
before evaluating any expressions.

View File

@ -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`](/terraform/cli/commands/apply) 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`](/terraform/cli/commands/plan) in _destroy_ mode, showing
you the proposed destroy changes without executing them.
-> **Note:** The `-destroy` option to `terraform apply` exists only in

View File

@ -8,5 +8,5 @@ description: >-
# Command: env
The `terraform env` command is deprecated.
[The `terraform workspace` command](/cli/commands/workspace)
[The `terraform workspace` command](/terraform/cli/commands/workspace)
should be used instead.

View File

@ -9,7 +9,7 @@ description: >-
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](/terraform/language/syntax/style),
along with other minor adjustments for readability.
Other Terraform commands that generate Terraform configuration will produce

View File

@ -6,7 +6,7 @@ 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](/terraform/language/modules/develop) mentioned in the root module.
## Usage

View File

@ -5,9 +5,9 @@ description: The terraform import command brings existing resources into Terrafo
# Command: import
> **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.
> **Hands-on:** Try the [Import Terraform Configuration](/terraform/tutorials/state/state-import?utm_source=WEBSITE&utm_medium=WEB_IO&utm_offer=ARTICLE_PAGE&utm_content=DOCS) tutorial.
The `terraform import` command [imports existing resources](/cli/import)
The `terraform import` command [imports existing resources](/terraform/cli/import)
into Terraform.
## Usage
@ -17,7 +17,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](/terraform/cli/state/resource-addressing).
Because any resource address is valid, the import command can import resources
into modules as well as directly into the root of your state.
@ -33,7 +33,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](/terraform/language/state).
The command-line flags are all optional. The following flags are available:
@ -53,7 +53,7 @@ The command-line flags are all optional. The following flags are available:
- `-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](/terraform/internals/graph#walking-the-graph). Defaults
to 10.
- `-provider=provider` - **Deprecated** Override the provider configuration to
@ -62,11 +62,11 @@ The command-line flags are all optional. The following flags are available:
- `-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](/terraform/language/expressions/types) in the
Terraform language, so list and map values can be specified via this 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](/terraform/language/values/variables#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
@ -74,15 +74,15 @@ The command-line flags are all optional. The following flags are available:
the working directory. This flag can be used multiple times. This is only
useful with the `-config` flag.
For configurations using the [Terraform Cloud CLI integration](/cli/cloud) or the [`remote` backend](/language/settings/backends/remote)
For configurations using the [Terraform Cloud CLI integration](/terraform/cli/cloud) or the [`remote` backend](/terraform/language/settings/backends/remote)
only, `terraform import`
also accepts the option
[`-ignore-remote-version`](/cli/cloud/command-line-arguments#ignore-remote-version).
[`-ignore-remote-version`](/terraform/cli/cloud/command-line-arguments#ignore-remote-version).
For configurations using
[the `local` backend](/language/settings/backends/local) only,
[the `local` backend](/terraform/language/settings/backends/local) 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`](/terraform/language/settings/backends/local#command-line-arguments).
## Provider Configuration
@ -130,7 +130,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`](/terraform/language/meta-arguments/count):
```shell
$ terraform import 'aws_instance.baz[0]' i-abcd1234
@ -139,7 +139,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`](/terraform/language/meta-arguments/for_each):
Linux, Mac OS, and UNIX:

View File

@ -5,7 +5,7 @@ description: An introduction to the terraform command and its available subcomma
# Basic CLI Features
> **Hands-on:** Try the [Terraform: Get Started](https://learn.hashicorp.com/collections/terraform/aws-get-started?utm_source=WEBSITE&utm_medium=WEB_IO&utm_offer=ARTICLE_PAGE&utm_content=DOCS) tutorials.
> **Hands-on:** Try the [Terraform: Get Started](/terraform/tutorials/aws-get-started?utm_source=WEBSITE&utm_medium=WEB_IO&utm_offer=ARTICLE_PAGE&utm_content=DOCS) tutorials.
The command line interface to Terraform is the `terraform` command, which
accepts a variety of subcommands such as `terraform init` or `terraform plan`.
@ -13,8 +13,8 @@ accepts a variety of subcommands such as `terraform init` or `terraform plan`.
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](/terraform/cloud-docs) or
the various [Terraform providers](/terraform/language/providers), which
are developed and released separately from Terraform CLI.
To view a list of the commands available in your current Terraform version,
@ -96,7 +96,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](/terraform/cli/config/config-file) are not for a specific
subcommand and Terraform processes them before acting on the `-chdir`
option.
@ -145,7 +145,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](/terraform/cli/config/config-file) can be used to
disable checkpoint features. The following checkpoint-related settings are
supported in this file:

View File

@ -7,7 +7,7 @@ description: >-
# Command: init
> **Hands-on:** Try the [Terraform: Get Started](https://learn.hashicorp.com/collections/terraform/aws-get-started?utm_source=WEBSITE&utm_medium=WEB_IO&utm_offer=ARTICLE_PAGE&utm_content=DOCS) tutorials. For more in-depth details on the `init` command, check out the [Initialize Terraform Configuration tutorial](https://learn.hashicorp.com/tutorials/terraform/init?utm_source=WEBSITE&utm_medium=WEB_IO&utm_offer=ARTICLE_PAGE&utm_content=DOCS).
> **Hands-on:** Try the [Terraform: Get Started](/terraform/tutorials/aws-get-started?utm_source=WEBSITE&utm_medium=WEB_IO&utm_offer=ARTICLE_PAGE&utm_content=DOCS) tutorials. For more in-depth details on the `init` command, check out the [Initialize Terraform Configuration tutorial](/terraform/tutorials/cli/init?utm_source=WEBSITE&utm_medium=WEB_IO&utm_offer=ARTICLE_PAGE&utm_content=DOCS).
The `terraform init` command initializes a working directory
containing Terraform configuration files. This is the first command that should
@ -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](/terraform/language/settings/backends/configuration) 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](/terraform/language/settings/backends/configuration#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](/terraform/language/modules/develop) 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](/terraform/cli/config/config-file#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](/terraform/language/providers/requirements).
After successful installation, Terraform writes information about the selected
providers to [the dependency lock file](/language/files/dependency-lock).
providers to [the dependency lock file](/terraform/language/files/dependency-lock).
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
@ -150,15 +150,15 @@ You can modify `terraform init`'s plugin behavior with the following options:
* `-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.
[`provider_installation`](/terraform/cli/config/config-file#provider-installation) and
[`plugin_cache_dir`](/terraform/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
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](/terraform/cli/config/config-file#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.
@ -181,7 +181,7 @@ other interesting features such as integration with version control hooks.
There are some special concerns when running `init` in such an environment,
including optionally making plugins available locally to avoid repeated
re-installation. For more information, see
the [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) tutorial.
the [Running Terraform in Automation](/terraform/tutorials/automation/automate-terraform?utm_source=WEBSITE&utm_medium=WEB_IO&utm_offer=ARTICLE_PAGE&utm_content=DOCS) tutorial.
## Passing a Different Configuration Directory
@ -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](/terraform/cli/commands#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](/terraform/cli/config/environment-variables#tf_data_dir)
to direct Terraform to write the `.terraform` directory to a location other
than the current working directory.

View File

@ -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](/terraform/cli/config/config-file#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](/terraform/cli/config/config-file#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](/terraform/internals/login-protocol), including Terraform Cloud
and Terraform Enterprise.

View File

@ -25,5 +25,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](/terraform/cli/config/config-file#credentials-helpers), Terraform
will use the helper's `forget` command to remove it.

View File

@ -30,11 +30,11 @@ The command-line flags are all optional. The following flags are available:
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](/terraform/language/state/remote) 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](/terraform/language/state/sensitive-data).
## Examples

View File

@ -18,7 +18,7 @@ when Terraform creates a plan it:
* Proposes a set of change actions that should, if applied, make the remote
objects match the configuration.
> **Hands-on:** Try the [Terraform: Get Started](https://learn.hashicorp.com/collections/terraform/aws-get-started?utm_source=WEBSITE&utm_medium=WEB_IO&utm_offer=ARTICLE_PAGE&utm_content=DOCS) tutorials. For more in-depth details on the `plan` command, check out the [Create a Terraform Plan tutorial](https://learn.hashicorp.com/tutorials/terraform/plan?utm_source=WEBSITE&utm_medium=WEB_IO&utm_offer=ARTICLE_PAGE&utm_content=DOCS).
> **Hands-on:** Try the [Terraform: Get Started](/terraform/tutorials/aws-get-started?utm_source=WEBSITE&utm_medium=WEB_IO&utm_offer=ARTICLE_PAGE&utm_content=DOCS) tutorials. For more in-depth details on the `plan` command, check out the [Create a Terraform Plan tutorial](/terraform/tutorials/cli/plan?utm_source=WEBSITE&utm_medium=WEB_IO&utm_offer=ARTICLE_PAGE&utm_content=DOCS).
The `plan` command alone does not actually carry out the proposed changes You can use this command to check whether the proposed changes match what
you expected before you apply the changes or share your changes with your
@ -30,14 +30,14 @@ 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`](/terraform/cli/commands/apply) 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`](/terraform/cli/commands/apply) 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).
[running Terraform in automation](/terraform/tutorials/automation/automate-terraform?utm_source=WEBSITE&utm_medium=WEB_IO&utm_offer=ARTICLE_PAGE&utm_content=DOCS).
If you run `terraform plan` without the `-out=FILE` option then it will create
a _speculative plan_, which is a description of the effect of the plan but
@ -83,10 +83,10 @@ The remaining sections on this page describe the various options:
The previous section describes Terraform's default planning behavior, which
changes the remote system to match the changes you make to
your configuration. Terraform has two alternative planning modes, each of which creates a plan with a different intended outcome. These options are available for both `terraform plan` and [`terraform apply`](/cli/commands/apply).
your configuration. Terraform has two alternative planning modes, each of which creates a plan with a different intended outcome. These options are available for both `terraform plan` and [`terraform apply`](/terraform/cli/commands/apply).
* **Destroy mode:** creates a plan whose goal is to destroy all remote objects
that currently exist, leaving an empty Terraform state. It is the same as running [`terraform destroy`](/cli/commands/destroy). Destroy mode can be useful for situations like transient development environments, where the managed objects cease to be useful once the development task is complete.
that currently exist, leaving an empty Terraform state. It is the same as running [`terraform destroy`](/terraform/cli/commands/destroy). Destroy mode can be useful 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.
@ -112,22 +112,22 @@ 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`](/terraform/cli/commands/destroy).
-> **Note:** The `-refresh-only` option is available only in Terraform v0.15.4
and later.
> **Hands-on:** Try the [Use Refresh-Only Mode to Sync Terraform State](https://learn.hashicorp.com/tutorials/terraform/refresh) tutorial.
> **Hands-on:** Try the [Use Refresh-Only Mode to Sync Terraform State](/terraform/tutorials/state/refresh) tutorial.
## Planning Options
In addition to alternate [planning modes](#planning-modes), there are several options that can modify planning behavior. These options are available for both `terraform plan` and [`terraform apply`](/cli/commands/apply).
In addition to alternate [planning modes](#planning-modes), there are several options that can modify planning behavior. These options are available for both `terraform plan` and [`terraform apply`](/terraform/cli/commands/apply).
- `-refresh=false` - Disables the default behavior of synchronizing the
Terraform state with remote objects before checking for configuration changes. This can make the planning operation faster by reducing the number of remote API requests. However, setting `refresh=false` causes Terraform to ignore external changes, which could result in an incomplete or incorrect plan. You cannot use `refresh=false` in refresh-only planning mode because it would effectively disable the entirety of the planning operation.
- `-replace=ADDRESS` - Instructs Terraform to plan to replace the
resource instance with the given address. This is helpful when one or more remote objects have become degraded, and you can use replacement objects with the same configuratation to align with immutable infrastructure patterns. Terraform will use a "replace" action if the specified resource would normally cause an "update" action or no action at all. Include this option multiple times to replace several objects at once. You cannot use `-replace` with the `-destroy` option, and it is only available from Terraform v0.15.2 onwards. For earlier versions, use [`terraform taint`](/cli/commands/taint) to achieve a similar result.
resource instance with the given address. This is helpful when one or more remote objects have become degraded, and you can use replacement objects with the same configuratation to align with immutable infrastructure patterns. Terraform will use a "replace" action if the specified resource would normally cause an "update" action or no action at all. Include this option multiple times to replace several objects at once. You cannot use `-replace` with the `-destroy` option, and it is only available from Terraform v0.15.2 onwards. For earlier versions, use [`terraform taint`](/terraform/cli/commands/taint) to achieve a similar result.
- `-target=ADDRESS` - Instructs Terraform to focus its planning efforts only
on resource instances which match the given address and on any objects that
@ -136,25 +136,25 @@ In addition to alternate [planning modes](#planning-modes), there are several op
-> **Note:** Use `-target=ADDRESS` in exceptional circumstances only, such as recovering from mistakes or working around Terraform limitations. Refer to [Resource Targeting](#resource-targeting) for more details.
- `-var 'NAME=VALUE'` - Sets a value for a single
[input variable](/language/values/variables) declared in the
[input variable](/terraform/language/values/variables) declared in the
root module of the configuration. Use this option multiple times to set
more than one variable. Refer to
[Input Variables on the Command Line](#input-variables-on-the-command-line) for more information.
- `-var-file=FILENAME` - Sets values for potentially many
[input variables](/language/values/variables) declared in the
[input variables](/terraform/language/values/variables) declared in the
root module of the configuration, using definitions from a
["tfvars" file](/language/values/variables#variable-definitions-tfvars-files).
["tfvars" file](/terraform/language/values/variables#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. Refer to
[Assigning Values to Root Module Variables](/language/values/variables#assigning-values-to-root-module-variables) for more information.
[Assigning Values to Root Module Variables](/terraform/language/values/variables#assigning-values-to-root-module-variables) for more information.
### Input Variables on the Command Line
You can use the `-var` command line option to specify values for
[input variables](/language/values/variables) declared in your
[input variables](/terraform/language/values/variables) declared in your
root module.
However, to do so will require writing a command line that is parsable both
@ -203,7 +203,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](/terraform/language/expressions/type-constraints).
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,
@ -223,15 +223,15 @@ 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](/terraform/language/values/variables#assigning-values-to-root-module-variables).
### Resource Targeting
> **Hands-on:** Try the [Target resources](https://learn.hashicorp.com/tutorials/terraform/resource-targeting?in=terraform/state&utm_source=WEBSITE&utm_medium=WEB_IO&utm_offer=ARTICLE_PAGE&utm_content=DOCS) tutorial.
> **Hands-on:** Try the [Target resources](/terraform/tutorials/state/resource-targeting?utm_source=WEBSITE&utm_medium=WEB_IO&utm_offer=ARTICLE_PAGE&utm_content=DOCS) tutorial.
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](/terraform/cli/state/resource-addressing)
to specify the constraint. Terraform interprets the resource address as follows:
* If the given address identifies one specific resource instance, Terraform
@ -263,7 +263,7 @@ 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](/terraform/language/data-sources) 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.
@ -299,7 +299,7 @@ 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]: /terraform/internals/machine-readable-ui
* `-lock=false` - Don't hold a state lock during the operation. This is
dangerous if others might concurrently run commands against the same
@ -334,13 +334,13 @@ The available options are:
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](/terraform/internals/graph#walking-the-graph). Defaults
to 10.
For configurations using
[the `local` backend](/language/settings/backends/local) only,
[the `local` backend](/terraform/language/settings/backends/local) only,
`terraform plan` accepts the legacy command line option
[`-state`](/language/settings/backends/local#command-line-arguments).
[`-state`](/terraform/language/settings/backends/local#command-line-arguments).
### Passing a Different Configuration Directory
@ -350,7 +350,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](/terraform/cli/commands#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.
@ -358,6 +358,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](/terraform/cli/config/environment-variables#tf_data_dir)
to direct Terraform to write the `.terraform` directory to a location other
than the current working directory.

View File

@ -8,7 +8,7 @@ description: >-
# Command: providers
The `terraform providers` command shows information about the
[provider requirements](/language/providers/requirements) of the
[provider requirements](/terraform/language/providers/requirements) of the
configuration in the current working directory, as an aid to understanding
where each requirement was detected from.

View File

@ -9,15 +9,15 @@ description: |-
The `terraform providers lock` consults upstream registries (by default) in
order to write provider dependency information into
[the dependency lock file](/language/files/dependency-lock).
[the dependency lock file](/terraform/language/files/dependency-lock).
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`](/terraform/cli/commands/init), 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](/terraform/cli/config/config-file#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
@ -33,7 +33,7 @@ automatic approach may not be sufficient:
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/files/dependency-lock#new-provider-package-checksums).
[add additional checksums to the lock file](/terraform/language/files/dependency-lock#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,7 +47,7 @@ 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/files/dependency-lock) to
[the dependency lock file](/terraform/language/files/dependency-lock) to
include a selected version for each provider and all of the package checksums
that are covered by the provider developer's cryptographic signature.
@ -72,7 +72,7 @@ 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](/terraform/internals/provider-network-mirror-protocol).
* `-platform=OS_ARCH` - Specify a platform you intend to use to work with this
Terraform configuration. Terraform will ensure that the providers are all
@ -148,7 +148,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](/terraform/cli/config/config-file#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 +165,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](/terraform/internals/provider-registry-protocol).

View File

@ -17,7 +17,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](/terraform/cli/config/config-file#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 +39,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](/terraform/internals/provider-network-mirror-protocol),
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.

View File

@ -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](/terraform/language/v1-compatibility-promises).
## Format Summary

View File

@ -7,7 +7,7 @@ description: >-
# Command: push
!> **Important:** The `terraform push` command is no longer functional. We recommend the [Terraform Cloud CLI integration](/cli/cloud) instead, which allows you to run remote operations in Terraform Cloud directly from the command line.
!> **Important:** The `terraform push` command is no longer functional. We recommend the [Terraform Cloud CLI integration](/terraform/cli/cloud) instead, which allows you to run remote operations in Terraform Cloud directly from the command line.
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.

View File

@ -7,7 +7,7 @@ description: |-
# Command: refresh
> **Hands-on:** Try the [Use Refresh-Only Mode to Sync Terraform State](https://learn.hashicorp.com/tutorials/terraform/refresh) tutorial.
> **Hands-on:** Try the [Use Refresh-Only Mode to Sync Terraform State](/terraform/tutorials/state/refresh) tutorial.
The `terraform refresh` command reads the current settings from all managed
remote objects and updates the Terraform state to match.
@ -17,14 +17,14 @@ 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](/terraform/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`](/terraform/cli/commands/plan)
and
[`terraform apply`](/cli/commands/apply)
[`terraform apply`](/terraform/cli/commands/apply)
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 +40,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`](/terraform/cli/commands/apply) 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.

View File

@ -19,7 +19,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](/terraform/language/state/sensitive-data).
## JSON Output
@ -35,7 +35,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](/terraform/internals/json-format).
## Usage

View File

@ -7,7 +7,7 @@ description: The `terraform state` command is used for advanced state management
The `terraform state` command is used for advanced state management.
As your Terraform usage becomes more advanced, there are some cases where
you may need to modify the [Terraform state](/language/state).
you may need to modify the [Terraform state](/terraform/language/state).
Rather than modify the state directly, the `terraform state` commands can
be used in many cases instead.
@ -32,7 +32,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](/terraform/cli/commands/state/list))
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

View File

@ -8,7 +8,7 @@ description: >-
# Command: state list
The `terraform state list` command is used to list resources within a
[Terraform state](/language/state).
[Terraform state](/terraform/language/state).
## Usage
@ -24,12 +24,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](/terraform/cli/state/resource-addressing).
The command-line flags are all optional. The following flags are available:
* `-state=path` - Path to the state file. Defaults to "terraform.tfstate".
Ignored when [remote state](/language/state/remote) is used.
Ignored when [remote state](/terraform/language/state/remote) is used.
* `-id=id` - ID of resources to show. Ignored when unset.
## Example: All Resources

View File

@ -7,7 +7,7 @@ description: >-
# Command: state mv
The main function of [Terraform state](/language/state) is
The main function of [Terraform state](/terraform/language/state) 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 +28,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](/terraform/cli/state/resource-addressing), 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
@ -66,22 +66,22 @@ This command also accepts the following options:
returning an error. The duration syntax is a number followed by a time
unit letter, such as "3s" for three seconds.
For configurations using the [Terraform Cloud CLI integration](/cli/cloud) or the [`remote` backend](/language/settings/backends/remote)
For configurations using the [Terraform Cloud CLI integration](/terraform/cli/cloud) or the [`remote` backend](/terraform/language/settings/backends/remote)
only, `terraform state mv`
also accepts the option
[`-ignore-remote-version`](/cli/cloud/command-line-arguments#ignore-remote-version).
[`-ignore-remote-version`](/terraform/cli/cloud/command-line-arguments#ignore-remote-version).
The legacy options [`-backup` and `-backup-out`](/language/settings/backends/local#command-line-arguments)
The legacy options [`-backup` and `-backup-out`](/terraform/language/settings/backends/local#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](/terraform/language/settings/backends/remote)
must specify a local state file with the [`-state`](/terraform/language/settings/backends/local#command-line-arguments)
option in order to use the [`-backup` and `-backup-out`](/terraform/language/settings/backends/local#command-line-arguments)
options.
For configurations using
[the `local` state mv](/language/settings/backends/local) only,
[the `local` state mv](/terraform/language/settings/backends/local) 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`](/terraform/language/settings/backends/local#command-line-arguments).
## Example: Rename a Resource
@ -133,7 +133,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](/terraform/language/meta-arguments/count)
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:
@ -158,7 +158,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](/terraform/language/meta-arguments/for_each)
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.

View File

@ -8,7 +8,7 @@ description: >-
# 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](/terraform/language/state/remote). This command also
works with local state.
## Usage

View File

@ -6,7 +6,7 @@ description: The `terraform state push` command pushes items to the Terraform st
# 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
state file to [remote state](/terraform/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
@ -17,7 +17,7 @@ manual intervention is necessary with the remote state.
Usage: `terraform state push [options] PATH`
This command pushes the state specified by PATH to the currently
configured [backend](/language/settings/backends/configuration).
configured [backend](/terraform/language/settings/backends/configuration).
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
@ -42,7 +42,7 @@ 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 [Terraform Cloud CLI integration](/cli/cloud) or the [`remote` backend](/language/settings/backends/remote)
For configurations using the [Terraform Cloud CLI integration](/terraform/cli/cloud) or the [`remote` backend](/terraform/language/settings/backends/remote)
only, `terraform state push`
also accepts the option
[`-ignore-remote-version`](/cli/cloud/command-line-arguments#ignore-remote-version).
[`-ignore-remote-version`](/terraform/cli/cloud/command-line-arguments#ignore-remote-version).

View File

@ -8,7 +8,7 @@ description: >-
# 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](/terraform/language/state).
## Usage
@ -32,15 +32,15 @@ This command also accepts the following options:
- `-lock-timeout=0s` - Duration to retry a state lock.
For configurations using the [Terraform Cloud CLI integration](/cli/cloud) or the [`remote` backend](/language/settings/backends/remote)
For configurations using the [Terraform Cloud CLI integration](/terraform/cli/cloud) or the [`remote` backend](/terraform/language/settings/backends/remote)
only, `terraform state replace-provider`
also accepts the option
[`-ignore-remote-version`](/cli/cloud/command-line-arguments#ignore-remote-version).
[`-ignore-remote-version`](/terraform/cli/cloud/command-line-arguments#ignore-remote-version).
For configurations using
[the `local` state](/language/settings/backends/local) only,
[the `local` state](/terraform/language/settings/backends/local) 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`](/terraform/language/settings/backends/local#command-line-arguments).
## Example

View File

@ -7,7 +7,7 @@ description: >-
# Command: state rm
The main function of [Terraform state](/language/state) is
The main function of [Terraform state](/terraform/language/state) 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 +23,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](/terraform/cli/state/resource-addressing), 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`](/terraform/cli/commands/plan)
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
@ -49,15 +49,15 @@ This command also accepts the following options:
returning an error. The duration syntax is a number followed by a time
unit letter, such as "3s" for three seconds.
For configurations using the [Terraform Cloud CLI integration](/cli/cloud) or the [`remote` backend](/language/settings/backends/remote)
For configurations using the [Terraform Cloud CLI integration](/terraform/cli/cloud) or the [`remote` backend](/terraform/language/settings/backends/remote)
only, `terraform state rm`
also accepts the option
[`-ignore-remote-version`](/cli/cloud/command-line-arguments#ignore-remote-version).
[`-ignore-remote-version`](/terraform/cli/cloud/command-line-arguments#ignore-remote-version).
For configurations using
[the `local` state rm](/language/settings/backends/local) only,
[the `local` state rm](/terraform/language/settings/backends/local) 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`](/terraform/language/settings/backends/local#command-line-arguments).
## Example: Remove all Instances of a Resource
@ -92,7 +92,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](/terraform/language/meta-arguments/count)
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:
@ -107,7 +107,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](/terraform/language/meta-arguments/for_each)
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.

View File

@ -9,7 +9,7 @@ description: >-
The `terraform state show` command is used to show the attributes of a
single resource in the
[Terraform state](/language/state).
[Terraform state](/terraform/language/state).
## Usage
@ -20,16 +20,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](/terraform/cli/state/resource-addressing).
The command-line flags are all optional. The following flags are available:
* `-state=path` - Path to the state file. Defaults to "terraform.tfstate".
Ignored when [remote state](/language/state/remote) is used.
Ignored when [remote state](/terraform/language/state/remote) 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`](/terraform/cli/commands/show#json-output) and decode the result
using the documented structure.
## Example: Show a Resource
@ -60,7 +60,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`](/terraform/language/meta-arguments/count):
```shell
$ terraform state show 'packet_device.worker[0]'
@ -68,7 +68,7 @@ $ terraform state show 'packet_device.worker[0]'
## Example: Show a Resource configured with for_each
The following example shows the `"example"` instance of a `packet_device` resource named `worker` configured with the [`for_each`](/language/meta-arguments/for_each) meta-argument. You must place the resource name in single quotes when it contains special characters like double quotes.
The following example shows the `"example"` instance of a `packet_device` resource named `worker` configured with the [`for_each`](/terraform/language/meta-arguments/for_each) meta-argument. You must place the resource name in single quotes when it contains special characters like double quotes.
Linux, Mac OS, and UNIX:

View File

@ -16,7 +16,7 @@ propose to replace it in the next plan you create.
## Recommended Alternative
For Terraform v0.15.2 and later, we recommend using the [`-replace` option](/cli/commands/plan#replace-address) with `terraform apply` to force Terraform to replace an object even though there are no configuration changes that would require it.
For Terraform v0.15.2 and later, we recommend using the [`-replace` option](/terraform/cli/commands/plan#replace-address) with `terraform apply` to force Terraform to replace an object even though there are no configuration changes that would require it.
```
$ terraform apply -replace="aws_instance.example[0]"
@ -32,7 +32,7 @@ $ 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),
[the resource address syntax](/terraform/cli/state/resource-addressing),
as shown in the output from other commands, such as:
- `aws_instance.foo`
@ -55,11 +55,11 @@ This command accepts the following options:
returning an error. The duration syntax is a number followed by a time
unit letter, such as "3s" for three seconds.
For configurations using the [Terraform Cloud CLI integration](/cli/cloud) or the [`remote` backend](/language/settings/backends/remote) only, `terraform taint`
For configurations using the [Terraform Cloud CLI integration](/terraform/cli/cloud) or the [`remote` backend](/terraform/language/settings/backends/remote) only, `terraform taint`
also accepts the option
[`-ignore-remote-version`](/cli/cloud/command-line-arguments#ignore-remote-version).
[`-ignore-remote-version`](/terraform/cli/cloud/command-line-arguments#ignore-remote-version).
For configurations using
[the `local` backend](/language/settings/backends/local) only,
[the `local` backend](/terraform/language/settings/backends/local) 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`](/terraform/language/settings/backends/local#command-line-arguments).

View File

@ -6,7 +6,7 @@ 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](/terraform/language/modules/testing-experiment).
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

View File

@ -16,7 +16,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`](/terraform/cli/commands/taint), although we no longer recommend that
workflow.
If Terraform currently considers a particular object as tainted but you've
@ -38,7 +38,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](/terraform/cli/state/resource-addressing)
identifying a particular resource instance which is currently tainted.
This command also accepts the following options:
@ -61,12 +61,12 @@ This command also accepts the following options:
if you are running Terraform in a context where its output will be
rendered by a system that cannot interpret terminal formatting.
For configurations using the [Terraform Cloud CLI integration](/cli/cloud) or the [`remote` backend](/language/settings/backends/remote)
For configurations using the [Terraform Cloud CLI integration](/terraform/cli/cloud) or the [`remote` backend](/terraform/language/settings/backends/remote)
only, `terraform untaint`
also accepts the option
[`-ignore-remote-version`](/cli/cloud/command-line-arguments#ignore-remote-version).
[`-ignore-remote-version`](/terraform/cli/cloud/command-line-arguments#ignore-remote-version).
For configurations using
[the `local` backend](/language/settings/backends/local) only,
[the `local` backend](/terraform/language/settings/backends/local) 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`](/terraform/language/settings/backends/local#command-line-arguments).

View File

@ -65,7 +65,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](/terraform/language/v1-compatibility-promises).
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:

View File

@ -16,7 +16,7 @@ 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](/terraform/cli/commands#upgrade-and-security-bulletin-checks).
This command has one optional flag:

View File

@ -17,7 +17,7 @@ To delete a workspace, it must already exist, it must not be tracking resources,
and it must not be your current workspace. If the workspace is tracking resources,
Terraform will not allow you to delete it unless the `-force` flag is specified.
Additionally, different [backends](/language/settings/backends/configuration#backend-types) may implement other
Additionally, different [backends](/terraform/language/settings/backends/configuration#backend-types) may implement other
restrictions on whether a workspace is considered safe to delete without the `-force` flag, such as whether the workspace is locked.
If you delete a workspace which is tracking resources (via `-force`), then resources

View File

@ -6,7 +6,7 @@ description: The workspace command helps you manage workspaces.
# Command: workspace
The `terraform workspace` command is used to manage
[workspaces](/language/state/workspaces).
[workspaces](/terraform/language/state/workspaces).
This command is a container for further subcommands that each have their own page in the documentation.

View File

@ -9,7 +9,7 @@ description: >-
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](/terraform/language).
## 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](/terraform/cli/config/environment-variables).
Any such file should follow the naming pattern `*.tfrc`.
## Configuration File Syntax
@ -59,7 +59,7 @@ The following settings can be set in the CLI configuration file:
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)
[upgrade and security bulletin checks](/terraform/cli/commands#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
@ -78,10 +78,10 @@ The following settings can be set in the CLI configuration file:
[Terraform Cloud](https://cloud.hashicorp.com/products/terraform) provides a number of remote network
services for use with Terraform, and
[Terraform Enterprise](/enterprise) allows hosting those
[Terraform Enterprise](/terraform/enterprise) 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](/terraform/cloud-docs/run/cli) and a
[private module registry](/terraform/cloud-docs/registry).
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](/terraform/cli/commands/login)
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](/terraform/cloud-docs/users-teams-organizations/users#api-tokens)
or a
[team token](/cloud-docs/users-teams-organizations/api-tokens#team-api-tokens);
[team token](/terraform/cloud-docs/users-teams-organizations/api-tokens#team-api-tokens);
organization tokens cannot be used for command-line Terraform actions.
-> **Note:** The credentials hostname must match the hostname in your module
@ -161,7 +161,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](/terraform/internals/credentials-helpers).
### Credentials Source Priority Order
@ -270,7 +270,7 @@ The following are the two supported installation method types:
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),
[the provider network mirror protocol](/terraform/internals/provider-network-mirror-protocol),
which is designed to be relatively easy to implement using typical static
website hosting mechanisms.
@ -395,7 +395,7 @@ understand the consequences of enabling it.
By default Terraform will use packages from the global cache directory only
if they match at least one of the checksums recorded in the
[dependency lock file](https://developer.hashicorp.com/terraform/language/files/dependency-lock)
[dependency lock file](/terraform/language/files/dependency-lock)
for that provider. This ensures that Terraform can always
generate a complete and correct dependency lock file entry the first time you
use a new provider in a particular configuration.
@ -476,7 +476,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/files/dependency-lock)
[the dependency lock file](/terraform/language/files/dependency-lock)
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

View File

@ -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](/terraform/internals/debugging).
## 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](/terraform/internals/debugging).
## TF_INPUT
@ -58,7 +58,7 @@ 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](/terraform/language/values/variables).
## TF_CLI_ARGS and TF_CLI_ARGS_name
@ -114,7 +114,7 @@ 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](/terraform/language/state/workspaces).
## TF_IN_AUTOMATION
@ -127,7 +127,7 @@ applications.
This is a purely cosmetic change to Terraform's human-readable output, and the
exact output differences can change between minor Terraform versions.
For more details, see [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).
For more details, see [Running Terraform in Automation](/terraform/tutorials/automation/automate-terraform?utm_source=WEBSITE&utm_medium=WEB_IO&utm_offer=ARTICLE_PAGE&utm_content=DOCS).
## TF_REGISTRY_DISCOVERY_RETRY
@ -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](/terraform/cli/config/config-file).
```shell
export TF_CLI_CONFIG_FILE="$HOME/.terraformrc-custom"
@ -159,10 +159,10 @@ 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](/terraform/language/settings/backends/remote#excluding-files-from-upload-with-terraformignore).
## Terraform Cloud CLI Integration
The CLI integration with Terraform Cloud lets you use Terraform Cloud and Terraform Enterprise on the command line. The integration requires including a `cloud` block in your Terraform configuration. You can define its arguments directly in your configuration file or supply them through environment variables, which can be useful for non-interactive workflows like Continuous Integration (CI).
Refer to [Terraform Cloud Settings](/cli/cloud/settings#environment-variables) for a full list of `cloud` block environment variables.
Refer to [Terraform Cloud Settings](/terraform/cli/cloud/settings#environment-variables) for a full list of `cloud` block environment variables.

View File

@ -16,9 +16,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](/terraform/cli/config/config-file) configures provider
installation and security features.
- Several [environment variables](/cli/config/environment-variables) can
- Several [environment variables](/terraform/cli/config/environment-variables) 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.

View File

@ -13,4 +13,4 @@ importable. As a result, you cannot import all Terraform resources.
The resources that you can import are documented at the bottom of
each resource documentation page in the [Terraform Registry](https://registry.terraform.io/). If you have issues importing a resource, report an issue in the relevant provider repository.
To make a resource importable, refer to [Extending Terraform: Resources — Import](/plugin/sdkv2/resources/import).
To make a resource importable, refer to [Extending Terraform: Resources — Import](/terraform/plugin/sdkv2/resources/import).

View File

@ -7,15 +7,15 @@ description: >-
# Import
> **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.
> **Hands-on:** Try the [Import Terraform Configuration](/terraform/tutorials/state/state-import?utm_source=WEBSITE&utm_medium=WEB_IO&utm_offer=ARTICLE_PAGE&utm_content=DOCS) tutorial.
Terraform can import existing infrastructure resources. This functionality lets you bring existing resources under Terraform management.
~> **Warning:** Terraform expects that each remote object is bound to only one resource address. You should import each remote object to only one Terraform resource address. If you import the same object multiple times, Terraform may exhibit unwanted behavior. Refer to [State](/language/state) for more details.
~> **Warning:** Terraform expects that each remote object is bound to only one resource address. You should import each remote object to only one Terraform resource address. If you import the same object multiple times, Terraform may exhibit unwanted behavior. Refer to [State](/terraform/language/state) for more details.
## State Only
Terraform import can only import resources into the [state](/language/state). Importing does not generate configuration.
Terraform import can only import resources into the [state](/terraform/language/state). Importing does not generate configuration.
Before you run `terraform import` you must manually write a `resource` configuration block for the resource. The resource block describes where Terraform should map the imported object.

View File

@ -5,7 +5,7 @@ description: The `terraform import` command is used to import existing infrastru
# Import Usage
> **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.
> **Hands-on:** Try the [Import Terraform Configuration](/terraform/tutorials/state/state-import?utm_source=WEBSITE&utm_medium=WEB_IO&utm_offer=ARTICLE_PAGE&utm_content=DOCS) tutorial.
Use the `terraform import` command to import existing infrastructure to Terraform state.
@ -18,7 +18,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](/terraform/language/state).
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:
@ -52,7 +52,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_](/terraform/cli/state/resource-addressing) for more
details on how to specify a target resource.
The syntax of the given ID is dependent on the resource type being imported.
@ -78,4 +78,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](/terraform/cli/commands/state) can be used.

View File

@ -7,7 +7,7 @@ description: >-
# Terraform CLI Documentation
> **Hands-on:** Try the [Terraform: Get Started](https://learn.hashicorp.com/collections/terraform/aws-get-started?utm_source=WEBSITE&utm_medium=WEB_IO&utm_offer=ARTICLE_PAGE&utm_content=DOCS) tutorials.
> **Hands-on:** Try the [Terraform: Get Started](/terraform/tutorials/aws-get-started?utm_source=WEBSITE&utm_medium=WEB_IO&utm_offer=ARTICLE_PAGE&utm_content=DOCS) tutorials.
This is the documentation for Terraform CLI. It is relevant to anyone working
with Terraform's CLI-based workflows; this includes people who use Terraform CLI
@ -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](/terraform/language).

View File

@ -10,7 +10,7 @@ description: >-
Terraform expects to be invoked from a working directory that contains
configuration files written in
[the Terraform language](/language). Terraform uses
[the Terraform language](/terraform/language). Terraform uses
configuration content from this directory, and also uses the directory to store
settings, cached plugins and modules, and sometimes state data.
@ -25,7 +25,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](/terraform/cli/workspaces) 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.
@ -50,7 +50,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](/terraform/cli/commands/init).
## Reinitialization

View File

@ -17,19 +17,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](/terraform/cli/commands/graph) 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](/terraform/cli/commands/output) can get the
values for the top-level [output values](/terraform/language/values/outputs) 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](/terraform/cli/commands/show) 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](/terraform/cli/commands/state/list) 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](/terraform/cli/commands/state/show) 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.

View File

@ -15,7 +15,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](/terraform/cli/install/yum).
-> **Note:** The APT repositories discussed on this page are generic HashiCorp
repositories that contain packages for a variety of different HashiCorp
@ -36,7 +36,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](/terraform/downloads) instead.
## Supported Debian and Ubuntu Releases

View File

@ -15,7 +15,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](/terraform/cli/install/apt).
-> **Note:** The Yum repositories discussed on this page are generic HashiCorp
repositories that contain packages for a variety of different HashiCorp
@ -63,7 +63,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](/terraform/downloads) instead.
## Supported Distribution Releases

View File

@ -9,15 +9,15 @@ description: >-
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](/terraform/language/providers) in the Terraform
language docs.)
-> **Note:** Providers are the only plugin type most Terraform users 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](/terraform/language/providers/requirements) by a configuration
when [initializing](/terraform/cli/init) a working directory. By default,
this works without any additional interaction but requires network access to
download providers from their source registry.
@ -31,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](/terraform/cli/config/config-file).
## Getting Plugin Information
Use the [`terraform providers`](/cli/commands/providers) command to get information
Use the [`terraform providers`](/terraform/cli/commands/providers) 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`](/terraform/cli/commands/version) 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`](/terraform/cli/commands/providers/schema) 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`](/terraform/cli/commands/providers/mirror) 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`](/terraform/cli/commands/providers/lock) command
to update the lock file that Terraform uses to ensure predictable runs when
using ambiguous provider version constraints.

View File

@ -7,7 +7,7 @@ description: 'Learn about commands for core provisioning tasks: plan, apply, and
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](/terraform/language).
When people refer to "running Terraform," they generally mean performing these
provisioning actions in order to affect real infrastructure objects. The
@ -16,8 +16,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](/terraform/cli/init) working directory, and all of them act
only upon the currently selected [workspace](/terraform/cli/workspaces).
## Planning
@ -38,7 +38,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](/terraform/cli/commands/plan).
## Applying
@ -54,7 +54,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](/terraform/cli/commands/apply).
## Destroying
@ -68,4 +68,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](/terraform/cli/commands/destroy).

View File

@ -7,9 +7,9 @@ description: >-
# 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.
> **Hands-on:** Try the [Manage Resources in Terraform State](/terraform/tutorials/state/state-cli?utm_source=WEBSITE&utm_medium=WEB_IO&utm_offer=ARTICLE_PAGE&utm_content=DOCS) tutorial.
Terraform uses [state data](/language/state) to remember which
Terraform uses [state data](/terraform/language/state) 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.
@ -21,12 +21,12 @@ infrastructure.
Terraform CLI supports several workflows for interacting with state:
- [Inspecting State](/cli/state/inspect)
- [Forcing Re-creation](/cli/state/taint)
- [Moving Resources](/cli/state/move)
- [Inspecting State](/terraform/cli/state/inspect)
- [Forcing Re-creation](/terraform/cli/state/taint)
- [Moving Resources](/terraform/cli/state/move)
- Importing Pre-existing Resources (documented in the
[Importing Infrastructure](/cli/import) section)
- [Disaster Recovery](/cli/state/recover)
[Importing Infrastructure](/terraform/cli/import) section)
- [Disaster Recovery](/terraform/cli/state/recover)
~> **Important:** Modifying state data outside a normal plan or apply can cause
Terraform to lose track of managed resources, which might waste money, annoy

View File

@ -8,14 +8,14 @@ description: Commands that allow you to read and update 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](/terraform/cli/commands/state/list)
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](/terraform/cli/commands/state/show)
displays detailed state data about one resource.
- [The `terraform refresh` command](/cli/commands/refresh) updates
- [The `terraform refresh` command](/terraform/cli/commands/refresh) 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.

View File

@ -8,7 +8,7 @@ description: >-
# 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](/terraform/cli/state/resource-addressing). 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,26 +22,26 @@ can explicitly tell Terraform to associate it with a different configured
resource.
For most cases we recommend using
[the Terraform language's refactoring features](/language/modules/develop/refactoring)
[the Terraform language's refactoring features](/terraform/language/modules/develop/refactoring)
to document in your module exactly how the resource names have changed over
time. Terraform reacts to this information automatically during planning, so users of your module do not need to take any unusual extra steps.
> **Hands On:** Try the [Use Configuration to Move Resources](https://learn.hashicorp.com/tutorials/terraform/move-config) tutorial.
> **Hands On:** Try the [Use Configuration to Move Resources](/terraform/tutorials/configuration-language/move-config) tutorial.
There are some other situations which require explicit state modifications,
though. For those, consider the following Terraform commands:
- [The `terraform state mv` command](/cli/commands/state/mv) changes
- [The `terraform state mv` command](/terraform/cli/commands/state/mv) 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](/terraform/cli/commands/state/rm) 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](/terraform/cli/commands/state/replace-provider)
transfers existing resources to a new provider without requiring them to be
re-created.

View File

@ -11,7 +11,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](/terraform/cli/commands/force-unlock) 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
@ -19,7 +19,7 @@ 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](/terraform/cli/commands/state/pull) and
[the `terraform state push` command](/terraform/cli/commands/state/push) 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.

View File

@ -18,7 +18,7 @@ to the problem, because Terraform only directly manages the machine as a whole.
If you know that an object is damaged, or if you want to force Terraform to
replace it for any other reason, you can override Terraform's default behavior
using [the `-replace=...` planning option](/cli/commands/plan#replace-address)
using [the `-replace=...` planning option](/terraform/cli/commands/plan#replace-address)
when you run either `terraform plan` or `terraform apply`:
```shellsession
@ -53,11 +53,11 @@ address using `-replace=...` as described above.
If Terraform has marked an object as tainted but you consider it to be working
correctly and do not want to replace it, you can override Terraform's
determination using [the `terraform untaint` command](/cli/commands/untaint),
determination using [the `terraform untaint` command](/terraform/cli/commands/untaint),
after which Terraform will consider the object to be ready for use by any
downstream resource declarations.
You can also _force_ Terraform to mark a particular object as tainted using
[the `terraform taint` command](/cli/commands/taint), but that approach is
[the `terraform taint` command](/terraform/cli/commands/taint), but that approach is
deprecated in favor of the `-replace=...` option, which avoids the need to
create an interim state snapshot with a tainted object.

View File

@ -7,7 +7,7 @@ description: >-
# Managing Workspaces
Workspaces in the Terraform CLI refer to separate instances of [state data](/language/state) inside the same Terraform working directory. They are distinctly different from [workspaces in Terraform Cloud](/cloud-docs/workspaces), which each have their own Terraform configuration and function as separate working directories.
Workspaces in the Terraform CLI refer to separate instances of [state data](/terraform/language/state) inside the same Terraform working directory. They are distinctly different from [workspaces in Terraform Cloud](/terraform/cloud-docs/workspaces), which each have their own Terraform configuration and function as separate working directories.
Terraform relies on state to associate resources with real-world objects. When you run the same configuration multiple times with separate state data, Terraform can manage multiple sets of non-overlapping resources.
@ -16,18 +16,18 @@ Workspaces can be helpful for specific [use cases](#use-cases), but they are not
## Managing CLI Workspaces
Every [initialized working directory](/cli/init) starts with one workspace named `default`.
Every [initialized working directory](/terraform/cli/init) starts with one workspace named `default`.
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 to manage the available workspaces in the current working directory.
Use the [`terraform workspace list`](/terraform/cli/commands/workspace/list), [`terraform workspace new`](/terraform/cli/commands/workspace/new), and [`terraform workspace delete`](/terraform/cli/commands/workspace/delete) commands to manage the available workspaces in the current working directory.
Use [the `terraform workspace select` command](/cli/commands/workspace/select) to change the currently selected workspace. For a given working directory, you can only select one workspace at a time. Most Terraform commands only interact with the currently selected workspace. This includes [provisioning](/cli/run) and [state manipulation](/cli/state).
Use [the `terraform workspace select` command](/terraform/cli/commands/workspace/select) to change the currently selected workspace. For a given working directory, you can only select one workspace at a time. Most Terraform commands only interact with the currently selected workspace. This includes [provisioning](/terraform/cli/run) and [state manipulation](/terraform/cli/state).
When you provision infrastructure in each workspace, you usually need to manually specify different [input variables](/language/values/variables) to differentiate each collection. For example, you might deploy test infrastructure to a different region.
When you provision infrastructure in each workspace, you usually need to manually specify different [input variables](/terraform/language/values/variables) to differentiate each collection. For example, you might deploy test infrastructure to a different region.
## Use Cases
You can create multiple [working directories](/cli/init) to maintain multiple instances of a configuration with completely separate state data. However, Terraform installs a separate cache of plugins and modules for each working directory, so maintaining multiple directories can waste bandwidth and disk space. This approach also requires extra tasks like updating configuration from version control for each directory separately and reinitializing each directory when you change the configuration. Workspaces are convenient because they let you create different sets of infrastructure with the same working copy of your configuration and the same plugin and module caches.
You can create multiple [working directories](/terraform/cli/init) to maintain multiple instances of a configuration with completely separate state data. However, Terraform installs a separate cache of plugins and modules for each working directory, so maintaining multiple directories can waste bandwidth and disk space. This approach also requires extra tasks like updating configuration from version control for each directory separately and reinitializing each directory when you change the configuration. Workspaces are convenient because they let you create different sets of infrastructure with the same working copy of your configuration and the same plugin and module caches.
A common use for multiple workspaces is to create a parallel, distinct copy of
a set of infrastructure to test a set of changes before modifying production infrastructure.
@ -48,7 +48,7 @@ development stages or different internal teams. In this case, the backend for ea
## Alternatives to Workspaces
Instead of creating CLI workspaces, you can use one or more [re-usable modules](/language/modules/develop) to represent the common elements and then represent each instance as a separate configuration that instantiates those common elements in the context of a different [backend](/language/settings/backends/configuration). The root module of each configuration consists only of a backend configuration and a small number of `module` blocks with arguments describing any small differences between the deployments.
Instead of creating CLI workspaces, you can use one or more [re-usable modules](/terraform/language/modules/develop) to represent the common elements and then represent each instance as a separate configuration that instantiates those common elements in the context of a different [backend](/terraform/language/settings/backends/configuration). The root module of each configuration consists only of a backend configuration and a small number of `module` blocks with arguments describing any small differences between the deployments.
When multiple configurations represent distinct system components rather than multiple deployments, you can pass data from one component to another using paired resources types and data sources.
@ -58,7 +58,7 @@ When multiple configurations represent distinct system components rather than mu
- For server addresses, use a provider-specific resource to create a DNS record with a predictable name. Then you can either use that name directly or use [the `dns` provider](https://registry.terraform.io/providers/hashicorp/dns/latest/docs) to retrieve the published addresses in other configurations.
- If you store a Terraform state for one configuration in a remote backend that other configurations can access, then the other configurations can use [`terraform_remote_state`](/language/state/remote-state-data) to directly consume its root module outputs. This setup creates a tighter coupling between configurations, and the root configuration does not need to publish its results in a separate system.
- If you store a Terraform state for one configuration in a remote backend that other configurations can access, then the other configurations can use [`terraform_remote_state`](/terraform/language/state/remote-state-data) to directly consume its root module outputs. This setup creates a tighter coupling between configurations, and the root configuration does not need to publish its results in a separate system.
## Interactions with Terraform Cloud Workspaces
@ -68,9 +68,9 @@ act more like completely separate working directories. Each Terraform Cloud
workspace has its own Terraform configuration, set of variable values, state
data, run history, and settings.
When you [integrate Terraform CLI with Terraform Cloud](/cli/cloud), you can associate the current CLI working directory with one or more remote Terraform Cloud workspaces. Then, use the `terraform workspace` commands to select the remote workspace you want to use for each run.
When you [integrate Terraform CLI with Terraform Cloud](/terraform/cli/cloud), you can associate the current CLI working directory with one or more remote Terraform Cloud workspaces. Then, use the `terraform workspace` commands to select the remote workspace you want to use for each run.
Refer to [CLI-driven Runs](/cloud-docs/run/cli) in the Terraform Cloud documentation for more details.
Refer to [CLI-driven Runs](/terraform/cloud-docs/run/cli) in the Terraform Cloud documentation for more details.
## Workspace Internals
@ -81,6 +81,6 @@ Workspaces are also meant to be a shared resource. They are not private, unless
For local state, Terraform stores the workspace states in a directory called `terraform.tfstate.d`. This directory should be treated similarly to local-only `terraform.tfstate`. Some teams commit these files to version control, but we recommend using a remote backend instead when there are multiple collaborators.
For [remote state](/language/state/remote), the workspaces are stored directly in the configured [backend](/language/settings/backends/configuration). For example, if you use [Consul](/language/settings/backends/consul), the workspaces are stored by appending the workspace name to the state path. To ensure that workspace names are stored correctly and safely in all backends, the name must be valid to use in a URL path segment without escaping.
For [remote state](/terraform/language/state/remote), the workspaces are stored directly in the configured [backend](/terraform/language/settings/backends/configuration). For example, if you use [Consul](/terraform/language/settings/backends/consul), the workspaces are stored by appending the workspace name to the state path. To ensure that workspace names are stored correctly and safely in all backends, the name must be valid to use in a URL path segment without escaping.
Terraform stores the current workspace name locally in the ignored `.terraform` directory. This allows multiple team members to work on different workspaces concurrently. Workspace names are also attached to associated remote workspaces in Terraform Cloud. For more details about workspace names in Terraform Cloud, refer to the [CLI Integration (recommended)](/cli/cloud/settings#arguments) and [remote backend](/language/settings/backends/remote#workspaces) and documentation.
Terraform stores the current workspace name locally in the ignored `.terraform` directory. This allows multiple team members to work on different workspaces concurrently. Workspace names are also attached to associated remote workspaces in Terraform Cloud. For more details about workspace names in Terraform Cloud, refer to the [CLI Integration (recommended)](/terraform/cli/cloud/settings#arguments) and [remote backend](/terraform/language/settings/backends/remote#workspaces) and documentation.

View File

@ -15,7 +15,7 @@ Terraform's types are `string`, `number`, `bool`, `list`, `tuple`, `map`,
`object`, and `null`.
This information has moved to
[Types and Values](/language/expressions/types).
[Types and Values](/terraform/language/expressions/types).
<div style={{height: '30vh', margin: 0, padding: 0}} />
@ -27,7 +27,7 @@ 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).
[References to Values](/terraform/language/expressions/references).
<div style={{height: '30vh', margin: 0, padding: 0}} />
@ -39,7 +39,7 @@ 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).
[Operators](/terraform/language/expressions/operators).
<div style={{height: '30vh', margin: 0, padding: 0}} />
@ -49,7 +49,7 @@ 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).
[Conditional Expressions](/terraform/language/expressions/conditionals).
<div style={{height: '30vh', margin: 0, padding: 0}} />
@ -60,7 +60,7 @@ This information has moved to
Terraform's functions can be called like `function_name(arg1, arg2)`.
This information has moved to
[Function Calls](/language/expressions/function-calls).
[Function Calls](/terraform/language/expressions/function-calls).
<div style={{height: '30vh', margin: 0, padding: 0}} />
@ -72,7 +72,7 @@ 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).
[For Expressions](/terraform/language/expressions/for).
<div style={{height: '30vh', margin: 0, padding: 0}} />
@ -84,7 +84,7 @@ Expressions like `var.list[*].id` can extract simpler collections from complex
collections.
This information has moved to
[Splat Expressions](/language/expressions/splat).
[Splat Expressions](/terraform/language/expressions/splat).
<div style={{height: '30vh', margin: 0, padding: 0}} />
@ -96,7 +96,7 @@ 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).
[Dynamic Blocks](/terraform/language/expressions/dynamic-blocks).
<div style={{height: '30vh', margin: 0, padding: 0}} />
@ -116,6 +116,6 @@ Strings can also include escape sequences like `\n`, interpolation sequences
(`${ ... }`), and template sequences (`%{ ... }`).
This information has moved to
[Strings and Templates](/language/expressions/strings).
[Strings and Templates](/terraform/language/expressions/strings).
<div style={{height: '30vh', margin: 0, padding: 0}} />

View File

@ -12,7 +12,7 @@ pages.
## Syntax and Elements of Module Blocks
This information has moved to
[Module Blocks](/language/modules/syntax).
[Module Blocks](/terraform/language/modules/syntax).
<div style={{height: '100vh', margin: 0, padding: 0}} />
@ -21,8 +21,8 @@ This information has moved to
## 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).
[`count`](/terraform/language/meta-arguments/count) and
[`for_each`](/terraform/language/meta-arguments/for_each).
<div style={{height: '100vh', margin: 0, padding: 0}} />
@ -31,9 +31,9 @@ This information has moved to
## Handling Provider Configurations in Re-usable Modules
This information has moved to
[The `providers` Meta-Argument](/language/meta-arguments/module-providers)
[The `providers` Meta-Argument](/terraform/language/meta-arguments/module-providers)
(for users of re-usable modules) and
[Providers Within Modules](/language/modules/develop/providers)
[Providers Within Modules](/terraform/language/modules/develop/providers)
(for module developers).
<div style={{height: '100vh', margin: 0, padding: 0}} />

View File

@ -12,7 +12,7 @@ pages.
## Syntax and Elements of Resource Blocks
This information has moved to
[Resource Blocks](/language/resources/syntax).
[Resource Blocks](/terraform/language/resources/syntax).
<div style={{height: '100vh', margin: 0, padding: 0}} />
@ -21,7 +21,7 @@ This information has moved to
## Details of Resource Behavior
This information has moved to
[Resource Behavior](/language/resources/behavior).
[Resource Behavior](/terraform/language/resources/behavior).
<div style={{height: '100vh', margin: 0, padding: 0}} />
@ -29,12 +29,12 @@ This information has moved to
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/syntax)
- [`depends_on`](/terraform/language/meta-arguments/depends_on)
- [`count`](/terraform/language/meta-arguments/count)
- [`for_each`](/terraform/language/meta-arguments/for_each)
- [`provider`](/terraform/language/meta-arguments/resource-provider)
- [`lifecycle`](/terraform/language/meta-arguments/lifecycle)
- [Provisioners](/terraform/language/resources/provisioners/syntax)
<div style={{height: '100vh', margin: 0, padding: 0}} />
@ -43,7 +43,7 @@ Each resource meta-argument has moved to its own page:
### `depends_on`
This information has moved to
[`depends_on`](/language/meta-arguments/depends_on).
[`depends_on`](/terraform/language/meta-arguments/depends_on).
<div style={{height: '100vh', margin: 0, padding: 0}} />
@ -52,7 +52,7 @@ This information has moved to
### `count`
This information has moved to
[`count`](/language/meta-arguments/count).
[`count`](/terraform/language/meta-arguments/count).
<div style={{height: '100vh', margin: 0, padding: 0}} />
@ -61,7 +61,7 @@ This information has moved to
### `for_each`
This information has moved to
[`for_each`](/language/meta-arguments/for_each).
[`for_each`](/terraform/language/meta-arguments/for_each).
<div style={{height: '100vh', margin: 0, padding: 0}} />
@ -70,7 +70,7 @@ This information has moved to
### `provider`
This information has moved to
[`provider`](/language/meta-arguments/resource-provider).
[`provider`](/terraform/language/meta-arguments/resource-provider).
<div style={{height: '100vh', margin: 0, padding: 0}} />
@ -79,7 +79,7 @@ This information has moved to
### `lifecycle`
This information has moved to
[`lifecycle`](/language/meta-arguments/lifecycle).
[`lifecycle`](/terraform/language/meta-arguments/lifecycle).
<div style={{height: '100vh', margin: 0, padding: 0}} />
@ -88,6 +88,6 @@ This information has moved to
### Provisioners
This information has moved to
[Provisioners](/language/resources/provisioners/syntax).
[Provisioners](/terraform/language/resources/provisioners/syntax).
<div style={{height: '100vh', margin: 0, padding: 0}} />

View File

@ -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](/docs/partnerships) 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](/terraform/docs/partnerships) at _<terraform-provider-dev@hashicorp.com>_.

View File

@ -8,10 +8,10 @@ description: >-
# 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](/terraform/registry) and
[remote operations](/terraform/cloud-docs/run/cli), Terraform by default looks for
API credentials to use in these calls in
[the CLI configuration](/cli/config/config-file).
[the CLI configuration](/terraform/cli/config/config-file).
Credentials helpers offer an alternative approach that allows you to customize
how Terraform obtains credentials using an external program, which can then
@ -19,7 +19,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](/terraform/cli/config/config-file#credentials-helpers).
## How Terraform finds Credentials Helpers
@ -29,7 +29,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](/terraform/plugin/how-terraform-works#plugin-locations).
## How Terraform runs Credentials Helpers
@ -56,7 +56,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](/terraform/cli/config/config-file#credentials).
To represent an API token, the object contains a property called "token" whose
value is the token string:
@ -159,7 +159,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](/terraform/plugin/how-terraform-works#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,

View File

@ -8,7 +8,7 @@ description: >-
# 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.
> **Hands-on:** Try the [Create Dynamic Expressions](/terraform/tutorials/configuration-language/troubleshooting-workflow#bug-reporting-best-practices?utm_source=WEBSITE&utm_medium=WEB_IO&utm_offer=ARTICLE_PAGE&utm_content=DOCS) tutorial.
Terraform has detailed logs that you can enable by setting the `TF_LOG` environment variable to any value. Enabling this setting causes detailed logs to appear on `stderr`.

View File

@ -32,7 +32,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](/terraform/language/v1-compatibility-promises).
## Format Summary

View File

@ -110,8 +110,8 @@ 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.
[plan](/terraform/cli/commands/plan), [apply](/terraform/cli/commands/apply), and
[destroy](/terraform/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

View File

@ -13,7 +13,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](/terraform/cli/commands/show) 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 +26,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](/terraform/language/v1-compatibility-promises).
## Format Summary
@ -338,7 +338,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`](/terraform/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.
Output values include a `"type"` field, which is a [serialization of the value's type](https://pkg.go.dev/github.com/zclconf/go-cty/cty#Type.MarshalJSON). For primitive types this is a string value, such as `"number"` or `"bool"`. Complex types are represented as a nested JSON array, such as `["map","string"]` or `["object",{"a":"number"}]`. This can be used to reconstruct the output value with the correct type.

View File

@ -8,18 +8,18 @@ description: >-
# 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`](/terraform/cli/commands/login). 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](/terraform/internals/remote-service-discovery),
such as a Terraform module registry.
First, Terraform uses
[remote service discovery](/internals/remote-service-discovery) to
[remote service discovery](/terraform/internals/remote-service-discovery) 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:

View File

@ -24,7 +24,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](/terraform/language/v1-compatibility-promises).
## Sample JSON Output
@ -60,7 +60,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](/terraform/cli/commands/validate#json)
### Operation Results
@ -103,7 +103,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](/terraform/internals/json-format).
### Example
@ -146,7 +146,7 @@ At the end of a plan or before an apply, Terraform will emit a `planned_change`
- `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](/terraform/internals/json-format).
### Example

View File

@ -23,7 +23,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](/terraform/registry/api-docs). Third-party registry
implementations may choose to implement those extensions if desired, but
Terraform CLI itself does not use them.
@ -81,7 +81,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](/terraform/internals/remote-service-discovery),
with the hostname in the module address acting as the "User-facing Hostname".
The service identifier for the module registry protocol is `modules.v1`.
@ -209,10 +209,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](/terraform/language/modules/sources),
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](/terraform/language/modules/sources#http-urls).

View File

@ -16,7 +16,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](/terraform/cli/config/config-file#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 +26,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](/terraform/internals/provider-registry-protocol)
instead.
## Provider Addresses
@ -34,7 +34,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](/terraform/language/providers/requirements).
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 +52,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](/terraform/internals/remote-service-discovery) 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 +94,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](/terraform/cli/config/config-file#credentials) for the hostname
given in the network mirror base URL, Terraform will include those credentials
in its requests for operations described below.
@ -258,7 +258,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](/terraform/cli/commands/providers/mirror),
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.

View File

@ -40,7 +40,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](/terraform/cli/config/config-file#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 +76,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](/terraform/cli/config/config-file#provider-installation)
instead.
## Provider Versions
@ -96,7 +96,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](/terraform/internals/remote-service-discovery),
with the hostname in the provider address acting as the "User-facing Hostname".
The service identifier for the provider registry protocol is `providers.v1`.

View File

@ -83,14 +83,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](/terraform/cli/commands/login)
* `modules.v1`: [module registry API version 1](/terraform/internals/module-registry-protocol)
* `providers.v1`: [provider registry API version 1](/terraform/internals/provider-registry-protocol)
## Authentication
If credentials for the given hostname are available in
[the CLI config](/cli/config/config-file#Credentials) through a `credentials_helper` or a host-specific environment variable, then they will be included in the request for the discovery document.
[the CLI config](/terraform/cli/config/config-file#Credentials) through a `credentials_helper` or a host-specific environment variable, then they will be included in the request for the discovery document.
The credentials may also be provided to endpoints declared in the discovery
document, depending on the requirements of the service in question.

View File

@ -152,7 +152,7 @@ Terraform operations are executed in a shared Continuous Integration (CI)
environment. The work needed to create such a CI environment is nontrivial, and
is outside the scope of this core workflow overview, but a full deep dive on
this topic can be found in our
[Running Terraform in Automation](https://learn.hashicorp.com/tutorials/terraform/automate-terraform?in=terraform/automation&utm_source=WEBSITE&utm_medium=WEB_IO&utm_offer=ARTICLE_PAGE&utm_content=DOCS)
[Running Terraform in Automation](/terraform/tutorials/automation/automate-terraform?utm_source=WEBSITE&utm_medium=WEB_IO&utm_offer=ARTICLE_PAGE&utm_content=DOCS)
guide.
This longer iteration cycle of committing changes to version control and then
@ -230,7 +230,7 @@ for a better experience at each step.
Terraform Cloud provides a centralized and secure location for storing
input variables and state while also bringing back a tight feedback loop for
speculative plans for config authors. Terraform configuration can interact with
Terraform Cloud through the [CLI integration](/cli/cloud).
Terraform Cloud through the [CLI integration](/terraform/cli/cloud).
```
terraform {

View File

@ -9,7 +9,7 @@ description: |-
HashiCorp Terraform is an infrastructure as code tool that lets you define both cloud and on-prem resources in human-readable configuration files that you can version, reuse, and share. You can then use a consistent workflow to provision and manage all of your infrastructure throughout its lifecycle. Terraform can manage low-level components like compute, storage, and networking resources, as well as high-level components like DNS entries and SaaS features.
> **Hands On:** Try the Get Started tutorials to start managing infrastructure on popular cloud providers: [Amazon Web Services](https://learn.hashicorp.com/collections/terraform/aws-get-started), [Azure](https://learn.hashicorp.com/collections/terraform/azure-get-started), [Google Cloud Platform](https://learn.hashicorp.com/collections/terraform/gcp-get-started), [Oracle Cloud Infrastructure](https://learn.hashicorp.com/collections/terraform/oci-get-started), and [Docker](https://learn.hashicorp.com/collections/terraform/docker-get-started).
> **Hands On:** Try the Get Started tutorials to start managing infrastructure on popular cloud providers: [Amazon Web Services](/terraform/tutorials/aws-get-started), [Azure](/terraform/tutorials/azure-get-started), [Google Cloud Platform](/terraform/tutorials/gcp-get-started), [Oracle Cloud Infrastructure](/terraform/tutorials/oci-get-started), and [Docker](/terraform/tutorials/docker-get-started).
## How does Terraform work?
Terraform creates and manages resources on cloud platforms and other services through their application programming interfaces (APIs). Providers enable Terraform to work with virtually any platform or service with an accessible API.
@ -36,11 +36,11 @@ HashiCorp co-founder and CTO Armon Dadgar explains how Terraform solves infrastr
### Manage any infrastructure
Find providers for many of the platforms and services you already use in the [Terraform Registry](https://registry.terraform.io/). You can also [write your own](/plugin). Terraform takes an [immutable approach to infrastructure](https://www.hashicorp.com/resources/what-is-mutable-vs-immutable-infrastructure), reducing the complexity of upgrading or modifying your services and infrastructure.
Find providers for many of the platforms and services you already use in the [Terraform Registry](https://registry.terraform.io/). You can also [write your own](/terraform/plugin). Terraform takes an [immutable approach to infrastructure](https://www.hashicorp.com/resources/what-is-mutable-vs-immutable-infrastructure), reducing the complexity of upgrading or modifying your services and infrastructure.
### Track your infrastructure
Terraform generates a plan and prompts you for your approval before modifying your infrastructure. It also keeps track of your real infrastructure in a [state file](/language/state), which acts as a source of truth for your environment. Terraform uses the state file to determine the changes to make to your infrastructure so that it will match your configuration.
Terraform generates a plan and prompts you for your approval before modifying your infrastructure. It also keeps track of your real infrastructure in a [state file](/terraform/language/state), which acts as a source of truth for your environment. Terraform uses the state file to determine the changes to make to your infrastructure so that it will match your configuration.
### Automate changes
@ -48,13 +48,13 @@ Terraform configuration files are declarative, meaning that they describe the en
### Standardize configurations
Terraform supports reusable configuration components called [modules](/language/modules) that define configurable collections of infrastructure, saving time and encouraging best practices. You can use publicly available modules from the Terraform Registry, or write your own.
Terraform supports reusable configuration components called [modules](/terraform/language/modules) that define configurable collections of infrastructure, saving time and encouraging best practices. You can use publicly available modules from the Terraform Registry, or write your own.
### Collaborate
Since your configuration is written in a file, you can commit it to a Version Control System (VCS) and use [Terraform Cloud](/intro/terraform-editions#terraform-cloud) to efficiently manage Terraform workflows across teams. Terraform Cloud runs Terraform in a consistent, reliable environment and provides secure access to shared state and secret data, role-based access controls, a private registry for sharing both modules and providers, and more.
Since your configuration is written in a file, you can commit it to a Version Control System (VCS) and use [Terraform Cloud](/terraform/intro/terraform-editions#terraform-cloud) to efficiently manage Terraform workflows across teams. Terraform Cloud runs Terraform in a consistent, reliable environment and provides secure access to shared state and secret data, role-based access controls, a private registry for sharing both modules and providers, and more.
-> **Tip:** Learn more about [Terraform use cases](/intro/use-cases) and [how Terraform compares to alternatives](/intro/vs).
-> **Tip:** Learn more about [Terraform use cases](/terraform/intro/use-cases) and [how Terraform compares to alternatives](/terraform/intro/vs).
## Community

View File

@ -25,10 +25,10 @@ Terraform open source lets you:
### Resources
- Get Started tutorials for popular providers: [Amazon Web Services](https://learn.hashicorp.com/collections/terraform/aws-get-started), [Azure](https://learn.hashicorp.com/collections/terraform/azure-get-started), [Google Cloud Platform](https://learn.hashicorp.com/collections/terraform/gcp-get-started), [Oracle Cloud Infrastructure](https://learn.hashicorp.com/collections/terraform/oci-get-started), and [Docker](https://learn.hashicorp.com/collections/terraform/docker-get-started)
- [What is Terraform?](/intro)
- [Configuration Language Documentation](/language)
- [CLI Documentation](/cli)
- Get Started tutorials for popular providers: [Amazon Web Services](/terraform/tutorials/aws-get-started), [Azure](/terraform/tutorials/azure-get-started), [Google Cloud Platform](/terraform/tutorials/gcp-get-started), [Oracle Cloud Infrastructure](/terraform/tutorials/oci-get-started), and [Docker](/terraform/tutorials/docker-get-started)
- [What is Terraform?](/terraform/intro)
- [Configuration Language Documentation](/terraform/language)
- [CLI Documentation](/terraform/cli)
## Terraform Cloud
@ -49,9 +49,9 @@ Terraform Cloud lets you:
### Resources
- [Create a Terraform Cloud Account](https://app.terraform.io/public/signup/account)
- [Terraform Cloud Documentation](/cloud-docs)
- [Sentinel Documentation](/cloud-docs/policy-enforcement)
- [Get Started - Terraform Cloud](https://learn.hashicorp.com/collections/terraform/cloud-get-started) tutorials show you how to manage infrastructure using Terraform Cloud's VCS integration
- [Terraform Cloud Documentation](/terraform/cloud-docs)
- [Sentinel Documentation](/terraform/cloud-docs/policy-enforcement)
- [Get Started - Terraform Cloud](/terraform/tutorials/cloud-get-started) tutorials show you how to manage infrastructure using Terraform Cloud's VCS integration
## Terraform Enterprise
@ -66,5 +66,5 @@ Terraform Enterprise lets you:
### Resources
- [Terraform Pricing](https://www.hashicorp.com/products/terraform/pricing)
- [Terraform Enterprise Documentation](/enterprise)
- [Recommended Enterprise Patterns](https://learn.hashicorp.com/collections/terraform/recommended-patterns) guides
- [Terraform Enterprise Documentation](/terraform/enterprise)
- [Recommended Enterprise Patterns](/terraform/tutorials/recommended-patterns) guides

View File

@ -8,7 +8,7 @@ description: |-
# Use Cases
[HashiCorp Terraform](/intro) is an infrastructure as code tool that lets you define infrastructure resources in human-readable configuration files that you can version, reuse, and share. You can then use a consistent workflow to safely and efficiently provision and manage your infrastructure throughout its lifecycle.
[HashiCorp Terraform](/terraform/intro) is an infrastructure as code tool that lets you define infrastructure resources in human-readable configuration files that you can version, reuse, and share. You can then use a consistent workflow to safely and efficiently provision and manage your infrastructure throughout its lifecycle.
This page describes popular Terraform use cases and provides related resources that you can use to create Terraform configurations and workflows.
@ -17,7 +17,7 @@ Provisioning infrastructure across multiple clouds increases fault-tolerance, al
### Resources
- Try our [Deploy Federated Multi-Cloud Kubernetes Clusters](https://learn.hashicorp.com/tutorials/terraform/multicloud-kubernetes) tutorial to provision Kubernetes clusters in both Azure and AWS environments, configure Consul federation with mesh gateways across the two clusters, and deploy microservices across the two clusters to verify federation.
- Try our [Deploy Federated Multi-Cloud Kubernetes Clusters](/terraform/tutorials/networking/multicloud-kubernetes) tutorial to provision Kubernetes clusters in both Azure and AWS environments, configure Consul federation with mesh gateways across the two clusters, and deploy microservices across the two clusters to verify federation.
- Browse the [Terraform Registry](https://registry.terraform.io/browse/providers) to find thousands of publicly available providers.
@ -27,8 +27,8 @@ You can use Terraform to efficiently deploy, release, scale, and monitor infrast
### Resources
- Try our [Automate Monitoring with the Terraform Datadog Provider](https://learn.hashicorp.com/tutorials/terraform/datadog-provider?in=terraform/applications) tutorial to deploy a demo Nginx application to a Kubernetes cluster with Helm and install the Datadog agent across the cluster. The Datadog agent reports the cluster health back to your Datadog dashboard.
- Try our [Use Application Load Balancers for Blue-Green and Canary Deployments](https://learn.hashicorp.com/tutorials/terraform/blue-green-canary-tests-deployments) tutorial. You will provision the blue and green environments, add feature toggles to your Terraform configuration to define a list of potential deployment strategies, conduct a canary test, and incrementally promote your green environment.
- Try our [Automate Monitoring with the Terraform Datadog Provider](/terraform/tutorials/applications/datadog-provider) tutorial to deploy a demo Nginx application to a Kubernetes cluster with Helm and install the Datadog agent across the cluster. The Datadog agent reports the cluster health back to your Datadog dashboard.
- Try our [Use Application Load Balancers for Blue-Green and Canary Deployments](/terraform/tutorials/aws/blue-green-canary-tests-deployments) tutorial. You will provision the blue and green environments, add feature toggles to your Terraform configuration to define a list of potential deployment strategies, conduct a canary test, and incrementally promote your green environment.
## Self-Service Clusters
@ -37,9 +37,9 @@ At a large organization, your centralized operations team may get many repetitiv
### Resources
- Try the [Use Modules from the Registry](https://learn.hashicorp.com/tutorials/terraform/module-use?in=terraform/modules) tutorial to get started using public modules in your Terraform configuration.
Try the [Build and Use a Local Module](https://learn.hashicorp.com/tutorials/terraform/module-create?in=terraform/modules) tutorial to create a module to manage AWS S3 buckets.
- Follow these [ServiceNow Service Catalog Integration Setup Instructions](/cloud-docs/integrations/service-now) to connect ServiceNow to Terraform Cloud.
- Try the [Use Modules from the Registry](/terraform/tutorials/modules/module-use) tutorial to get started using public modules in your Terraform configuration.
Try the [Build and Use a Local Module](/terraform/tutorials/modules/module-create) tutorial to create a module to manage AWS S3 buckets.
- Follow these [ServiceNow Service Catalog Integration Setup Instructions](/terraform/cloud-docs/integrations/service-now) to connect ServiceNow to Terraform Cloud.
## Policy Compliance and Management
@ -48,9 +48,9 @@ Terraform can help you enforce policies on the types of resources teams can prov
### Resources
- Try the [Control Costs with Policies](https://learn.hashicorp.com/tutorials/terraform/cost-estimation) tutorial to estimate the cost of infrastructure changes and define policy to limit it.
- Try the [Control Costs with Policies](/terraform/tutorials/cloud-get-started/cost-estimation) tutorial to estimate the cost of infrastructure changes and define policy to limit it.
- The [Sentinel documentation](/cloud-docs/policy-enforcement) provides more in-depth information and a list of example policies that you can adapt for your use cases.
- The [Sentinel documentation](/terraform/cloud-docs/policy-enforcement) provides more in-depth information and a list of example policies that you can adapt for your use cases.
## PaaS Application Setup
@ -58,19 +58,19 @@ Platform as a Service (PaaS) vendors like Heroku allow you to create web applic
### Resources
Try the [Deploy, Manage, and Scale an Application on Heroku](https://learn.hashicorp.com/tutorials/terraform/heroku-provider?in=terraform/applications) tutorial to manage an applications lifecycle with Terraform.
Try the [Deploy, Manage, and Scale an Application on Heroku](/terraform/tutorials/applications/heroku-provider) tutorial to manage an applications lifecycle with Terraform.
## Software Defined Networking
Terraform can interact with Software Defined Networks (SDNs) to automatically configure the network according to the needs of the applications running in it. This lets you move from a ticket-based workflow to an automated one, reducing deployment times.
For example, when a service registers with [HashiCorp Consul](https://www.consul.io/), [Consul-Terraform-Sync](https://developer.hashicorp.com/consul/docs/nia) can automatically generate Terraform configuration to expose appropriate ports and adjust network settings for any SDN that has an associated Terraform provider. Network Infrastructure Automation (NIA) allows you to safely approve the changes that your applications require without having to manually translate tickets from developers into the changes you think their applications need.
For example, when a service registers with [HashiCorp Consul](https://www.consul.io/), [Consul-Terraform-Sync](/consul/docs/nia) can automatically generate Terraform configuration to expose appropriate ports and adjust network settings for any SDN that has an associated Terraform provider. Network Infrastructure Automation (NIA) allows you to safely approve the changes that your applications require without having to manually translate tickets from developers into the changes you think their applications need.
### Resources
- Try the [Network Infrastructure Automation with Consul-Terraform-Sync Intro](https://learn.hashicorp.com/tutorials/consul/consul-terraform-sync-intro?in=consul/network-infrastructure-automation) tutorial to install Consul-Terraform-Sync on a node. You will then configure it to communicate with a Consul datacenter, react to service changes, and execute an example task.
- Try the [Consul-Terraform-Sync and Terraform Enterprise/Cloud Integration](https://learn.hashicorp.com/tutorials/consul/consul-terraform-sync-terraform-enterprise?in=consul/network-infrastructure-automation) tutorial to configure Consul-Terraform-Sync to interact with Terraform Enterprise and Terraform Cloud.
- Try the [Network Infrastructure Automation with Consul-Terraform-Sync Intro](/consul/tutorials/network-infrastructure-automation/consul-terraform-sync-intro) tutorial to install Consul-Terraform-Sync on a node. You will then configure it to communicate with a Consul datacenter, react to service changes, and execute an example task.
- Try the [Consul-Terraform-Sync and Terraform Enterprise/Cloud Integration](/consul/tutorials/network-infrastructure-automation/consul-terraform-sync-terraform-enterprise) tutorial to configure Consul-Terraform-Sync to interact with Terraform Enterprise and Terraform Cloud.
## Kubernetes
@ -79,8 +79,8 @@ Kubernetes is an open-source workload scheduler for containerized applications.
### Resources
- Try the [Manage Kubernetes Resources via Terraform](https://learn.hashicorp.com/tutorials/terraform/kubernetes-provider?in=terraform/kubernetes) tutorial. You will use Terraform to schedule and expose a NGINX deployment on a Kubernetes cluster.
- Try the [Deploy Infrastructure with the Terraform Cloud Operator for Kubernetes](https://learn.hashicorp.com/tutorials/terraform/kubernetes-operator) tutorial. You will configure and deploy the Operator to a Kubernetes cluster and use it to create a Terraform Cloud workspace and provision a message queue for an example application.
- Try the [Manage Kubernetes Resources via Terraform](/terraform/tutorials/kubernetes/kubernetes-provider) tutorial. You will use Terraform to schedule and expose a NGINX deployment on a Kubernetes cluster.
- Try the [Deploy Infrastructure with the Terraform Cloud Operator for Kubernetes](/terraform/tutorials/kubernetes/kubernetes-operator) tutorial. You will configure and deploy the Operator to a Kubernetes cluster and use it to create a Terraform Cloud workspace and provision a message queue for an example application.
## Parallel Environments

View File

@ -16,7 +16,7 @@ entire datacenter.
Learn how Terraform compares to:
- [Chef, Puppet, etc.](/intro/vs/chef-puppet)
- [CloudFormation, Heat, etc.](/intro/vs/cloudformation)
- [Boto, Fog, etc.](/intro/vs/boto)
- [Custom Solutions](/intro/vs/custom)
- [Chef, Puppet, etc.](/terraform/intro/vs/chef-puppet)
- [CloudFormation, Heat, etc.](/terraform/intro/vs/cloudformation)
- [Boto, Fog, etc.](/terraform/intro/vs/boto)
- [Custom Solutions](/terraform/intro/vs/custom)

View File

@ -23,14 +23,14 @@ 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](/terraform/language/syntax/json) 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](/terraform/language/syntax/configuration#arguments-and-blocks)
within blocks:
- Argument syntax sets a named argument for the containing object. If the
@ -44,7 +44,7 @@ within blocks:
merging in with any explicitly-defined arguments.
The distinction between these is particularly important for
[JSON syntax](/language/syntax/json)
[JSON syntax](/terraform/language/syntax/json)
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.
@ -151,7 +151,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](/terraform/language/expressions/dynamic-blocks)
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
@ -161,7 +161,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](/terraform/language/syntax/json#expression-mapping)
to produce a list of objects.
The interpretation of these values in JSON syntax is, therefore, equivalent

View File

@ -11,10 +11,10 @@ description: >-
_Data sources_ allow Terraform to use information defined outside of Terraform,
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.
> **Hands-on:** Try the [Query Data Sources](/terraform/tutorials/configuration-language/data-sources) tutorial.
Each [provider](/language/providers) may offer data sources
alongside its set of [resource](/language/resources)
Each [provider](/terraform/language/providers) may offer data sources
alongside its set of [resource](/terraform/language/resources)
types.
## Using Data Sources
@ -61,14 +61,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](/terraform/language/providers),
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](/terraform/language/expressions) and other dynamic
Terraform language features.
However, there are some "meta-arguments" that are defined by Terraform itself
@ -115,7 +115,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](/terraform/language/resources/behavior#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.
@ -149,13 +149,13 @@ data "aws_ami" "example" {
Custom conditions can help capture assumptions, helping future maintainers understand the configuration design and intent. They also return useful information about errors earlier and in context, helping consumers more easily diagnose issues in their configurations.
Refer to [Custom Condition Checks](/language/expressions/custom-conditions#preconditions-and-postconditions) for more details.
Refer to [Custom Condition Checks](/terraform/language/expressions/custom-conditions#preconditions-and-postconditions) for more details.
## Multiple Resource Instances
Data resources support [`count`](/language/meta-arguments/count)
and [`for_each`](/language/meta-arguments/for_each)
Data resources support [`count`](/terraform/language/meta-arguments/count)
and [`for_each`](/terraform/language/meta-arguments/for_each)
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
@ -165,7 +165,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](/terraform/language/meta-arguments/resource-provider)
as defined for managed resources, with the same syntax and behavior.
## Lifecycle Customizations
@ -202,7 +202,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](/terraform/language/resources), 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.
@ -220,13 +220,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](/terraform/language/resources/syntax#meta-arguments) of resources
with the exception of the
[`lifecycle` configuration block](/language/meta-arguments/lifecycle).
[`lifecycle` configuration block](/terraform/language/meta-arguments/lifecycle).
### Non-Default Provider Configurations
Similarly to [resources](/language/resources), when
Similarly to [resources](/terraform/language/resources), when
a module has multiple configurations for the same provider you can specify which
configuration to use with the `provider` meta-argument:
@ -239,7 +239,7 @@ data "aws_ami" "web" {
```
See
[The Resource `provider` Meta-Argument](/language/meta-arguments/resource-provider)
[The Resource `provider` Meta-Argument](/terraform/language/meta-arguments/resource-provider)
for more information.
## Data Source Lifecycle

View File

@ -10,7 +10,7 @@ description: >-
A _conditional expression_ uses the value of a boolean expression to select one of
two values.
> **Hands-on:** Try the [Create Dynamic Expressions](https://learn.hashicorp.com/tutorials/terraform/expressions?in=terraform/configuration-language&utm_source=WEBSITE&utm_medium=WEB_IO&utm_offer=ARTICLE_PAGE&utm_content=DOCS) tutorial.
> **Hands-on:** Try the [Create Dynamic Expressions](/terraform/tutorials/configuration-language/expressions?utm_source=WEBSITE&utm_medium=WEB_IO&utm_offer=ARTICLE_PAGE&utm_content=DOCS) tutorial.
## Syntax
@ -45,7 +45,7 @@ You can create conditions that produce custom error messages for several types o
Custom conditions can help capture assumptions, helping future maintainers understand the configuration design and intent. They also return useful information about errors earlier and in context, helping consumers more easily diagnose issues in their configurations.
Refer to [Custom Condition Checks](/language/expressions/custom-conditions#input-variable-validation) for details.
Refer to [Custom Condition Checks](/terraform/language/expressions/custom-conditions#input-variable-validation) for details.
## Result Types
@ -72,7 +72,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`](/terraform/language/functions/tostring) to explicitly convert a number to
a string.
```hcl

View File

@ -8,7 +8,7 @@ description: >-
You can create conditions that produce custom error messages for several types of objects in a configuration. For example, you can add a condition to an input variable that checks whether incoming image IDs are formatted properly. Custom conditions can capture assumptions, helping future maintainers understand the configuration design and intent. They also return useful information about errors earlier and in context, helping consumers more easily diagnose issues in their configurations.
> **Hands On:** Try the [Validate Modules with Custom Conditions](https://learn.hashicorp.com/tutorials/terraform/custom-conditions?in=terraform/configuration-language) tutorial.
> **Hands On:** Try the [Validate Modules with Custom Conditions](/terraform/tutorials/configuration-language/custom-conditions) tutorial.
This page explains the following:
- Creating [validation conditions](#input-variable-validation) for input variables (Terraform v0.13.0 and later)
@ -39,7 +39,7 @@ variable "image_id" {
}
```
If the failure of an expression determines the validation decision, use the [`can` function](/language/functions/can) as demonstrated in the following example.
If the failure of an expression determines the validation decision, use the [`can` function](/terraform/language/functions/can) as demonstrated in the following example.
```hcl
variable "image_id" {
@ -104,7 +104,7 @@ Terraform evaluates output value preconditions before evaluating the `value` exp
### Continuous Validation in Terraform Cloud
Terraform Cloud can automatically check whether the preconditions and postconditions in a workspaces configuration continue to pass after Terraform provisions the infrastructure. For example, you can write a `postcondition` to check whether an API gateway certificate is valid. Continuous validation alerts you when the condition fails, so you can update the certificate and avoid errors the next time you want to update your infrastructure. Refer to [Continuous Validation](/cloud-docs/workspaces/health#continuous-validation) in the Terraform Cloud documentation for details.
Terraform Cloud can automatically check whether the preconditions and postconditions in a workspaces configuration continue to pass after Terraform provisions the infrastructure. For example, you can write a `postcondition` to check whether an API gateway certificate is valid. Continuous validation alerts you when the condition fails, so you can update the certificate and avoid errors the next time you want to update your infrastructure. Refer to [Continuous Validation](/terraform/cloud-docs/workspaces/health#continuous-validation) in the Terraform Cloud documentation for details.
### Examples
@ -219,11 +219,11 @@ Use the logical operators `&&` (AND), `||` (OR), and `!` (NOT) to combine multip
condition = var.name != "" && lower(var.name) == var.name
```
You can also use arithmetic operators (e.g. `a + b`), equality operators (eg., `a == b`) and comparison operators (e.g., `a < b`). Refer to [Arithmetic and Logical Operators](/language/expressions/operators) for details.
You can also use arithmetic operators (e.g. `a + b`), equality operators (eg., `a == b`) and comparison operators (e.g., `a < b`). Refer to [Arithmetic and Logical Operators](/terraform/language/expressions/operators) for details.
### `contains` Function
Use the [`contains` function](/language/functions/contains) to test whether a given value is one of a set of predefined valid values.
Use the [`contains` function](/terraform/language/functions/contains) to test whether a given value is one of a set of predefined valid values.
```hcl
condition = contains(["STAGE", "PROD"], var.environment)
@ -231,7 +231,7 @@ Use the [`contains` function](/language/functions/contains) to test whether a gi
### `length` Function
Use the [`length` function](/language/functions/length) to test a collection's length and require a non-empty list or map.
Use the [`length` function](/terraform/language/functions/length) to test a collection's length and require a non-empty list or map.
```hcl
condition = length(var.items) != 0
@ -240,7 +240,7 @@ This is a better approach than directly comparing with another collection using
### `for` Expressions
Use [`for` expressions](/language/expressions/for) in conjunction with the functions `alltrue` and `anytrue` to test whether a condition holds for all or for any elements of a collection.
Use [`for` expressions](/terraform/language/expressions/for) in conjunction with the functions `alltrue` and `anytrue` to test whether a condition holds for all or for any elements of a collection.
```hcl
condition = alltrue([
@ -250,7 +250,7 @@ Use [`for` expressions](/language/expressions/for) in conjunction with the funct
### `can` Function
Use the [`can` function](/language/functions/can) to concisely use the validity of an expression as a condition. It returns `true` if its given expression evaluates successfully and `false` if it returns any error, so you can use various other functions that typically return errors as a part of your condition expressions.
Use the [`can` function](/terraform/language/functions/can) to concisely use the validity of an expression as a condition. It returns `true` if its given expression evaluates successfully and `false` if it returns any error, so you can use various other functions that typically return errors as a part of your condition expressions.
For example, you can use `can` with `regex` to test if a string matches a particular pattern because `regex` returns an error when given a non-matching string.
@ -308,7 +308,7 @@ resource "aws_instance" "example" {
### `each` and `count` Objects
In blocks where [`for_each`](/language/meta-arguments/for_each) or [`count`](/language/meta-arguments/count) are set, use `each` and `count` objects to refer to other resources that are expanded in a chain.
In blocks where [`for_each`](/terraform/language/meta-arguments/for_each) or [`count`](/terraform/language/meta-arguments/count) are set, use `each` and `count` objects to refer to other resources that are expanded in a chain.
```hcl
variable "vpc_cidrs" {
@ -354,7 +354,7 @@ The selected AMI must be tagged with the Component value "nomad-server".
```
The `error_message` argument can be any expression that evaluates to a string.
This includes literal strings, heredocs, and template expressions. You can use the [`format` function](/language/functions/format) to convert items of `null`, `list`, or `map` types into a formatted string. Multi-line
This includes literal strings, heredocs, and template expressions. You can use the [`format` function](/terraform/language/functions/format) to convert items of `null`, `list`, or `map` types into a formatted string. Multi-line
error messages are supported, and lines with leading whitespace will not be
word wrapped.

View File

@ -44,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](/terraform/language/expressions/for), 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.
@ -84,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`](/terraform/language/functions/flatten)
and
[`setproduct`](/language/functions/setproduct)
[`setproduct`](/terraform/language/functions/setproduct)
functions.
## Multi-level Nested Block Structures
@ -151,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](/terraform/language/modules/develop#when-to-write-a-module)
and [Module Composition](/terraform/language/modules/develop/composition).

View File

@ -127,7 +127,7 @@ using lexical sorting.
For sets of strings, Terraform sorts the elements by their value, using
lexical sorting.
For sets of other types, Terraform uses an arbitrary ordering that may change in future versions. We recommend converting the expression result into a set to make it clear elsewhere in the configuration that the result is unordered. You can use [the `toset` function](/language/functions/toset)
For sets of other types, Terraform uses an arbitrary ordering that may change in future versions. We recommend converting the expression result into a set to make it clear elsewhere in the configuration that the result is unordered. You can use [the `toset` function](/terraform/language/functions/toset)
to concisely convert a `for` expression result to be of a set type.
```hcl
@ -204,4 +204,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](/terraform/language/expressions/dynamic-blocks).

View File

@ -7,10 +7,10 @@ description: >-
# 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.
> **Hands-on:** Try the [Perform Dynamic Operations with Functions](/terraform/tutorials/configuration-language/functions?utm_source=WEBSITE&utm_medium=WEB_IO&utm_offer=ARTICLE_PAGE&utm_content=DOCS) tutorial.
The Terraform language has a number of
[built-in functions](/language/functions) that can be used
[built-in functions](/terraform/language/functions) that can be used
in expressions to transform and combine values. These
are similar to the operators but all follow a common syntax:
@ -35,7 +35,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](/terraform/language/functions).
## Expanding Function Arguments
@ -52,8 +52,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](/terraform/language/values/variables#suppressing-values-in-cli-output)
or [an output defined](/terraform/language/values/outputs#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
@ -82,10 +82,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`](/terraform/language/functions/file),
[`templatefile`](/terraform/language/functions/templatefile),
[`timestamp`](/terraform/language/functions/timestamp),
and [`uuid`](/terraform/language/functions/uuid).
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.
@ -104,7 +104,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](/terraform/language/expressions/references#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

View File

@ -7,7 +7,7 @@ description: >-
# Expressions
> **Hands-on:** Try the [Create Dynamic Expressions](https://learn.hashicorp.com/tutorials/terraform/expressions?in=terraform/configuration-language&utm_source=WEBSITE&utm_medium=WEB_IO&utm_offer=ARTICLE_PAGE&utm_content=DOCS) tutorial.
> **Hands-on:** Try the [Create Dynamic Expressions](/terraform/tutorials/configuration-language/expressions?utm_source=WEBSITE&utm_medium=WEB_IO&utm_offer=ARTICLE_PAGE&utm_content=DOCS) tutorial.
_Expressions_ refer to or compute values within a configuration.
The simplest expressions are just literal values, like `"hello"` or `5`,
@ -18,54 +18,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](/terraform/language/expressions/references#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](/terraform/cli/commands/console).
The other pages in this section describe the features of Terraform's
expression syntax.
- [Types and Values](/language/expressions/types)
- [Types and Values](/terraform/language/expressions/types)
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](/terraform/language/expressions/strings)
documents the syntaxes for string literals, including interpolation sequences
and template directives.
- [References to Values](/language/expressions/references)
- [References to Values](/terraform/language/expressions/references)
documents how to refer to named values like variables and resource attributes.
- [Operators](/language/expressions/operators)
- [Operators](/terraform/language/expressions/operators)
documents the arithmetic, comparison, and logical operators.
- [Function Calls](/language/expressions/function-calls)
- [Function Calls](/terraform/language/expressions/function-calls)
documents the syntax for calling Terraform's built-in functions.
- [Conditional Expressions](/language/expressions/conditionals)
- [Conditional Expressions](/terraform/language/expressions/conditionals)
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](/terraform/language/expressions/for)
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](/terraform/language/expressions/splat)
documents expressions like `var.list[*].id`, which can extract simpler
collections from more complicated expressions.
- [Dynamic Blocks](/language/expressions/dynamic-blocks)
- [Dynamic Blocks](/terraform/language/expressions/dynamic-blocks)
documents a way to create multiple repeatable nested blocks within a resource
or other construct.
- [Type Constraints](/language/expressions/type-constraints)
- [Type Constraints](/terraform/language/expressions/type-constraints)
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](/terraform/language/expressions/version-constraints)
documents the syntax of special strings that define a set of allowed software
versions. Terraform uses version constraints in several places.

View File

@ -56,9 +56,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](/terraform/language/expressions/function-calls). For example, you can calculate exponents
using
[the `pow` function](/language/functions/pow).
[the `pow` function](/terraform/language/functions/pow).
## Equality Operators

View File

@ -8,7 +8,7 @@ description: >-
# References to Named Values
> **Hands-on:** Try the [Create Dynamic Expressions](https://learn.hashicorp.com/tutorials/terraform/expressions?in=terraform/configuration-language&utm_source=WEBSITE&utm_medium=WEB_IO&utm_offer=ARTICLE_PAGE&utm_content=DOCS) tutorial.
> **Hands-on:** Try the [Create Dynamic Expressions](/terraform/tutorials/configuration-language/expressions?utm_source=WEBSITE&utm_medium=WEB_IO&utm_offer=ARTICLE_PAGE&utm_content=DOCS) tutorial.
Terraform makes several kinds of named values available. Each of these names is
an expression that references the associated value. You can use them as
@ -30,7 +30,7 @@ The main kinds of named values available in Terraform are:
The sections below explain each kind of named value in detail.
Although many of these names use dot-separated paths that resemble
[attribute notation](/language/expressions/types#indices-and-attributes) for elements of object values, they are not
[attribute notation](/terraform/language/expressions/types#indices-and-attributes) for elements of object values, they are not
implemented as real objects. This means you must use them exactly as written:
you cannot use square-bracket notation to replace the dot-separated paths, and
you cannot iterate over the "parent object" of a named entity; for example, you
@ -39,7 +39,7 @@ instance resource.
### Resources
`<RESOURCE TYPE>.<NAME>` represents a [managed resource](/language/resources) of
`<RESOURCE TYPE>.<NAME>` represents a [managed resource](/terraform/language/resources) of
the given type and name.
The value of a resource reference can vary, depending on whether the resource
@ -47,7 +47,7 @@ uses `count` or `for_each`:
* If the resource doesn't use `count` or `for_each`, the reference's value is an
object. The resource's attributes are elements of the object, and you can
access them using [dot or square bracket notation](/language/expressions/types#indices-and-attributes).
access them using [dot or square bracket notation](/terraform/language/expressions/types#indices-and-attributes).
* If the resource has the `count` argument set, the reference's value is a
_list_ of objects representing its instances.
* If the resource has the `for_each` argument set, the reference's value is a
@ -61,7 +61,7 @@ For more information about how to use resource references, see
### Input Variables
`var.<NAME>` is the value of the [input variable](/language/values/variables) of the given name.
`var.<NAME>` is the value of the [input variable](/terraform/language/values/variables) of the given name.
If the variable has a type constraint (`type` argument) as part of its
declaration, Terraform will automatically convert the caller's given value
@ -79,7 +79,7 @@ constraint all of the attributes you intend to use elsewhere in your module.
### Local Values
`local.<NAME>` is the value of the [local value](/language/values/locals) of the given name.
`local.<NAME>` is the value of the [local value](/terraform/language/values/locals) of the given name.
Local values can refer to other local values, even within the same `locals`
block, as long as you don't introduce circular dependencies.
@ -87,12 +87,12 @@ block, as long as you don't introduce circular dependencies.
### Child Module Outputs
`module.<MODULE NAME>` is an value representing the results of
[a `module` block](/language/modules/syntax).
[a `module` block](/terraform/language/modules/syntax).
If the corresponding `module` block does not have either `count` nor `for_each`
set then the value will be an object with one attribute for each output value
defined in the child module. To access one of the module's
[output values](/language/values/outputs), use `module.<MODULE NAME>.<OUTPUT NAME>`.
[output values](/terraform/language/values/outputs), use `module.<MODULE NAME>.<OUTPUT NAME>`.
If the corresponding `module` uses `for_each` then the value will be a map
of objects whose keys correspond with the keys in the `for_each` expression,
@ -106,7 +106,7 @@ elements, each one representing one module instance.
### Data Sources
`data.<DATA TYPE>.<NAME>` is an object representing a
[data resource](/language/data-sources) of the given data
[data resource](/terraform/language/data-sources) of the given data
source type and name. If the resource has the `count` argument set, the value
is a list of objects representing its instances. If the resource has the `for_each`
argument set, the value is a map of objects representing its instances.
@ -134,7 +134,7 @@ The following values are available:
directory. We recommend using `path.root` or `path.module` over `path.cwd` where
possible.
- `terraform.workspace` is the name of the currently selected
[workspace](/language/state/workspaces).
[workspace](/terraform/language/state/workspaces).
Use the values in this section carefully, because they include information
about the context in which a configuration is being applied and so may
@ -174,19 +174,19 @@ These local names are described in the documentation for the specific contexts
where they appear. Some of most common local names are:
* `count.index`, in resources that use
[the `count` meta-argument](/language/meta-arguments/count).
[the `count` meta-argument](/terraform/language/meta-arguments/count).
* `each.key` / `each.value`, in resources that use
[the `for_each` meta-argument](/language/meta-arguments/for_each).
* `self`, in [provisioner](/language/resources/provisioners/syntax) and
[connection](/language/resources/provisioners/connection) blocks.
[the `for_each` meta-argument](/terraform/language/meta-arguments/for_each).
* `self`, in [provisioner](/terraform/language/resources/provisioners/syntax) and
[connection](/terraform/language/resources/provisioners/connection) blocks.
-> **Note:** Local names are often referred to as _variables_ or
_temporary variables_ in their documentation. These are not [input
variables](/language/values/variables); they are just arbitrary names
variables](/terraform/language/values/variables); they are just arbitrary names
that temporarily represent a value.
The names in this section relate to top-level configuration blocks only.
If you use [`dynamic` blocks](/language/expressions/dynamic-blocks) to dynamically generate
If you use [`dynamic` blocks](/terraform/language/expressions/dynamic-blocks) to dynamically generate
resource-type-specific _nested_ blocks within `resource` and `data` blocks then
you'll refer to the key and value of each element differently. See the
`dynamic` blocks documentation for details.
@ -235,7 +235,7 @@ for use in references, as follows:
* The `id` attribute exported by this resource type can be read using the
same syntax, giving `aws_instance.example.id`.
* The arguments of the `ebs_block_device` nested blocks can be accessed using
a [splat expression](/language/expressions/splat). For example, to obtain a list of
a [splat expression](/terraform/language/expressions/splat). For example, to obtain a list of
all of the `device_name` values, use
`aws_instance.example.ebs_block_device[*].device_name`.
* The nested blocks in this particular resource type do not have any exported
@ -261,24 +261,24 @@ for use in references, as follows:
as `aws_instance.example.device["foo"].size`.
To obtain a map of values of a particular argument for _labelled_ nested
block types, use a [`for` expression](/language/expressions/for):
block types, use a [`for` expression](/terraform/language/expressions/for):
`{for k, device in aws_instance.example.device : k => device.size}`.
When a resource has the
[`count`](/language/meta-arguments/count)
[`count`](/terraform/language/meta-arguments/count)
argument set, the resource itself becomes a _list_ of instance objects rather than
a single object. In that case, access the attributes of the instances using
either [splat expressions](/language/expressions/splat) or index syntax:
either [splat expressions](/terraform/language/expressions/splat) or index syntax:
* `aws_instance.example[*].id` returns a list of all of the ids of each of the
instances.
* `aws_instance.example[0].id` returns just the id of the first instance.
When a resource has the
[`for_each`](/language/meta-arguments/for_each)
[`for_each`](/terraform/language/meta-arguments/for_each)
argument set, the resource itself becomes a _map_ of instance objects rather than
a single object, and attributes of instances must be specified by key, or can
be accessed using a [`for` expression](/language/expressions/for).
be accessed using a [`for` expression](/terraform/language/expressions/for).
* `aws_instance.example["a"].id` returns the id of the "a"-keyed resource.
* `[for value in aws_instance.example: value.id]` returns a list of all of the ids
@ -296,21 +296,21 @@ placeholder marker `(sensitive value)` instead of the actual value when renderin
a plan involving that attribute.
A provider attribute marked as sensitive behaves similarly to an
[an input variable declared as sensitive](/language/values/variables#suppressing-values-in-cli-output),
[an input variable declared as sensitive](/terraform/language/values/variables#suppressing-values-in-cli-output),
where Terraform will hide the value in the plan and apply messages and will
also hide any other values you derive from it as sensitive.
However, there are some limitations to that behavior as described in
[Cases where Terraform may disclose a sensitive variable](/language/values/variables#cases-where-terraform-may-disclose-a-sensitive-variable).
[Cases where Terraform may disclose a sensitive variable](/terraform/language/values/variables#cases-where-terraform-may-disclose-a-sensitive-variable).
If you use a sensitive value from a resource attribute as part of an
[output value](/language/values/outputs) then Terraform will require
[output value](/terraform/language/values/outputs) then Terraform will require
you to also mark the output value itself as sensitive, to confirm that you
intended to export it.
Terraform will still record sensitive values in the [state](/language/state),
Terraform will still record sensitive values in the [state](/terraform/language/state),
and so anyone who can access the state data will have access to the sensitive
values in cleartext. For more information, see
[_Sensitive Data in State_](/language/state/sensitive-data).
[_Sensitive Data in State_](/terraform/language/state/sensitive-data).
-> **Note:** Treating values derived from a sensitive resource attribute as
sensitive themselves was introduced in Terraform v0.15. Earlier versions of

View File

@ -7,7 +7,7 @@ description: >-
# Splat Expressions
> **Hands-on:** Try the [Create Dynamic Expressions](https://learn.hashicorp.com/tutorials/terraform/expressions?in=terraform/configuration-language&utm_source=WEBSITE&utm_medium=WEB_IO&utm_offer=ARTICLE_PAGE&utm_content=DOCS) tutorial.
> **Hands-on:** Try the [Create Dynamic Expressions](/terraform/tutorials/configuration-language/expressions?utm_source=WEBSITE&utm_medium=WEB_IO&utm_offer=ARTICLE_PAGE&utm_content=DOCS) tutorial.
A _splat expression_ provides a more concise way to express a common
operation that could otherwise be performed with a `for` expression.
@ -45,12 +45,12 @@ The above expression is equivalent to the following `for` expression:
The splat expression patterns shown above apply only to lists, sets, and
tuples. To get a similar result with a map or object value you must use
[`for` expressions](/language/expressions/for).
[`for` expressions](/terraform/language/expressions/for).
Resources that use the `for_each` argument will appear in expressions as a map
of objects, so you can't use splat expressions with those resources.
For more information, see
[Referring to Resource Instances](/language/meta-arguments/for_each#referring-to-instances).
[Referring to Resource Instances](/terraform/language/meta-arguments/for_each#referring-to-instances).
## Single Values as Lists
@ -87,7 +87,7 @@ resource "aws_s3_bucket" "example" {
}
```
The above example uses a [`dynamic` block](/language/expressions/dynamic-blocks), which
The above example uses a [`dynamic` block](/terraform/language/expressions/dynamic-blocks), which
generates zero or more nested blocks based on a collection value. The input
variable `var.website_setting` is defined as a single object that might be null,
so the `dynamic` block's `for_each` expression uses `[*]` to ensure that

View File

@ -77,8 +77,8 @@ allowed, but conventionally this identifier is in all-uppercase and begins with
### Generating JSON or YAML
Don't use "heredoc" strings to generate JSON or YAML. Instead, use
[the `jsonencode` function](/language/functions/jsonencode) or
[the `yamlencode` function](/language/functions/yamlencode) so that Terraform
[the `jsonencode` function](/terraform/language/functions/jsonencode) or
[the `yamlencode` function](/terraform/language/functions/yamlencode) so that Terraform
can be responsible for guaranteeing valid JSON or YAML syntax.
```hcl

View File

@ -25,9 +25,9 @@ function-like constructs called _type constructors._
represent a type; instead, it represents a _kind_ of similar types.
Type constraints look like other kinds of Terraform
[expressions](/language/expressions), but are a special syntax. Within the
[expressions](/terraform/language/expressions), but are a special syntax. Within the
Terraform language, they are only valid in the `type` argument of an
[input variable](/language/values/variables).
[input variable](/terraform/language/values/variables).
## Primitive Types
@ -152,7 +152,7 @@ like the following:
The Terraform language has literal expressions for creating tuple and object
values, which are described in
[Expressions: Literal Expressions](/language/expressions/types#literal-expressions) as
[Expressions: Literal Expressions](/terraform/language/expressions/types#literal-expressions) as
"list/tuple" literals and "map/object" literals, respectively.
Terraform does _not_ provide any way to directly represent lists, maps, or sets.

View File

@ -51,7 +51,7 @@ characters, `"like this"`. There is also a "heredoc" syntax for more complex
strings.
String literals are the most complex kind of literal expression in
Terraform, and have their own page of documentation. See [Strings](/language/expressions/strings)
Terraform, and have their own page of documentation. See [Strings](/terraform/language/expressions/strings)
for information about escape sequences, the heredoc syntax, interpolation, and
template directives.
@ -95,7 +95,7 @@ The values in a map
can be arbitrary expressions.
The keys in a map must be strings; they can be left unquoted if
they are a valid [identifier](/language/syntax/configuration#identifiers), but must be quoted
they are a valid [identifier](/terraform/language/syntax/configuration#identifiers), but must be quoted
otherwise. You can use a non-literal string expression as a key by wrapping it in
parentheses, like `(var.business_unit_tag_name) = "SRE"`.
@ -126,7 +126,7 @@ offer different ways to restrict the allowed values for input variables and
resource arguments.
For complete details about these types (and an explanation of why the difference
usually doesn't matter), see [Type Constraints](/language/expressions/type-constraints).
usually doesn't matter), see [Type Constraints](/terraform/language/expressions/type-constraints).
## Type Conversion

View File

@ -11,9 +11,9 @@ Anywhere that Terraform lets you specify a range of acceptable versions for
something, it expects a specially formatted string known as a version
constraint. Version constraints are used when configuring:
- [Modules](/language/modules)
- [Provider requirements](/language/providers/requirements)
- [The `required_version` setting](/language/settings#specifying-a-required-terraform-version) in the `terraform` block.
- [Modules](/terraform/language/modules)
- [Provider requirements](/terraform/language/providers/requirements)
- [The `required_version` setting](/terraform/language/settings#specifying-a-required-terraform-version) in the `terraform` block.
## Version Constraint Syntax
@ -24,7 +24,7 @@ other dependency management systems like Bundler and NPM.
version = ">= 1.2.0, < 2.0.0"
```
A version constraint is a [string literal](/language/expressions/strings)
A version constraint is a [string literal](/terraform/language/expressions/strings)
containing one or more conditions, which are separated by commas.
Each condition consists of an operator and a version number.

View File

@ -11,14 +11,14 @@ description: >-
versions of Terraform did not track dependency selections at all, so the
information here is not relevant to those versions.
> **Hands-on:** Try the [Lock and Upgrade Provider Versions](https://learn.hashicorp.com/tutorials/terraform/provider-versioning?in=terraform/configuration-language&utm_source=WEBSITE&utm_medium=WEB_IO&utm_offer=ARTICLE_PAGE&utm_content=DOCS) tutorial.
> **Hands-on:** Try the [Lock and Upgrade Provider Versions](/terraform/tutorials/configuration-language/provider-versioning?utm_source=WEBSITE&utm_medium=WEB_IO&utm_offer=ARTICLE_PAGE&utm_content=DOCS) tutorial.
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](/terraform/language/providers/requirements), which are plugins for Terraform
that extend it with support for interacting with various external systems.
- [Modules](/language/modules), which allow
- [Modules](/terraform/language/modules), which allow
splitting out groups of Terraform configuration constructs (written in the
Terraform language) into reusable abstractions.
@ -28,7 +28,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](/terraform/language/expressions/version-constraints) 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)
@ -53,7 +53,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](/terraform/cli/commands/init). 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.
@ -141,7 +141,7 @@ There are two special considerations with the "trust on first use" model:
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),
[the `terraform providers lock` command](/terraform/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.
@ -159,7 +159,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](/terraform/language/providers/requirements) 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
@ -306,7 +306,7 @@ The two hashing schemes currently supported are:
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),
[provider installation methods](/terraform/cli/config/config-file#provider-installation),
such as filesystem mirrors using the unpacked directory layout.
- `h1:`: a mnemonic for "hash scheme 1", which is the current preferred hashing
@ -347,7 +347,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](/terraform/cli/commands/providers/lock):
```
terraform providers lock \

View File

@ -11,7 +11,7 @@ description: >-
Code in the Terraform language is stored in plain text files with the `.tf` file
extension. There is also
[a JSON-based variant of the language](/language/syntax/json) that is named with
[a JSON-based variant of the language](/terraform/language/syntax/json) that is named with
the `.tf.json` file extension.
Files containing Terraform code are often called _configuration files._
@ -36,7 +36,7 @@ treating the entire module as a single document. Separating various blocks into
different files is purely for the convenience of readers and maintainers, and
has no effect on the module's behavior.
A Terraform module can use [module calls](/language/modules) to
A Terraform module can use [module calls](/terraform/language/modules) to
explicitly include other modules into the configuration. These child modules can
come from local directories (nested in the parent module's directory, or
anywhere else on disk), or from external sources like the

View File

@ -12,7 +12,7 @@ with the current working directory.
Referring directly to filesystem paths in resource arguments may cause
spurious diffs if the same configuration is applied from multiple systems or on
different host operating systems. We recommend using filesystem paths only
for transient values, such as the argument to [`file`](/language/functions/file) (where
for transient values, such as the argument to [`file`](/terraform/language/functions/file) (where
only the contents are then stored) or in `connection` and `provisioner` blocks.
## Examples

View File

@ -24,7 +24,7 @@ most cases. Various other functions with names containing "base64" can generate
or manipulate Base64 data directly.
`base64decode` is, in effect, a shorthand for calling
[`textdecodebase64`](/language/functions/textdecodebase64) with the encoding name set to
[`textdecodebase64`](/terraform/language/functions/textdecodebase64) with the encoding name set to
`UTF-8`.
## Examples
@ -36,11 +36,11 @@ Hello World
## Related Functions
* [`base64encode`](/language/functions/base64encode) performs the opposite operation,
* [`base64encode`](/terraform/language/functions/base64encode) performs the opposite operation,
encoding the UTF-8 bytes for a string as Base64.
* [`textdecodebase64`](/language/functions/textdecodebase64) is a more general function that
* [`textdecodebase64`](/terraform/language/functions/textdecodebase64) is a more general function that
supports character encodings other than UTF-8.
* [`base64gzip`](/language/functions/base64gzip) applies gzip compression to a string
* [`base64gzip`](/terraform/language/functions/base64gzip) applies gzip compression to a string
and returns the result with Base64 encoding.
* [`filebase64`](/language/functions/filebase64) reads a file from the local filesystem
* [`filebase64`](/terraform/language/functions/filebase64) reads a file from the local filesystem
and returns its raw bytes with Base64 encoding.

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