From e81c8496177fbdd51b8a152a77b58e1e89eff61c Mon Sep 17 00:00:00 2001 From: Ashlee Boyer Date: Fri, 3 Feb 2023 09:46:14 -0500 Subject: [PATCH 1/6] Adding docs-content-check-legacy-links-format workflow --- .github/workflows/check-legacy-links-format.yml | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 .github/workflows/check-legacy-links-format.yml diff --git a/.github/workflows/check-legacy-links-format.yml b/.github/workflows/check-legacy-links-format.yml new file mode 100644 index 0000000000..856551622a --- /dev/null +++ b/.github/workflows/check-legacy-links-format.yml @@ -0,0 +1,17 @@ +name: Legacy Link Format Checker + +on: + push: + paths: + - "website/docs/**/*.mdx" + - "website/data/*-nav-data.json" + +jobs: + check-links: + uses: hashicorp/dev-portal/.github/workflows/docs-content-check-legacy-links-format.yml@d7c2fceac2dc41e3f857f1ce7c344141fd6a13dd + with: + repo-owner: "hashicorp" + repo-name: "terraform" + commit-sha: ${{ github.sha }} + mdx-directory: "website/docs" + nav-data-directory: "website/data" From 534366d0ff96cce928bb17dbebe68bed28dcaf53 Mon Sep 17 00:00:00 2001 From: Ashlee Boyer Date: Fri, 3 Feb 2023 10:29:04 -0500 Subject: [PATCH 2/6] Adding test-link-rewrites workflow --- .github/workflows/test-link-rewrites.yml | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 .github/workflows/test-link-rewrites.yml diff --git a/.github/workflows/test-link-rewrites.yml b/.github/workflows/test-link-rewrites.yml new file mode 100644 index 0000000000..349b60fbaa --- /dev/null +++ b/.github/workflows/test-link-rewrites.yml @@ -0,0 +1,16 @@ +name: Test Link Rewrites + +on: [deployment_status] + +jobs: + test-link-rewrites: + if: github.event.deployment_status.state == 'success' + uses: hashicorp/dev-portal/.github/workflows/docs-content-link-rewrites-e2e.yml@2aceb60125f6c15f4c8dbe2e4d79148047bfa437 + with: + repo-owner: "hashicorp" + repo-name: "terraform" + commit-sha: ${{ github.sha }} + main-branch-preview-url: "https://terraform-lw0m5e91w-hashicorp.vercel.app/" + # Workflow is only intended to run for one single migration PR + # This variable does not need to be updated + pr-branch-preview-url: ${{ github.event.deployment_status.target_url }} From 55f11d07b9df82ee09c6752bc4091b7120ad18ed Mon Sep 17 00:00:00 2001 From: Ashlee Boyer Date: Thu, 23 Feb 2023 12:55:15 -0500 Subject: [PATCH 3/6] Adding comment for testing --- website/docs/cli/auth/index.mdx | 2 ++ 1 file changed, 2 insertions(+) diff --git a/website/docs/cli/auth/index.mdx b/website/docs/cli/auth/index.mdx index 58d30b2c1a..c9865fa896 100644 --- a/website/docs/cli/auth/index.mdx +++ b/website/docs/cli/auth/index.mdx @@ -5,6 +5,8 @@ description: >- an API token for your Terraform Cloud account. --- + + # CLI Authentication > **Hands-on:** Try the [Authenticate the CLI with Terraform Cloud](https://learn.hashicorp.com/tutorials/terraform/cloud-login?in=terraform/cloud&utm_source=WEBSITE&utm_medium=WEB_IO&utm_offer=ARTICLE_PAGE&utm_content=DOCS) tutorial. From c5d0bd40b9e44159dadaf9201d042fc207824763 Mon Sep 17 00:00:00 2001 From: Ashlee Boyer Date: Thu, 23 Feb 2023 12:55:35 -0500 Subject: [PATCH 4/6] Removing test comment --- website/docs/cli/auth/index.mdx | 2 -- 1 file changed, 2 deletions(-) diff --git a/website/docs/cli/auth/index.mdx b/website/docs/cli/auth/index.mdx index c9865fa896..58d30b2c1a 100644 --- a/website/docs/cli/auth/index.mdx +++ b/website/docs/cli/auth/index.mdx @@ -5,8 +5,6 @@ description: >- an API token for your Terraform Cloud account. --- - - # CLI Authentication > **Hands-on:** Try the [Authenticate the CLI with Terraform Cloud](https://learn.hashicorp.com/tutorials/terraform/cloud-login?in=terraform/cloud&utm_source=WEBSITE&utm_medium=WEB_IO&utm_offer=ARTICLE_PAGE&utm_content=DOCS) tutorial. From 32f7b8ebd00c1687b39c15b67fe416f7926a09b7 Mon Sep 17 00:00:00 2001 From: Ashlee Boyer Date: Thu, 23 Feb 2023 12:55:56 -0500 Subject: [PATCH 5/6] Migrating links to new format --- website/docs/cli/auth/index.mdx | 10 +-- website/docs/cli/cloud/index.mdx | 16 ++-- website/docs/cli/cloud/migrating.mdx | 10 +-- website/docs/cli/cloud/settings.mdx | 20 ++--- website/docs/cli/code/index.mdx | 16 ++-- website/docs/cli/commands/0.12upgrade.mdx | 8 +- website/docs/cli/commands/0.13upgrade.mdx | 4 +- website/docs/cli/commands/apply.mdx | 32 +++---- website/docs/cli/commands/console.mdx | 14 +-- website/docs/cli/commands/destroy.mdx | 4 +- website/docs/cli/commands/env.mdx | 2 +- website/docs/cli/commands/fmt.mdx | 2 +- website/docs/cli/commands/get.mdx | 2 +- website/docs/cli/commands/import.mdx | 26 +++--- website/docs/cli/commands/index.mdx | 10 +-- website/docs/cli/commands/init.mdx | 26 +++--- website/docs/cli/commands/login.mdx | 6 +- website/docs/cli/commands/logout.mdx | 2 +- website/docs/cli/commands/output.mdx | 4 +- website/docs/cli/commands/plan.mdx | 52 +++++------ website/docs/cli/commands/providers.mdx | 2 +- website/docs/cli/commands/providers/lock.mdx | 16 ++-- .../docs/cli/commands/providers/mirror.mdx | 4 +- .../docs/cli/commands/providers/schema.mdx | 2 +- website/docs/cli/commands/push.mdx | 2 +- website/docs/cli/commands/refresh.mdx | 10 +-- website/docs/cli/commands/show.mdx | 4 +- website/docs/cli/commands/state/index.mdx | 4 +- website/docs/cli/commands/state/list.mdx | 6 +- website/docs/cli/commands/state/mv.mdx | 24 ++--- website/docs/cli/commands/state/pull.mdx | 2 +- website/docs/cli/commands/state/push.mdx | 8 +- .../cli/commands/state/replace-provider.mdx | 10 +-- website/docs/cli/commands/state/rm.mdx | 18 ++-- website/docs/cli/commands/state/show.mdx | 12 +-- website/docs/cli/commands/taint.mdx | 12 +-- website/docs/cli/commands/test.mdx | 2 +- website/docs/cli/commands/untaint.mdx | 12 +-- website/docs/cli/commands/validate.mdx | 2 +- website/docs/cli/commands/version.mdx | 2 +- .../docs/cli/commands/workspace/delete.mdx | 2 +- website/docs/cli/commands/workspace/index.mdx | 2 +- website/docs/cli/config/config-file.mdx | 26 +++--- .../docs/cli/config/environment-variables.mdx | 16 ++-- website/docs/cli/config/index.mdx | 4 +- website/docs/cli/import/importability.mdx | 2 +- website/docs/cli/import/index.mdx | 6 +- website/docs/cli/import/usage.mdx | 8 +- website/docs/cli/index.mdx | 4 +- website/docs/cli/init/index.mdx | 6 +- website/docs/cli/inspect/index.mdx | 12 +-- website/docs/cli/install/apt.mdx | 4 +- website/docs/cli/install/yum.mdx | 4 +- website/docs/cli/plugins/index.mdx | 18 ++-- website/docs/cli/run/index.mdx | 12 +-- website/docs/cli/state/index.mdx | 14 +-- website/docs/cli/state/inspect.mdx | 6 +- website/docs/cli/state/move.mdx | 12 +-- website/docs/cli/state/recover.mdx | 6 +- website/docs/cli/state/taint.mdx | 6 +- website/docs/cli/workspaces/index.mdx | 24 ++--- website/docs/configuration/expressions.mdx | 18 ++-- website/docs/configuration/modules.mdx | 10 +-- website/docs/configuration/resources.mdx | 28 +++--- website/docs/internals/archiving.mdx | 2 +- .../docs/internals/credentials-helpers.mdx | 14 +-- website/docs/internals/debugging.mdx | 2 +- website/docs/internals/functions-meta.mdx | 2 +- website/docs/internals/graph.mdx | 4 +- website/docs/internals/json-format.mdx | 6 +- website/docs/internals/login-protocol.mdx | 6 +- .../docs/internals/machine-readable-ui.mdx | 8 +- .../internals/module-registry-protocol.mdx | 8 +- .../provider-network-mirror-protocol.mdx | 12 +-- .../internals/provider-registry-protocol.mdx | 6 +- .../internals/remote-service-discovery.mdx | 8 +- website/docs/intro/core-workflow.mdx | 4 +- website/docs/intro/index.mdx | 12 +-- website/docs/intro/terraform-editions.mdx | 18 ++-- website/docs/intro/use-cases.mdx | 30 +++---- website/docs/intro/vs/index.mdx | 8 +- website/docs/language/attr-as-blocks.mdx | 10 +-- website/docs/language/data-sources/index.mdx | 30 +++---- .../language/expressions/conditionals.mdx | 6 +- .../expressions/custom-conditions.mdx | 20 ++--- .../language/expressions/dynamic-blocks.mdx | 10 +-- website/docs/language/expressions/for.mdx | 4 +- .../language/expressions/function-calls.mdx | 20 ++--- website/docs/language/expressions/index.mdx | 28 +++--- .../docs/language/expressions/operators.mdx | 4 +- .../docs/language/expressions/references.mdx | 54 ++++++------ website/docs/language/expressions/splat.mdx | 8 +- website/docs/language/expressions/strings.mdx | 4 +- .../language/expressions/type-constraints.mdx | 6 +- website/docs/language/expressions/types.mdx | 6 +- .../expressions/version-constraints.mdx | 8 +- .../docs/language/files/dependency-lock.mdx | 18 ++-- website/docs/language/files/index.mdx | 4 +- website/docs/language/functions/abspath.mdx | 2 +- .../docs/language/functions/base64decode.mdx | 10 +-- .../docs/language/functions/base64encode.mdx | 10 +-- .../docs/language/functions/base64gzip.mdx | 4 +- .../docs/language/functions/base64sha256.mdx | 4 +- .../docs/language/functions/base64sha512.mdx | 4 +- website/docs/language/functions/basename.mdx | 4 +- website/docs/language/functions/can.mdx | 8 +- website/docs/language/functions/ceil.mdx | 2 +- website/docs/language/functions/chomp.mdx | 2 +- website/docs/language/functions/cidrhost.mdx | 4 +- .../docs/language/functions/cidrsubnet.mdx | 12 +-- .../docs/language/functions/cidrsubnets.mdx | 10 +-- website/docs/language/functions/coalesce.mdx | 2 +- .../docs/language/functions/coalescelist.mdx | 2 +- website/docs/language/functions/csvdecode.mdx | 4 +- website/docs/language/functions/dirname.mdx | 4 +- website/docs/language/functions/element.mdx | 6 +- website/docs/language/functions/endswith.mdx | 2 +- website/docs/language/functions/file.mdx | 6 +- .../docs/language/functions/filebase64.mdx | 4 +- .../language/functions/filebase64sha256.mdx | 4 +- .../language/functions/filebase64sha512.mdx | 4 +- .../docs/language/functions/fileexists.mdx | 2 +- website/docs/language/functions/filemd5.mdx | 4 +- website/docs/language/functions/fileset.mdx | 2 +- website/docs/language/functions/filesha1.mdx | 4 +- .../docs/language/functions/filesha256.mdx | 4 +- .../docs/language/functions/filesha512.mdx | 4 +- website/docs/language/functions/flatten.mdx | 6 +- website/docs/language/functions/floor.mdx | 2 +- website/docs/language/functions/format.mdx | 6 +- .../docs/language/functions/formatdate.mdx | 4 +- .../docs/language/functions/formatlist.mdx | 4 +- website/docs/language/functions/index.mdx | 6 +- .../language/functions/index_function.mdx | 2 +- website/docs/language/functions/join.mdx | 2 +- .../docs/language/functions/jsondecode.mdx | 4 +- .../docs/language/functions/jsonencode.mdx | 4 +- website/docs/language/functions/keys.mdx | 2 +- website/docs/language/functions/list.mdx | 6 +- website/docs/language/functions/lookup.mdx | 2 +- website/docs/language/functions/lower.mdx | 4 +- website/docs/language/functions/map.mdx | 6 +- website/docs/language/functions/max.mdx | 2 +- website/docs/language/functions/md5.mdx | 2 +- website/docs/language/functions/merge.mdx | 2 +- website/docs/language/functions/min.mdx | 2 +- website/docs/language/functions/one.mdx | 2 +- website/docs/language/functions/parseint.mdx | 2 +- website/docs/language/functions/regex.mdx | 6 +- website/docs/language/functions/regexall.mdx | 4 +- website/docs/language/functions/replace.mdx | 4 +- website/docs/language/functions/reverse.mdx | 2 +- website/docs/language/functions/sensitive.mdx | 2 +- .../language/functions/setintersection.mdx | 8 +- .../docs/language/functions/setproduct.mdx | 14 +-- .../docs/language/functions/setsubtract.mdx | 6 +- website/docs/language/functions/setunion.mdx | 8 +- website/docs/language/functions/sha1.mdx | 2 +- website/docs/language/functions/sha256.mdx | 4 +- website/docs/language/functions/sha512.mdx | 4 +- website/docs/language/functions/slice.mdx | 2 +- website/docs/language/functions/split.mdx | 2 +- .../docs/language/functions/startswith.mdx | 2 +- website/docs/language/functions/strrev.mdx | 2 +- .../docs/language/functions/templatefile.mdx | 16 ++-- .../language/functions/textdecodebase64.mdx | 6 +- .../language/functions/textencodebase64.mdx | 8 +- website/docs/language/functions/timeadd.mdx | 2 +- website/docs/language/functions/timecmp.mdx | 6 +- website/docs/language/functions/timestamp.mdx | 4 +- website/docs/language/functions/title.mdx | 4 +- website/docs/language/functions/trim.mdx | 6 +- .../docs/language/functions/trimprefix.mdx | 6 +- website/docs/language/functions/trimspace.mdx | 2 +- .../docs/language/functions/trimsuffix.mdx | 6 +- website/docs/language/functions/try.mdx | 2 +- website/docs/language/functions/upper.mdx | 4 +- website/docs/language/functions/uuid.mdx | 6 +- website/docs/language/functions/uuidv5.mdx | 4 +- website/docs/language/functions/values.mdx | 4 +- .../docs/language/functions/yamldecode.mdx | 6 +- .../docs/language/functions/yamlencode.mdx | 10 +-- website/docs/language/index.mdx | 8 +- .../docs/language/meta-arguments/count.mdx | 10 +-- .../language/meta-arguments/depends_on.mdx | 4 +- .../docs/language/meta-arguments/for_each.mdx | 28 +++--- .../language/meta-arguments/lifecycle.mdx | 8 +- .../meta-arguments/module-providers.mdx | 8 +- .../meta-arguments/resource-provider.mdx | 4 +- .../language/modules/develop/composition.mdx | 6 +- .../docs/language/modules/develop/index.mdx | 24 ++--- .../language/modules/develop/providers.mdx | 14 +-- .../docs/language/modules/develop/publish.mdx | 10 +-- .../language/modules/develop/refactoring.mdx | 10 +-- .../language/modules/develop/structure.mdx | 6 +- website/docs/language/modules/index.mdx | 18 ++-- website/docs/language/modules/sources.mdx | 20 ++--- website/docs/language/modules/syntax.mdx | 30 +++---- .../docs/language/providers/configuration.mdx | 18 ++-- website/docs/language/providers/index.mdx | 26 +++--- .../docs/language/providers/requirements.mdx | 24 ++--- website/docs/language/resources/behavior.mdx | 14 +-- website/docs/language/resources/index.mdx | 18 ++-- .../resources/provisioners/connection.mdx | 10 +-- .../language/resources/provisioners/file.mdx | 4 +- .../resources/provisioners/local-exec.mdx | 6 +- .../resources/provisioners/null_resource.mdx | 8 +- .../resources/provisioners/remote-exec.mdx | 10 +-- .../resources/provisioners/syntax.mdx | 14 +-- website/docs/language/resources/syntax.mdx | 28 +++--- .../language/resources/terraform-data.mdx | 6 +- .../language/settings/backends/azurerm.mdx | 4 +- .../settings/backends/configuration.mdx | 22 ++--- .../language/settings/backends/consul.mdx | 6 +- .../docs/language/settings/backends/cos.mdx | 6 +- .../docs/language/settings/backends/gcs.mdx | 6 +- .../docs/language/settings/backends/http.mdx | 4 +- .../language/settings/backends/kubernetes.mdx | 6 +- .../docs/language/settings/backends/local.mdx | 4 +- .../docs/language/settings/backends/oss.mdx | 6 +- .../docs/language/settings/backends/pg.mdx | 12 +-- .../language/settings/backends/remote.mdx | 22 ++--- .../docs/language/settings/backends/s3.mdx | 14 +-- website/docs/language/settings/index.mdx | 20 ++--- .../language/settings/terraform-cloud.mdx | 8 +- website/docs/language/state/backends.mdx | 8 +- website/docs/language/state/import.mdx | 2 +- website/docs/language/state/index.mdx | 10 +-- website/docs/language/state/locking.mdx | 6 +- website/docs/language/state/purpose.mdx | 2 +- .../docs/language/state/remote-state-data.mdx | 18 ++-- website/docs/language/state/remote.mdx | 8 +- .../docs/language/state/sensitive-data.mdx | 4 +- website/docs/language/state/workspaces.mdx | 28 +++--- .../docs/language/syntax/configuration.mdx | 4 +- website/docs/language/syntax/index.mdx | 8 +- website/docs/language/syntax/json.mdx | 8 +- website/docs/language/syntax/style.mdx | 2 +- .../language/v1-compatibility-promises.mdx | 88 +++++++++---------- website/docs/language/values/index.mdx | 6 +- website/docs/language/values/locals.mdx | 10 +-- website/docs/language/values/outputs.mdx | 18 ++-- website/docs/language/values/variables.mdx | 48 +++++----- 243 files changed, 1126 insertions(+), 1126 deletions(-) diff --git a/website/docs/cli/auth/index.mdx b/website/docs/cli/auth/index.mdx index 58d30b2c1a..f283418fc0 100644 --- a/website/docs/cli/auth/index.mdx +++ b/website/docs/cli/auth/index.mdx @@ -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) diff --git a/website/docs/cli/cloud/index.mdx b/website/docs/cli/cloud/index.mdx index c688079a3e..4a8212c077 100644 --- a/website/docs/cli/cloud/index.mdx +++ b/website/docs/cli/cloud/index.mdx @@ -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. diff --git a/website/docs/cli/cloud/migrating.mdx b/website/docs/cli/cloud/migrating.mdx index e30f155e44..f66f0c6da3 100644 --- a/website/docs/cli/cloud/migrating.mdx +++ b/website/docs/cli/cloud/migrating.mdx @@ -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 `--` (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 diff --git a/website/docs/cli/cloud/settings.mdx b/website/docs/cli/cloud/settings.mdx index 0735402280..3782919e9d 100644 --- a/website/docs/cli/cloud/settings.mdx +++ b/website/docs/cli/cloud/settings.mdx @@ -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 diff --git a/website/docs/cli/code/index.mdx b/website/docs/cli/code/index.mdx index ec06e20abe..714f94227e 100644 --- a/website/docs/cli/code/index.mdx +++ b/website/docs/cli/code/index.mdx @@ -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. diff --git a/website/docs/cli/commands/0.12upgrade.mdx b/website/docs/cli/commands/0.12upgrade.mdx index 0a97ccb74c..eb4acc2a2a 100644 --- a/website/docs/cli/commands/0.12upgrade.mdx +++ b/website/docs/cli/commands/0.12upgrade.mdx @@ -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: diff --git a/website/docs/cli/commands/0.13upgrade.mdx b/website/docs/cli/commands/0.13upgrade.mdx index c600bcb75a..51c5f45150 100644 --- a/website/docs/cli/commands/0.13upgrade.mdx +++ b/website/docs/cli/commands/0.13upgrade.mdx @@ -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. diff --git a/website/docs/cli/commands/apply.mdx b/website/docs/cli/commands/apply.mdx index ad4ab10ff7..641b09eba0 100644 --- a/website/docs/cli/commands/apply.mdx +++ b/website/docs/cli/commands/apply.mdx @@ -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. diff --git a/website/docs/cli/commands/console.mdx b/website/docs/cli/commands/console.mdx index 40e3b5e6fd..ca8a0bae20 100644 --- a/website/docs/cli/commands/console.mdx +++ b/website/docs/cli/commands/console.mdx @@ -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. diff --git a/website/docs/cli/commands/destroy.mdx b/website/docs/cli/commands/destroy.mdx index beb9782ebf..a0d8713dab 100644 --- a/website/docs/cli/commands/destroy.mdx +++ b/website/docs/cli/commands/destroy.mdx @@ -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 diff --git a/website/docs/cli/commands/env.mdx b/website/docs/cli/commands/env.mdx index 611354068a..bb98c9fd15 100644 --- a/website/docs/cli/commands/env.mdx +++ b/website/docs/cli/commands/env.mdx @@ -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. diff --git a/website/docs/cli/commands/fmt.mdx b/website/docs/cli/commands/fmt.mdx index ef03d40193..f74276c9a0 100644 --- a/website/docs/cli/commands/fmt.mdx +++ b/website/docs/cli/commands/fmt.mdx @@ -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 diff --git a/website/docs/cli/commands/get.mdx b/website/docs/cli/commands/get.mdx index bf9b9f9705..a12dd87d12 100644 --- a/website/docs/cli/commands/get.mdx +++ b/website/docs/cli/commands/get.mdx @@ -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 diff --git a/website/docs/cli/commands/import.mdx b/website/docs/cli/commands/import.mdx index 6100d433ab..f9ffd3de77 100644 --- a/website/docs/cli/commands/import.mdx +++ b/website/docs/cli/commands/import.mdx @@ -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: diff --git a/website/docs/cli/commands/index.mdx b/website/docs/cli/commands/index.mdx index 88675220cc..5d6126c6c8 100644 --- a/website/docs/cli/commands/index.mdx +++ b/website/docs/cli/commands/index.mdx @@ -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: diff --git a/website/docs/cli/commands/init.mdx b/website/docs/cli/commands/init.mdx index 52119fd77e..4fe045a1fb 100644 --- a/website/docs/cli/commands/init.mdx +++ b/website/docs/cli/commands/init.mdx @@ -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. diff --git a/website/docs/cli/commands/login.mdx b/website/docs/cli/commands/login.mdx index 86e1fcfee9..96f4e35ea4 100644 --- a/website/docs/cli/commands/login.mdx +++ b/website/docs/cli/commands/login.mdx @@ -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. diff --git a/website/docs/cli/commands/logout.mdx b/website/docs/cli/commands/logout.mdx index dbec4bc757..cc1a88817d 100644 --- a/website/docs/cli/commands/logout.mdx +++ b/website/docs/cli/commands/logout.mdx @@ -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. diff --git a/website/docs/cli/commands/output.mdx b/website/docs/cli/commands/output.mdx index 39ef516cd2..8c4a5fdb77 100644 --- a/website/docs/cli/commands/output.mdx +++ b/website/docs/cli/commands/output.mdx @@ -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 diff --git a/website/docs/cli/commands/plan.mdx b/website/docs/cli/commands/plan.mdx index 77bddf3c40..3b8ee9fbfb 100644 --- a/website/docs/cli/commands/plan.mdx +++ b/website/docs/cli/commands/plan.mdx @@ -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. diff --git a/website/docs/cli/commands/providers.mdx b/website/docs/cli/commands/providers.mdx index 6aeee156ba..3222d8f637 100644 --- a/website/docs/cli/commands/providers.mdx +++ b/website/docs/cli/commands/providers.mdx @@ -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. diff --git a/website/docs/cli/commands/providers/lock.mdx b/website/docs/cli/commands/providers/lock.mdx index 9a6de3ff9d..c75455fd96 100644 --- a/website/docs/cli/commands/providers/lock.mdx +++ b/website/docs/cli/commands/providers/lock.mdx @@ -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). diff --git a/website/docs/cli/commands/providers/mirror.mdx b/website/docs/cli/commands/providers/mirror.mdx index d6f9c8c8c8..129c55a658 100644 --- a/website/docs/cli/commands/providers/mirror.mdx +++ b/website/docs/cli/commands/providers/mirror.mdx @@ -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. diff --git a/website/docs/cli/commands/providers/schema.mdx b/website/docs/cli/commands/providers/schema.mdx index 868f210c0d..3b2490037b 100644 --- a/website/docs/cli/commands/providers/schema.mdx +++ b/website/docs/cli/commands/providers/schema.mdx @@ -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 diff --git a/website/docs/cli/commands/push.mdx b/website/docs/cli/commands/push.mdx index 0e15e1590a..4bbff18d59 100644 --- a/website/docs/cli/commands/push.mdx +++ b/website/docs/cli/commands/push.mdx @@ -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. diff --git a/website/docs/cli/commands/refresh.mdx b/website/docs/cli/commands/refresh.mdx index 8532fd0289..d44f4f1abf 100644 --- a/website/docs/cli/commands/refresh.mdx +++ b/website/docs/cli/commands/refresh.mdx @@ -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. diff --git a/website/docs/cli/commands/show.mdx b/website/docs/cli/commands/show.mdx index f956db19ba..cbde69f54e 100644 --- a/website/docs/cli/commands/show.mdx +++ b/website/docs/cli/commands/show.mdx @@ -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 diff --git a/website/docs/cli/commands/state/index.mdx b/website/docs/cli/commands/state/index.mdx index 7b2f10ac8a..0d5a46be8c 100644 --- a/website/docs/cli/commands/state/index.mdx +++ b/website/docs/cli/commands/state/index.mdx @@ -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 diff --git a/website/docs/cli/commands/state/list.mdx b/website/docs/cli/commands/state/list.mdx index 7bf09baa4f..8471fbe89a 100644 --- a/website/docs/cli/commands/state/list.mdx +++ b/website/docs/cli/commands/state/list.mdx @@ -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 diff --git a/website/docs/cli/commands/state/mv.mdx b/website/docs/cli/commands/state/mv.mdx index ed2159b145..4c124bfea9 100644 --- a/website/docs/cli/commands/state/mv.mdx +++ b/website/docs/cli/commands/state/mv.mdx @@ -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. diff --git a/website/docs/cli/commands/state/pull.mdx b/website/docs/cli/commands/state/pull.mdx index 15c372e81a..115b5c6c3f 100644 --- a/website/docs/cli/commands/state/pull.mdx +++ b/website/docs/cli/commands/state/pull.mdx @@ -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 diff --git a/website/docs/cli/commands/state/push.mdx b/website/docs/cli/commands/state/push.mdx index 2aa994527c..2372c5a713 100644 --- a/website/docs/cli/commands/state/push.mdx +++ b/website/docs/cli/commands/state/push.mdx @@ -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). diff --git a/website/docs/cli/commands/state/replace-provider.mdx b/website/docs/cli/commands/state/replace-provider.mdx index 9f8ce089d7..1c6360119f 100644 --- a/website/docs/cli/commands/state/replace-provider.mdx +++ b/website/docs/cli/commands/state/replace-provider.mdx @@ -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 diff --git a/website/docs/cli/commands/state/rm.mdx b/website/docs/cli/commands/state/rm.mdx index e7031865d4..7391f9abb0 100644 --- a/website/docs/cli/commands/state/rm.mdx +++ b/website/docs/cli/commands/state/rm.mdx @@ -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. diff --git a/website/docs/cli/commands/state/show.mdx b/website/docs/cli/commands/state/show.mdx index 8e2fd84e1d..b646362003 100644 --- a/website/docs/cli/commands/state/show.mdx +++ b/website/docs/cli/commands/state/show.mdx @@ -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: diff --git a/website/docs/cli/commands/taint.mdx b/website/docs/cli/commands/taint.mdx index a9bca25706..c96a43713a 100644 --- a/website/docs/cli/commands/taint.mdx +++ b/website/docs/cli/commands/taint.mdx @@ -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]
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). diff --git a/website/docs/cli/commands/test.mdx b/website/docs/cli/commands/test.mdx index 282c217105..57f9e9dc02 100644 --- a/website/docs/cli/commands/test.mdx +++ b/website/docs/cli/commands/test.mdx @@ -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 diff --git a/website/docs/cli/commands/untaint.mdx b/website/docs/cli/commands/untaint.mdx index 7d247638ea..98fb32a2d5 100644 --- a/website/docs/cli/commands/untaint.mdx +++ b/website/docs/cli/commands/untaint.mdx @@ -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). diff --git a/website/docs/cli/commands/validate.mdx b/website/docs/cli/commands/validate.mdx index 54e53ec478..1ae22f36b1 100644 --- a/website/docs/cli/commands/validate.mdx +++ b/website/docs/cli/commands/validate.mdx @@ -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: diff --git a/website/docs/cli/commands/version.mdx b/website/docs/cli/commands/version.mdx index bcfa5f0b76..378ec3ae79 100644 --- a/website/docs/cli/commands/version.mdx +++ b/website/docs/cli/commands/version.mdx @@ -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: diff --git a/website/docs/cli/commands/workspace/delete.mdx b/website/docs/cli/commands/workspace/delete.mdx index e75e804a91..8475440c61 100644 --- a/website/docs/cli/commands/workspace/delete.mdx +++ b/website/docs/cli/commands/workspace/delete.mdx @@ -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 diff --git a/website/docs/cli/commands/workspace/index.mdx b/website/docs/cli/commands/workspace/index.mdx index 6128a736ed..d3a9798f6d 100644 --- a/website/docs/cli/commands/workspace/index.mdx +++ b/website/docs/cli/commands/workspace/index.mdx @@ -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. diff --git a/website/docs/cli/config/config-file.mdx b/website/docs/cli/config/config-file.mdx index b6820ef85a..accdc465fc 100644 --- a/website/docs/cli/config/config-file.mdx +++ b/website/docs/cli/config/config-file.mdx @@ -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 diff --git a/website/docs/cli/config/environment-variables.mdx b/website/docs/cli/config/environment-variables.mdx index f03b4f6335..807c5349e5 100644 --- a/website/docs/cli/config/environment-variables.mdx +++ b/website/docs/cli/config/environment-variables.mdx @@ -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. diff --git a/website/docs/cli/config/index.mdx b/website/docs/cli/config/index.mdx index 188e7ad614..77022d1335 100644 --- a/website/docs/cli/config/index.mdx +++ b/website/docs/cli/config/index.mdx @@ -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. diff --git a/website/docs/cli/import/importability.mdx b/website/docs/cli/import/importability.mdx index 00d1bc800b..fdc3fe91c0 100644 --- a/website/docs/cli/import/importability.mdx +++ b/website/docs/cli/import/importability.mdx @@ -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). diff --git a/website/docs/cli/import/index.mdx b/website/docs/cli/import/index.mdx index 274cbd7463..858f2755ff 100644 --- a/website/docs/cli/import/index.mdx +++ b/website/docs/cli/import/index.mdx @@ -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. diff --git a/website/docs/cli/import/usage.mdx b/website/docs/cli/import/usage.mdx index daf8056a95..f5d95be0f6 100644 --- a/website/docs/cli/import/usage.mdx +++ b/website/docs/cli/import/usage.mdx @@ -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. diff --git a/website/docs/cli/index.mdx b/website/docs/cli/index.mdx index 84226d0ab4..d9e5bb8288 100644 --- a/website/docs/cli/index.mdx +++ b/website/docs/cli/index.mdx @@ -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). diff --git a/website/docs/cli/init/index.mdx b/website/docs/cli/init/index.mdx index 133527e971..5b763eb9da 100644 --- a/website/docs/cli/init/index.mdx +++ b/website/docs/cli/init/index.mdx @@ -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 diff --git a/website/docs/cli/inspect/index.mdx b/website/docs/cli/inspect/index.mdx index 2337764dea..113594c58a 100644 --- a/website/docs/cli/inspect/index.mdx +++ b/website/docs/cli/inspect/index.mdx @@ -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. diff --git a/website/docs/cli/install/apt.mdx b/website/docs/cli/install/apt.mdx index 126c912a67..f5323c2c78 100644 --- a/website/docs/cli/install/apt.mdx +++ b/website/docs/cli/install/apt.mdx @@ -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 diff --git a/website/docs/cli/install/yum.mdx b/website/docs/cli/install/yum.mdx index f99293440a..b6b4b80970 100644 --- a/website/docs/cli/install/yum.mdx +++ b/website/docs/cli/install/yum.mdx @@ -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 diff --git a/website/docs/cli/plugins/index.mdx b/website/docs/cli/plugins/index.mdx index 71cde15c59..97f6182422 100644 --- a/website/docs/cli/plugins/index.mdx +++ b/website/docs/cli/plugins/index.mdx @@ -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. diff --git a/website/docs/cli/run/index.mdx b/website/docs/cli/run/index.mdx index 0ce5238200..3fc3538f98 100644 --- a/website/docs/cli/run/index.mdx +++ b/website/docs/cli/run/index.mdx @@ -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). diff --git a/website/docs/cli/state/index.mdx b/website/docs/cli/state/index.mdx index be98b2832d..b5d39bd528 100644 --- a/website/docs/cli/state/index.mdx +++ b/website/docs/cli/state/index.mdx @@ -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 diff --git a/website/docs/cli/state/inspect.mdx b/website/docs/cli/state/inspect.mdx index 54767bb834..439a0646f8 100644 --- a/website/docs/cli/state/inspect.mdx +++ b/website/docs/cli/state/inspect.mdx @@ -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. diff --git a/website/docs/cli/state/move.mdx b/website/docs/cli/state/move.mdx index 9e3f5946d7..326cd9f8fc 100644 --- a/website/docs/cli/state/move.mdx +++ b/website/docs/cli/state/move.mdx @@ -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. diff --git a/website/docs/cli/state/recover.mdx b/website/docs/cli/state/recover.mdx index f3b124cb2d..0e95f95426 100644 --- a/website/docs/cli/state/recover.mdx +++ b/website/docs/cli/state/recover.mdx @@ -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. diff --git a/website/docs/cli/state/taint.mdx b/website/docs/cli/state/taint.mdx index c4c46ca2f0..475d7e6186 100644 --- a/website/docs/cli/state/taint.mdx +++ b/website/docs/cli/state/taint.mdx @@ -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. diff --git a/website/docs/cli/workspaces/index.mdx b/website/docs/cli/workspaces/index.mdx index bfd05e6bcd..700733df14 100644 --- a/website/docs/cli/workspaces/index.mdx +++ b/website/docs/cli/workspaces/index.mdx @@ -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. diff --git a/website/docs/configuration/expressions.mdx b/website/docs/configuration/expressions.mdx index f9ac614688..96966de774 100644 --- a/website/docs/configuration/expressions.mdx +++ b/website/docs/configuration/expressions.mdx @@ -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).
@@ -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).
@@ -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).
@@ -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).
@@ -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).
@@ -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).
@@ -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).
@@ -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).
@@ -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).
diff --git a/website/docs/configuration/modules.mdx b/website/docs/configuration/modules.mdx index b6a0adeed5..de91ee4c60 100644 --- a/website/docs/configuration/modules.mdx +++ b/website/docs/configuration/modules.mdx @@ -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).
@@ -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).
@@ -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).
diff --git a/website/docs/configuration/resources.mdx b/website/docs/configuration/resources.mdx index 75ed7ec98f..87f1495355 100644 --- a/website/docs/configuration/resources.mdx +++ b/website/docs/configuration/resources.mdx @@ -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).
@@ -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).
@@ -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)
@@ -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).
@@ -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).
@@ -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).
@@ -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).
@@ -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).
@@ -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).
diff --git a/website/docs/internals/archiving.mdx b/website/docs/internals/archiving.mdx index 15c5f9905d..f2caa0634d 100644 --- a/website/docs/internals/archiving.mdx +++ b/website/docs/internals/archiving.mdx @@ -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 __. +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 __. diff --git a/website/docs/internals/credentials-helpers.mdx b/website/docs/internals/credentials-helpers.mdx index dbdbc58edc..485960b052 100644 --- a/website/docs/internals/credentials-helpers.mdx +++ b/website/docs/internals/credentials-helpers.mdx @@ -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, diff --git a/website/docs/internals/debugging.mdx b/website/docs/internals/debugging.mdx index df4412ade4..fddcfe5439 100644 --- a/website/docs/internals/debugging.mdx +++ b/website/docs/internals/debugging.mdx @@ -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`. diff --git a/website/docs/internals/functions-meta.mdx b/website/docs/internals/functions-meta.mdx index 1f96ebde43..734a341d25 100644 --- a/website/docs/internals/functions-meta.mdx +++ b/website/docs/internals/functions-meta.mdx @@ -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 diff --git a/website/docs/internals/graph.mdx b/website/docs/internals/graph.mdx index 0f9c3f2795..77b99a7f6d 100644 --- a/website/docs/internals/graph.mdx +++ b/website/docs/internals/graph.mdx @@ -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 diff --git a/website/docs/internals/json-format.mdx b/website/docs/internals/json-format.mdx index 5598b4106b..822a9b757d 100644 --- a/website/docs/internals/json-format.mdx +++ b/website/docs/internals/json-format.mdx @@ -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 ` 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 ` 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 ``: } ``` -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. diff --git a/website/docs/internals/login-protocol.mdx b/website/docs/internals/login-protocol.mdx index d6df65fba3..c0406a4c3e 100644 --- a/website/docs/internals/login-protocol.mdx +++ b/website/docs/internals/login-protocol.mdx @@ -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: diff --git a/website/docs/internals/machine-readable-ui.mdx b/website/docs/internals/machine-readable-ui.mdx index 0b1e85a2dc..86088c5f31 100644 --- a/website/docs/internals/machine-readable-ui.mdx +++ b/website/docs/internals/machine-readable-ui.mdx @@ -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 diff --git a/website/docs/internals/module-registry-protocol.mdx b/website/docs/internals/module-registry-protocol.mdx index 4e0fbff087..8edd97b084 100644 --- a/website/docs/internals/module-registry-protocol.mdx +++ b/website/docs/internals/module-registry-protocol.mdx @@ -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). diff --git a/website/docs/internals/provider-network-mirror-protocol.mdx b/website/docs/internals/provider-network-mirror-protocol.mdx index 23dac8afeb..89ea265262 100644 --- a/website/docs/internals/provider-network-mirror-protocol.mdx +++ b/website/docs/internals/provider-network-mirror-protocol.mdx @@ -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. diff --git a/website/docs/internals/provider-registry-protocol.mdx b/website/docs/internals/provider-registry-protocol.mdx index 70ddab5020..e344d88e7f 100644 --- a/website/docs/internals/provider-registry-protocol.mdx +++ b/website/docs/internals/provider-registry-protocol.mdx @@ -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`. diff --git a/website/docs/internals/remote-service-discovery.mdx b/website/docs/internals/remote-service-discovery.mdx index 1a652106e1..04c2a98478 100644 --- a/website/docs/internals/remote-service-discovery.mdx +++ b/website/docs/internals/remote-service-discovery.mdx @@ -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. diff --git a/website/docs/intro/core-workflow.mdx b/website/docs/intro/core-workflow.mdx index e73cb326d2..0e675ded0d 100644 --- a/website/docs/intro/core-workflow.mdx +++ b/website/docs/intro/core-workflow.mdx @@ -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 { diff --git a/website/docs/intro/index.mdx b/website/docs/intro/index.mdx index afdd9d445c..367115ae8d 100644 --- a/website/docs/intro/index.mdx +++ b/website/docs/intro/index.mdx @@ -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 diff --git a/website/docs/intro/terraform-editions.mdx b/website/docs/intro/terraform-editions.mdx index 9a77c5ad59..1ea69e606f 100644 --- a/website/docs/intro/terraform-editions.mdx +++ b/website/docs/intro/terraform-editions.mdx @@ -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 diff --git a/website/docs/intro/use-cases.mdx b/website/docs/intro/use-cases.mdx index bce26ed0f7..5ff9a52430 100644 --- a/website/docs/intro/use-cases.mdx +++ b/website/docs/intro/use-cases.mdx @@ -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 application’s lifecycle with Terraform. +Try the [Deploy, Manage, and Scale an Application on Heroku](/terraform/tutorials/applications/heroku-provider) tutorial to manage an application’s 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 diff --git a/website/docs/intro/vs/index.mdx b/website/docs/intro/vs/index.mdx index 6d5bec374f..0a809d77f3 100644 --- a/website/docs/intro/vs/index.mdx +++ b/website/docs/intro/vs/index.mdx @@ -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) diff --git a/website/docs/language/attr-as-blocks.mdx b/website/docs/language/attr-as-blocks.mdx index 211ce936c9..86b53ebe60 100644 --- a/website/docs/language/attr-as-blocks.mdx +++ b/website/docs/language/attr-as-blocks.mdx @@ -23,14 +23,14 @@ is set to an empty list (` = []`). 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 diff --git a/website/docs/language/data-sources/index.mdx b/website/docs/language/data-sources/index.mdx index 02ea3c0dcf..478b10bb20 100644 --- a/website/docs/language/data-sources/index.mdx +++ b/website/docs/language/data-sources/index.mdx @@ -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 diff --git a/website/docs/language/expressions/conditionals.mdx b/website/docs/language/expressions/conditionals.mdx index 58a6cf21b2..847216c233 100644 --- a/website/docs/language/expressions/conditionals.mdx +++ b/website/docs/language/expressions/conditionals.mdx @@ -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 diff --git a/website/docs/language/expressions/custom-conditions.mdx b/website/docs/language/expressions/custom-conditions.mdx index 73d6daca90..dce08ed742 100644 --- a/website/docs/language/expressions/custom-conditions.mdx +++ b/website/docs/language/expressions/custom-conditions.mdx @@ -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 workspace’s 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 workspace’s 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. diff --git a/website/docs/language/expressions/dynamic-blocks.mdx b/website/docs/language/expressions/dynamic-blocks.mdx index 0ab3e3f595..dbcc3ab1e9 100644 --- a/website/docs/language/expressions/dynamic-blocks.mdx +++ b/website/docs/language/expressions/dynamic-blocks.mdx @@ -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). diff --git a/website/docs/language/expressions/for.mdx b/website/docs/language/expressions/for.mdx index 1be9eeff74..334b3a8872 100644 --- a/website/docs/language/expressions/for.mdx +++ b/website/docs/language/expressions/for.mdx @@ -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). diff --git a/website/docs/language/expressions/function-calls.mdx b/website/docs/language/expressions/function-calls.mdx index a590b6e87c..b12f667413 100644 --- a/website/docs/language/expressions/function-calls.mdx +++ b/website/docs/language/expressions/function-calls.mdx @@ -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 diff --git a/website/docs/language/expressions/index.mdx b/website/docs/language/expressions/index.mdx index b2b28f5214..8817589cd8 100644 --- a/website/docs/language/expressions/index.mdx +++ b/website/docs/language/expressions/index.mdx @@ -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 ` ? : ` 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. diff --git a/website/docs/language/expressions/operators.mdx b/website/docs/language/expressions/operators.mdx index cb177e8cff..a05a1cbe77 100644 --- a/website/docs/language/expressions/operators.mdx +++ b/website/docs/language/expressions/operators.mdx @@ -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 diff --git a/website/docs/language/expressions/references.mdx b/website/docs/language/expressions/references.mdx index ad41ca0959..f6b6fc7b51 100644 --- a/website/docs/language/expressions/references.mdx +++ b/website/docs/language/expressions/references.mdx @@ -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 -`.` represents a [managed resource](/language/resources) of +`.` 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.` is the value of the [input variable](/language/values/variables) of the given name. +`var.` 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.` is the value of the [local value](/language/values/locals) of the given name. +`local.` 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.` 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..`. +[output values](/terraform/language/values/outputs), use `module..`. 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..` 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 diff --git a/website/docs/language/expressions/splat.mdx b/website/docs/language/expressions/splat.mdx index 71caa53238..9ac126ca13 100644 --- a/website/docs/language/expressions/splat.mdx +++ b/website/docs/language/expressions/splat.mdx @@ -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 diff --git a/website/docs/language/expressions/strings.mdx b/website/docs/language/expressions/strings.mdx index aead7f2313..68e713bcba 100644 --- a/website/docs/language/expressions/strings.mdx +++ b/website/docs/language/expressions/strings.mdx @@ -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 diff --git a/website/docs/language/expressions/type-constraints.mdx b/website/docs/language/expressions/type-constraints.mdx index dea51c5097..cb2e1a6374 100644 --- a/website/docs/language/expressions/type-constraints.mdx +++ b/website/docs/language/expressions/type-constraints.mdx @@ -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. diff --git a/website/docs/language/expressions/types.mdx b/website/docs/language/expressions/types.mdx index 078235744b..9cce14b03c 100644 --- a/website/docs/language/expressions/types.mdx +++ b/website/docs/language/expressions/types.mdx @@ -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 diff --git a/website/docs/language/expressions/version-constraints.mdx b/website/docs/language/expressions/version-constraints.mdx index 0537bec33f..52c5665065 100644 --- a/website/docs/language/expressions/version-constraints.mdx +++ b/website/docs/language/expressions/version-constraints.mdx @@ -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. diff --git a/website/docs/language/files/dependency-lock.mdx b/website/docs/language/files/dependency-lock.mdx index 50b555b51c..99aeb2bcdb 100644 --- a/website/docs/language/files/dependency-lock.mdx +++ b/website/docs/language/files/dependency-lock.mdx @@ -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 \ diff --git a/website/docs/language/files/index.mdx b/website/docs/language/files/index.mdx index b5808a013b..88df547101 100644 --- a/website/docs/language/files/index.mdx +++ b/website/docs/language/files/index.mdx @@ -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 diff --git a/website/docs/language/functions/abspath.mdx b/website/docs/language/functions/abspath.mdx index 482bc9fc13..cf6da3b9a6 100644 --- a/website/docs/language/functions/abspath.mdx +++ b/website/docs/language/functions/abspath.mdx @@ -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 diff --git a/website/docs/language/functions/base64decode.mdx b/website/docs/language/functions/base64decode.mdx index 8cb5a46c0a..0e0ddf1574 100644 --- a/website/docs/language/functions/base64decode.mdx +++ b/website/docs/language/functions/base64decode.mdx @@ -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. diff --git a/website/docs/language/functions/base64encode.mdx b/website/docs/language/functions/base64encode.mdx index 04482c917e..1c4d6fda8b 100644 --- a/website/docs/language/functions/base64encode.mdx +++ b/website/docs/language/functions/base64encode.mdx @@ -25,7 +25,7 @@ Base64 themselves, and so this function exists primarily to allow string data to be easily provided to resource types that expect Base64 bytes. `base64encode` is, in effect, a shorthand for calling -[`textencodebase64`](/language/functions/textencodebase64) with the encoding name set to +[`textencodebase64`](/terraform/language/functions/textencodebase64) with the encoding name set to `UTF-8`. ## Examples @@ -37,12 +37,12 @@ SGVsbG8gV29ybGQ= ## Related Functions -* [`base64decode`](/language/functions/base64decode) performs the opposite operation, +* [`base64decode`](/terraform/language/functions/base64decode) performs the opposite operation, decoding Base64 data and interpreting it as a UTF-8 string. -* [`textencodebase64`](/language/functions/textencodebase64) is a more general function that +* [`textencodebase64`](/terraform/language/functions/textencodebase64) 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 all in one operation. -* [`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, without creating an intermediate Unicode string. diff --git a/website/docs/language/functions/base64gzip.mdx b/website/docs/language/functions/base64gzip.mdx index cb3eefd28f..2620e20f5d 100644 --- a/website/docs/language/functions/base64gzip.mdx +++ b/website/docs/language/functions/base64gzip.mdx @@ -25,7 +25,7 @@ an S3 website. ## Related Functions -* [`base64encode`](/language/functions/base64encode) applies Base64 encoding _without_ +* [`base64encode`](/terraform/language/functions/base64encode) applies Base64 encoding _without_ gzip compression. -* [`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. diff --git a/website/docs/language/functions/base64sha256.mdx b/website/docs/language/functions/base64sha256.mdx index ca2116a656..7a1b340a5f 100644 --- a/website/docs/language/functions/base64sha256.mdx +++ b/website/docs/language/functions/base64sha256.mdx @@ -25,7 +25,7 @@ uU0nuZNNPgilLlLX2n2r+sSE7+N6U4DukIj3rOLvzek= ## Related Functions -* [`filebase64sha256`](/language/functions/filebase64sha256) calculates the same hash from +* [`filebase64sha256`](/terraform/language/functions/filebase64sha256) calculates the same hash from the contents of a file rather than from a string value. -* [`sha256`](/language/functions/sha256) calculates the same hash but returns the result +* [`sha256`](/terraform/language/functions/sha256) calculates the same hash but returns the result in a more-verbose hexadecimal encoding. diff --git a/website/docs/language/functions/base64sha512.mdx b/website/docs/language/functions/base64sha512.mdx index 3aaa4366ae..7b426283ac 100644 --- a/website/docs/language/functions/base64sha512.mdx +++ b/website/docs/language/functions/base64sha512.mdx @@ -25,7 +25,7 @@ MJ7MSJwS1utMxA9QyQLytNDtd+5RGnx6m808qG1M2G+YndNbxf9JlnDaNCVbRbDP2DDoH2Bdz33FVC6T ## Related Functions -* [`filebase64sha512`](/language/functions/filebase64sha512) calculates the same hash from +* [`filebase64sha512`](/terraform/language/functions/filebase64sha512) calculates the same hash from the contents of a file rather than from a string value. -* [`sha512`](/language/functions/sha512) calculates the same hash but returns the result +* [`sha512`](/terraform/language/functions/sha512) calculates the same hash but returns the result in a more-verbose hexadecimal encoding. diff --git a/website/docs/language/functions/basename.mdx b/website/docs/language/functions/basename.mdx index aed14fc814..8f9262ad94 100644 --- a/website/docs/language/functions/basename.mdx +++ b/website/docs/language/functions/basename.mdx @@ -24,7 +24,7 @@ it uses backslash `\` as the path segment separator. On Unix systems, the slash 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 @@ -36,6 +36,6 @@ baz.txt ## Related Functions -* [`dirname`](/language/functions/dirname) returns all of the segments of a filesystem path +* [`dirname`](/terraform/language/functions/dirname) returns all of the segments of a filesystem path _except_ the last, discarding the portion that would be returned by `basename`. diff --git a/website/docs/language/functions/can.mdx b/website/docs/language/functions/can.mdx index 9f58f93cc8..922b6f1360 100644 --- a/website/docs/language/functions/can.mdx +++ b/website/docs/language/functions/can.mdx @@ -12,12 +12,12 @@ whether the expression produced a result without any errors. This is a special function that is able to catch errors produced when evaluating its argument. For most situations where you could use `can` it's better to use -[`try`](/language/functions/try) instead, because it allows for more concise definition of +[`try`](/terraform/language/functions/try) instead, because it allows for more concise definition of fallback values for failing expressions. The primary purpose of `can` is to turn an error condition into a boolean validation result when writing -[custom variable validation rules](/language/values/variables#custom-validation-rules). +[custom variable validation rules](/terraform/language/values/variables#custom-validation-rules). For example: ``` @@ -41,7 +41,7 @@ as a malformed resource reference. variable validation rules. Although it can technically accept any sort of expression and be used elsewhere in the configuration, we recommend against using it in other contexts. For error handling elsewhere in the configuration, -prefer to use [`try`](/language/functions/try). +prefer to use [`try`](/terraform/language/functions/try). ## Examples @@ -70,5 +70,5 @@ A local value with the name "nonexist" has not been declared. ## Related Functions -* [`try`](/language/functions/try), which tries evaluating a sequence of expressions and +* [`try`](/terraform/language/functions/try), which tries evaluating a sequence of expressions and returns the result of the first one that succeeds. diff --git a/website/docs/language/functions/ceil.mdx b/website/docs/language/functions/ceil.mdx index 0f0956de0f..0245a82ac2 100644 --- a/website/docs/language/functions/ceil.mdx +++ b/website/docs/language/functions/ceil.mdx @@ -21,5 +21,5 @@ given value, which may be a fraction. ## Related Functions -* [`floor`](/language/functions/floor), which rounds to the nearest whole number _less than_ +* [`floor`](/terraform/language/functions/floor), which rounds to the nearest whole number _less than_ or equal. diff --git a/website/docs/language/functions/chomp.mdx b/website/docs/language/functions/chomp.mdx index cded57e7b0..ff1b046c4c 100644 --- a/website/docs/language/functions/chomp.mdx +++ b/website/docs/language/functions/chomp.mdx @@ -23,5 +23,5 @@ hello ## Related Functions -* [`trimspace`](/language/functions/trimspace), which removes all types of whitespace from +* [`trimspace`](/terraform/language/functions/trimspace), which removes all types of whitespace from both the start and the end of a string. diff --git a/website/docs/language/functions/cidrhost.mdx b/website/docs/language/functions/cidrhost.mdx index f49fcebc5b..68cde0a2f7 100644 --- a/website/docs/language/functions/cidrhost.mdx +++ b/website/docs/language/functions/cidrhost.mdx @@ -21,7 +21,7 @@ cidrhost(prefix, hostnum) no more than the number of digits remaining in the address after the given prefix. For more details on how this function interprets CIDR prefixes and populates host numbers, see the worked example for -[`cidrsubnet`](/language/functions/cidrsubnet). +[`cidrsubnet`](/terraform/language/functions/cidrsubnet). Conventionally host number zero is used to represent the address of the network itself and the host number that would fill all the host bits with @@ -50,5 +50,5 @@ fd00:fd12:3456:7890::22 ## Related Functions -* [`cidrsubnet`](/language/functions/cidrsubnet) calculates a subnet address under a given +* [`cidrsubnet`](/terraform/language/functions/cidrsubnet) calculates a subnet address under a given network address prefix. diff --git a/website/docs/language/functions/cidrsubnet.mdx b/website/docs/language/functions/cidrsubnet.mdx index 70ec016012..8ee8b1cd8f 100644 --- a/website/docs/language/functions/cidrsubnet.mdx +++ b/website/docs/language/functions/cidrsubnet.mdx @@ -27,7 +27,7 @@ additional bits added to the prefix. This function accepts both IPv6 and IPv4 prefixes, and the result always uses the same addressing scheme as the given prefix. -Unlike the related function [`cidrsubnets`](/language/functions/cidrsubnets), `cidrsubnet` +Unlike the related function [`cidrsubnets`](/terraform/language/functions/cidrsubnets), `cidrsubnet` allows you to give a specific network number to use. `cidrsubnets` can allocate multiple network addresses at once, but numbers them automatically starting with zero. @@ -93,7 +93,7 @@ This gives us some additional information but also confirms (using a slightly different notation) the conversion from decimal to binary and shows the range of possible host addresses in this network. -While [`cidrhost`](/language/functions/cidrhost) allows calculating single host IP addresses, +While [`cidrhost`](/terraform/language/functions/cidrhost) allows calculating single host IP addresses, `cidrsubnet` on the other hand creates a new network prefix _within_ the given network prefix. In other words, it creates a subnet. @@ -148,7 +148,7 @@ Hosts/Net: 14 Class A, Private Internet The new subnet has four bits available for host numbering, which means that there are 14 host addresses available for assignment once we subtract the network's own address and the broadcast address. You can thus use -[`cidrhost`](/language/functions/cidrhost) function to calculate those host addresses by +[`cidrhost`](/terraform/language/functions/cidrhost) function to calculate those host addresses by providing it a value between 1 and 14: ``` @@ -163,9 +163,9 @@ For more information on CIDR notation and subnetting, see ## Related Functions -* [`cidrhost`](/language/functions/cidrhost) calculates the IP address for a single host +* [`cidrhost`](/terraform/language/functions/cidrhost) calculates the IP address for a single host within a given network address prefix. -* [`cidrnetmask`](/language/functions/cidrnetmask) converts an IPv4 network prefix in CIDR +* [`cidrnetmask`](/terraform/language/functions/cidrnetmask) converts an IPv4 network prefix in CIDR notation into netmask notation. -* [`cidrsubnets`](/language/functions/cidrsubnets) can allocate multiple consecutive +* [`cidrsubnets`](/terraform/language/functions/cidrsubnets) can allocate multiple consecutive addresses under a prefix at once, numbering them automatically. diff --git a/website/docs/language/functions/cidrsubnets.mdx b/website/docs/language/functions/cidrsubnets.mdx index d8e63f6eb2..0dfd573bd4 100644 --- a/website/docs/language/functions/cidrsubnets.mdx +++ b/website/docs/language/functions/cidrsubnets.mdx @@ -23,7 +23,7 @@ value is therefore a list with one element per `newbits` argument, each a string containing an address range in CIDR notation. For more information on IP addressing concepts, see the documentation for the -related function [`cidrsubnet`](/language/functions/cidrsubnet). `cidrsubnet` calculates +related function [`cidrsubnet`](/terraform/language/functions/cidrsubnet). `cidrsubnet` calculates a single subnet address within a prefix while allowing you to specify its subnet number, while `cidrsubnets` can calculate many at once, potentially of different sizes, and assigns subnet numbers automatically. @@ -69,7 +69,7 @@ platforms. ``` You can use nested `cidrsubnets` calls with -[`for` expressions](/language/expressions/for) +[`for` expressions](/terraform/language/expressions/for) to concisely allocate groups of network address blocks: ``` @@ -96,9 +96,9 @@ to concisely allocate groups of network address blocks: ## Related Functions -* [`cidrhost`](/language/functions/cidrhost) calculates the IP address for a single host +* [`cidrhost`](/terraform/language/functions/cidrhost) calculates the IP address for a single host within a given network address prefix. -* [`cidrnetmask`](/language/functions/cidrnetmask) converts an IPv4 network prefix in CIDR +* [`cidrnetmask`](/terraform/language/functions/cidrnetmask) converts an IPv4 network prefix in CIDR notation into netmask notation. -* [`cidrsubnet`](/language/functions/cidrsubnet) calculates a single subnet address, allowing +* [`cidrsubnet`](/terraform/language/functions/cidrsubnet) calculates a single subnet address, allowing you to specify its network number. diff --git a/website/docs/language/functions/coalesce.mdx b/website/docs/language/functions/coalesce.mdx index 1c005ea40c..fcbb6463cd 100644 --- a/website/docs/language/functions/coalesce.mdx +++ b/website/docs/language/functions/coalesce.mdx @@ -52,5 +52,5 @@ Call to function "coalesce" failed: all arguments must have the same type. ## Related Functions -* [`coalescelist`](/language/functions/coalescelist) performs a similar operation with +* [`coalescelist`](/terraform/language/functions/coalescelist) performs a similar operation with list arguments rather than individual arguments. diff --git a/website/docs/language/functions/coalescelist.mdx b/website/docs/language/functions/coalescelist.mdx index 4c43162124..9d53dc05fb 100644 --- a/website/docs/language/functions/coalescelist.mdx +++ b/website/docs/language/functions/coalescelist.mdx @@ -38,5 +38,5 @@ symbol to expand the outer list as arguments: ## Related Functions -* [`coalesce`](/language/functions/coalesce) performs a similar operation with string +* [`coalesce`](/terraform/language/functions/coalesce) performs a similar operation with string arguments rather than list arguments. diff --git a/website/docs/language/functions/csvdecode.mdx b/website/docs/language/functions/csvdecode.mdx index 5d8859df38..2af18afd41 100644 --- a/website/docs/language/functions/csvdecode.mdx +++ b/website/docs/language/functions/csvdecode.mdx @@ -39,7 +39,7 @@ number of fields, or this function will produce an error. ## Use with the `for_each` meta-argument You can use the result of `csvdecode` with -[the `for_each` meta-argument](/language/meta-arguments/for_each) +[the `for_each` meta-argument](/terraform/language/meta-arguments/for_each) to describe a collection of similar objects whose differences are described by the rows in the given CSV file. @@ -87,7 +87,7 @@ create or destroy associated instances as appropriate. If there is no reasonable value you can use as a unique identifier in your CSV then you could instead use -[the `count` meta-argument](/language/meta-arguments/count) +[the `count` meta-argument](/terraform/language/meta-arguments/count) to define an object for each CSV row, with each one identified by its index into the list returned by `csvdecode`. However, in that case any future updates to the CSV may be disruptive if they change the positions of particular objects in diff --git a/website/docs/language/functions/dirname.mdx b/website/docs/language/functions/dirname.mdx index c26edbd8ca..1b4ab32eaf 100644 --- a/website/docs/language/functions/dirname.mdx +++ b/website/docs/language/functions/dirname.mdx @@ -23,7 +23,7 @@ any slashes in the given path will be replaced by backslashes before returning. 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 @@ -35,5 +35,5 @@ foo/bar ## Related Functions -* [`basename`](/language/functions/basename) returns _only_ the last portion of a filesystem +* [`basename`](/terraform/language/functions/basename) returns _only_ the last portion of a filesystem path, discarding the portion that would be returned by `dirname`. diff --git a/website/docs/language/functions/element.mdx b/website/docs/language/functions/element.mdx index ca81aa6115..06e89f8332 100644 --- a/website/docs/language/functions/element.mdx +++ b/website/docs/language/functions/element.mdx @@ -32,7 +32,7 @@ If the given index is greater than the length of the list then the index is a ``` -To get the last element from the list use [`length`](/language/functions/length) to find +To get the last element from the list use [`length`](/terraform/language/functions/length) to find the size of the list (minus 1 as the list is zero-based) and then pick the last element: @@ -43,5 +43,5 @@ c ## Related Functions -* [`index`](/language/functions/index_function) finds the index for a particular element value. -* [`lookup`](/language/functions/lookup) retrieves a value from a _map_ given its _key_. +* [`index`](/terraform/language/functions/index_function) finds the index for a particular element value. +* [`lookup`](/terraform/language/functions/lookup) retrieves a value from a _map_ given its _key_. diff --git a/website/docs/language/functions/endswith.mdx b/website/docs/language/functions/endswith.mdx index d96cc88aad..d6e5601f31 100644 --- a/website/docs/language/functions/endswith.mdx +++ b/website/docs/language/functions/endswith.mdx @@ -24,4 +24,4 @@ false ## Related Functions -- [`startswith`](/language/functions/startswith) takes two values: a string to check and a prefix string. The function returns true if the string begins with that exact prefix. +- [`startswith`](/terraform/language/functions/startswith) takes two values: a string to check and a prefix string. The function returns true if the string begins with that exact prefix. diff --git a/website/docs/language/functions/file.mdx b/website/docs/language/functions/file.mdx index 0dd177f683..1c9872ba18 100644 --- a/website/docs/language/functions/file.mdx +++ b/website/docs/language/functions/file.mdx @@ -37,10 +37,10 @@ Hello World ## Related Functions -* [`filebase64`](/language/functions/filebase64) also reads the contents of a given file, +* [`filebase64`](/terraform/language/functions/filebase64) also reads the contents of a given file, but returns the raw bytes in that file Base64-encoded, rather than interpreting the contents as UTF-8 text. -* [`fileexists`](/language/functions/fileexists) determines whether a file exists +* [`fileexists`](/terraform/language/functions/fileexists) determines whether a file exists at a given path. -* [`templatefile`](/language/functions/templatefile) renders using a file from disk as a +* [`templatefile`](/terraform/language/functions/templatefile) renders using a file from disk as a template. diff --git a/website/docs/language/functions/filebase64.mdx b/website/docs/language/functions/filebase64.mdx index 7e5cede2c3..15c46ac4bd 100644 --- a/website/docs/language/functions/filebase64.mdx +++ b/website/docs/language/functions/filebase64.mdx @@ -38,9 +38,9 @@ SGVsbG8gV29ybGQ= ## Related Functions -* [`file`](/language/functions/file) also reads the contents of a given file, +* [`file`](/terraform/language/functions/file) also reads the contents of a given file, but interprets the data as UTF-8 text and returns the result directly as a string, without any further encoding. -* [`base64decode`](/language/functions/base64decode) can decode a Base64 string representing +* [`base64decode`](/terraform/language/functions/base64decode) can decode a Base64 string representing bytes in UTF-8, but in practice `base64decode(filebase64(...))` is equivalent to the shorter expression `file(...)`. diff --git a/website/docs/language/functions/filebase64sha256.mdx b/website/docs/language/functions/filebase64sha256.mdx index 7e8ba0da15..2cdee344f0 100644 --- a/website/docs/language/functions/filebase64sha256.mdx +++ b/website/docs/language/functions/filebase64sha256.mdx @@ -7,9 +7,9 @@ description: |- # `filebase64sha256` Function -`filebase64sha256` is a variant of [`base64sha256`](/language/functions/base64sha256) +`filebase64sha256` is a variant of [`base64sha256`](/terraform/language/functions/base64sha256) that hashes the contents of a given file rather than a literal string. This is similar to `base64sha256(file(filename))`, but -because [`file`](/language/functions/file) accepts only UTF-8 text it cannot be used to +because [`file`](/terraform/language/functions/file) accepts only UTF-8 text it cannot be used to create hashes for binary files. diff --git a/website/docs/language/functions/filebase64sha512.mdx b/website/docs/language/functions/filebase64sha512.mdx index cae825b310..0fd09cbdd3 100644 --- a/website/docs/language/functions/filebase64sha512.mdx +++ b/website/docs/language/functions/filebase64sha512.mdx @@ -7,9 +7,9 @@ description: |- # `filebase64sha512` Function -`filebase64sha512` is a variant of [`base64sha512`](/language/functions/base64sha512) +`filebase64sha512` is a variant of [`base64sha512`](/terraform/language/functions/base64sha512) that hashes the contents of a given file rather than a literal string. This is similar to `base64sha512(file(filename))`, but -because [`file`](/language/functions/file) accepts only UTF-8 text it cannot be used to +because [`file`](/terraform/language/functions/file) accepts only UTF-8 text it cannot be used to create hashes for binary files. diff --git a/website/docs/language/functions/fileexists.mdx b/website/docs/language/functions/fileexists.mdx index 47ceca0298..b95585f777 100644 --- a/website/docs/language/functions/fileexists.mdx +++ b/website/docs/language/functions/fileexists.mdx @@ -31,4 +31,4 @@ fileexists("custom-section.sh") ? file("custom-section.sh") : local.default_cont ## Related Functions -* [`file`](/language/functions/file) reads the contents of a file at a given path +* [`file`](/terraform/language/functions/file) reads the contents of a file at a given path diff --git a/website/docs/language/functions/filemd5.mdx b/website/docs/language/functions/filemd5.mdx index de2894d028..3470ba9d7e 100644 --- a/website/docs/language/functions/filemd5.mdx +++ b/website/docs/language/functions/filemd5.mdx @@ -7,9 +7,9 @@ description: |- # `filemd5` Function -`filemd5` is a variant of [`md5`](/language/functions/md5) +`filemd5` is a variant of [`md5`](/terraform/language/functions/md5) that hashes the contents of a given file rather than a literal string. This is similar to `md5(file(filename))`, but -because [`file`](/language/functions/file) accepts only UTF-8 text it cannot be used to +because [`file`](/terraform/language/functions/file) accepts only UTF-8 text it cannot be used to create hashes for binary files. diff --git a/website/docs/language/functions/fileset.mdx b/website/docs/language/functions/fileset.mdx index 115d8bf6f6..3a1661c83a 100644 --- a/website/docs/language/functions/fileset.mdx +++ b/website/docs/language/functions/fileset.mdx @@ -66,7 +66,7 @@ before Terraform takes any actions. ``` A common use of `fileset` is to create one resource instance per matched file, using -[the `for_each` meta-argument](/language/meta-arguments/for_each): +[the `for_each` meta-argument](/terraform/language/meta-arguments/for_each): ```hcl resource "example_thing" "example" { diff --git a/website/docs/language/functions/filesha1.mdx b/website/docs/language/functions/filesha1.mdx index 271884d697..a2b56ce6c6 100644 --- a/website/docs/language/functions/filesha1.mdx +++ b/website/docs/language/functions/filesha1.mdx @@ -7,9 +7,9 @@ description: |- # `filesha1` Function -`filesha1` is a variant of [`sha1`](/language/functions/sha1) +`filesha1` is a variant of [`sha1`](/terraform/language/functions/sha1) that hashes the contents of a given file rather than a literal string. This is similar to `sha1(file(filename))`, but -because [`file`](/language/functions/file) accepts only UTF-8 text it cannot be used to +because [`file`](/terraform/language/functions/file) accepts only UTF-8 text it cannot be used to create hashes for binary files. diff --git a/website/docs/language/functions/filesha256.mdx b/website/docs/language/functions/filesha256.mdx index 80918ba05c..2592ac41ab 100644 --- a/website/docs/language/functions/filesha256.mdx +++ b/website/docs/language/functions/filesha256.mdx @@ -7,9 +7,9 @@ description: |- # `filesha256` Function -`filesha256` is a variant of [`sha256`](/language/functions/sha256) +`filesha256` is a variant of [`sha256`](/terraform/language/functions/sha256) that hashes the contents of a given file rather than a literal string. This is similar to `sha256(file(filename))`, but -because [`file`](/language/functions/file) accepts only UTF-8 text it cannot be used to +because [`file`](/terraform/language/functions/file) accepts only UTF-8 text it cannot be used to create hashes for binary files. diff --git a/website/docs/language/functions/filesha512.mdx b/website/docs/language/functions/filesha512.mdx index 10b0147186..a61644606f 100644 --- a/website/docs/language/functions/filesha512.mdx +++ b/website/docs/language/functions/filesha512.mdx @@ -7,9 +7,9 @@ description: |- # `filesha512` Function -`filesha512` is a variant of [`sha512`](/language/functions/sha512) +`filesha512` is a variant of [`sha512`](/terraform/language/functions/sha512) that hashes the contents of a given file rather than a literal string. This is similar to `sha512(file(filename))`, but -because [`file`](/language/functions/file) accepts only UTF-8 text it cannot be used to +because [`file`](/terraform/language/functions/file) accepts only UTF-8 text it cannot be used to create hashes for binary files. diff --git a/website/docs/language/functions/flatten.mdx b/website/docs/language/functions/flatten.mdx index 27f675370f..b94c7d8d36 100644 --- a/website/docs/language/functions/flatten.mdx +++ b/website/docs/language/functions/flatten.mdx @@ -28,9 +28,9 @@ Indirectly-nested lists, such as those in maps, are _not_ flattened. ## Flattening nested structures for `for_each` The -[resource `for_each`](/language/meta-arguments/for_each) +[resource `for_each`](/terraform/language/meta-arguments/for_each) and -[`dynamic` block](/language/expressions/dynamic-blocks) +[`dynamic` block](/terraform/language/expressions/dynamic-blocks) language features both require a collection value that has one element for each repetition. @@ -101,6 +101,6 @@ the associations between the subnets and their containing networks. ## Related Functions -* [`setproduct`](/language/functions/setproduct) finds all of the combinations of multiple +* [`setproduct`](/terraform/language/functions/setproduct) finds all of the combinations of multiple lists or sets of values, which can also be useful when preparing collections for use with `for_each` constructs. diff --git a/website/docs/language/functions/floor.mdx b/website/docs/language/functions/floor.mdx index 97e57d9aff..c40b0e5f5a 100644 --- a/website/docs/language/functions/floor.mdx +++ b/website/docs/language/functions/floor.mdx @@ -21,5 +21,5 @@ given value, which may be a fraction. ## Related Functions -* [`ceil`](/language/functions/ceil), which rounds to the nearest whole number _greater than_ +* [`ceil`](/terraform/language/functions/ceil), which rounds to the nearest whole number _greater than_ or equal. diff --git a/website/docs/language/functions/format.mdx b/website/docs/language/functions/format.mdx index be1ad663b8..4053f17681 100644 --- a/website/docs/language/functions/format.mdx +++ b/website/docs/language/functions/format.mdx @@ -34,7 +34,7 @@ Hello, Valentina! Hello, Valentina! ``` -The formatting verb `%#v` accepts a value of any type and presents it using JSON encoding, similar to jsonencode. This can be useful for describing the values given to a module in [custom condition check](/language/expressions/custom-conditions#error-messages) error messages. +The formatting verb `%#v` accepts a value of any type and presents it using JSON encoding, similar to jsonencode. This can be useful for describing the values given to a module in [custom condition check](/terraform/language/expressions/custom-conditions#error-messages) error messages. ``` > format("%#v", "hello") @@ -139,7 +139,7 @@ Use the following symbols immediately after the `%` symbol to set additional for ## Related Functions -* [`formatdate`](/language/functions/formatdate) is a specialized formatting function for +* [`formatdate`](/terraform/language/functions/formatdate) is a specialized formatting function for human-readable timestamps. -* [`formatlist`](/language/functions/formatlist) uses the same specification syntax to +* [`formatlist`](/terraform/language/functions/formatlist) uses the same specification syntax to produce a list of strings. diff --git a/website/docs/language/functions/formatdate.mdx b/website/docs/language/functions/formatdate.mdx index 07e555f762..358536d794 100644 --- a/website/docs/language/functions/formatdate.mdx +++ b/website/docs/language/functions/formatdate.mdx @@ -99,7 +99,7 @@ configuration as needed: ## Related Functions -- [`format`](/language/functions/format) is a more general formatting function for arbitrary +- [`format`](/terraform/language/functions/format) is a more general formatting function for arbitrary data. -- [`timestamp`](/language/functions/timestamp) returns the current date and time in a format +- [`timestamp`](/terraform/language/functions/timestamp) returns the current date and time in a format suitable for input to `formatdate`. diff --git a/website/docs/language/functions/formatlist.mdx b/website/docs/language/functions/formatlist.mdx index c8ee47910d..3d96865aa7 100644 --- a/website/docs/language/functions/formatlist.mdx +++ b/website/docs/language/functions/formatlist.mdx @@ -15,7 +15,7 @@ formatlist(spec, values...) ``` The specification string uses -[the same syntax as `format`](/language/functions/format#specification-syntax). +[the same syntax as `format`](/terraform/language/functions/format#specification-syntax). The given values can be a mixture of list and non-list arguments. Any given lists must be the same length, which decides the length of the resulting list. @@ -45,5 +45,5 @@ once per element of the list arguments. ## Related Functions -* [`format`](/language/functions/format) defines the specification syntax used by this +* [`format`](/terraform/language/functions/format) defines the specification syntax used by this function and produces a single string as its result. diff --git a/website/docs/language/functions/index.mdx b/website/docs/language/functions/index.mdx index 721a889eee..a8f151986d 100644 --- a/website/docs/language/functions/index.mdx +++ b/website/docs/language/functions/index.mdx @@ -7,7 +7,7 @@ description: >- # Built-in Functions -> **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 includes a number of built-in functions that you can call from within expressions to transform and combine values. The general @@ -19,7 +19,7 @@ max(5, 12, 9) ``` For more details on syntax, see -[_Function Calls_](/language/expressions/function-calls) +[_Function Calls_](/terraform/language/expressions/function-calls) in the Expressions section. The Terraform language does not support user-defined functions, and so only @@ -27,7 +27,7 @@ the functions built in to the language are available for use. The documentation You can experiment with the behavior of Terraform's built-in functions from the Terraform expression console, by running -[the `terraform console` command](/cli/commands/console): +[the `terraform console` command](/terraform/cli/commands/console): ``` > max(5, 12, 9) diff --git a/website/docs/language/functions/index_function.mdx b/website/docs/language/functions/index_function.mdx index f0c1001cdd..aae7015780 100644 --- a/website/docs/language/functions/index_function.mdx +++ b/website/docs/language/functions/index_function.mdx @@ -23,5 +23,5 @@ value is not present in the list. ## Related Functions -* [`element`](/language/functions/element) retrieves a particular element from a list given +* [`element`](/terraform/language/functions/element) retrieves a particular element from a list given its index. diff --git a/website/docs/language/functions/join.mdx b/website/docs/language/functions/join.mdx index 6d8bd70c63..4ae35b705f 100644 --- a/website/docs/language/functions/join.mdx +++ b/website/docs/language/functions/join.mdx @@ -25,5 +25,5 @@ foo ## Related Functions -* [`split`](/language/functions/split) performs the opposite operation: producing a list +* [`split`](/terraform/language/functions/split) performs the opposite operation: producing a list by separating a single string using a given delimiter. diff --git a/website/docs/language/functions/jsondecode.mdx b/website/docs/language/functions/jsondecode.mdx index fe16e2bd25..e34322b1d1 100644 --- a/website/docs/language/functions/jsondecode.mdx +++ b/website/docs/language/functions/jsondecode.mdx @@ -13,7 +13,7 @@ of the result of decoding that string. The JSON encoding is defined in [RFC 7159](https://tools.ietf.org/html/rfc7159). This function maps JSON values to -[Terraform language values](/language/expressions/types) +[Terraform language values](/terraform/language/expressions/types) in the following way: | JSON type | Terraform type | @@ -42,5 +42,5 @@ true ## Related Functions -* [`jsonencode`](/language/functions/jsonencode) performs the opposite operation, _encoding_ +* [`jsonencode`](/terraform/language/functions/jsonencode) performs the opposite operation, _encoding_ a value as JSON. diff --git a/website/docs/language/functions/jsonencode.mdx b/website/docs/language/functions/jsonencode.mdx index 5c4fb5c133..4afa3bcf07 100644 --- a/website/docs/language/functions/jsonencode.mdx +++ b/website/docs/language/functions/jsonencode.mdx @@ -10,7 +10,7 @@ description: The jsonencode function encodes a given value as a JSON string. The JSON encoding is defined in [RFC 7159](https://tools.ietf.org/html/rfc7159). This function maps -[Terraform language values](/language/expressions/types) +[Terraform language values](/terraform/language/expressions/types) to JSON values in the following way: | Terraform type | JSON type | @@ -46,5 +46,5 @@ The `jsonencode` command outputs a minified representation of the input. ## Related Functions -* [`jsondecode`](/language/functions/jsondecode) performs the opposite operation, _decoding_ +* [`jsondecode`](/terraform/language/functions/jsondecode) performs the opposite operation, _decoding_ a JSON string to obtain its represented value. diff --git a/website/docs/language/functions/keys.mdx b/website/docs/language/functions/keys.mdx index e97083730b..96a1553888 100644 --- a/website/docs/language/functions/keys.mdx +++ b/website/docs/language/functions/keys.mdx @@ -23,4 +23,4 @@ be identical as long as the keys in the map don't change. ## Related Functions -* [`values`](/language/functions/values) returns a list of the _values_ from a map. +* [`values`](/terraform/language/functions/values) returns a list of the _values_ from a map. diff --git a/website/docs/language/functions/list.mdx b/website/docs/language/functions/list.mdx index 0fb9a13c8f..2a1ffe2534 100644 --- a/website/docs/language/functions/list.mdx +++ b/website/docs/language/functions/list.mdx @@ -17,10 +17,10 @@ tolist([a, b, c]) The `[ ... ]` brackets construct a tuple value, and then the `tolist` function then converts it to a list. For more information on the value types in the -Terraform language, see [Type Constraints](/language/expressions/types). +Terraform language, see [Type Constraints](/terraform/language/expressions/types). ## Related Functions -* [`concat`](/language/functions/concat) produces a new list by concatenating together the +* [`concat`](/terraform/language/functions/concat) produces a new list by concatenating together the elements from other lists. -* [`tolist`](/language/functions/tolist) converts a set or tuple value to a list. +* [`tolist`](/terraform/language/functions/tolist) converts a set or tuple value to a list. diff --git a/website/docs/language/functions/lookup.mdx b/website/docs/language/functions/lookup.mdx index 55a92fe0e4..98b2fdfb57 100644 --- a/website/docs/language/functions/lookup.mdx +++ b/website/docs/language/functions/lookup.mdx @@ -27,4 +27,4 @@ what? ## Related Functions -* [`element`](/language/functions/element) retrieves a value from a _list_ given its _index_. +* [`element`](/terraform/language/functions/element) retrieves a value from a _list_ given its _index_. diff --git a/website/docs/language/functions/lower.mdx b/website/docs/language/functions/lower.mdx index 638cb349ed..2a4c249e01 100644 --- a/website/docs/language/functions/lower.mdx +++ b/website/docs/language/functions/lower.mdx @@ -22,5 +22,5 @@ This function uses Unicode's definition of letters and of upper- and lowercase. ## Related Functions -* [`upper`](/language/functions/upper) converts letters in a string to _uppercase_. -* [`title`](/language/functions/title) converts the first letter of each word in a string to uppercase. +* [`upper`](/terraform/language/functions/upper) converts letters in a string to _uppercase_. +* [`title`](/terraform/language/functions/title) converts the first letter of each word in a string to uppercase. diff --git a/website/docs/language/functions/map.mdx b/website/docs/language/functions/map.mdx index ae05bf5476..42aceb6b9e 100644 --- a/website/docs/language/functions/map.mdx +++ b/website/docs/language/functions/map.mdx @@ -20,10 +20,10 @@ tomap({ The `{ ... }` braces construct an object value, and then the `tomap` function then converts it to a map. For more information on the value types in the -Terraform language, see [Type Constraints](/language/expressions/types). +Terraform language, see [Type Constraints](/terraform/language/expressions/types). ## Related Functions -* [`tomap`](/language/functions/tomap) converts an object value to a map. -* [`zipmap`](/language/functions/zipmap) constructs a map dynamically, by taking keys from +* [`tomap`](/terraform/language/functions/tomap) converts an object value to a map. +* [`zipmap`](/terraform/language/functions/zipmap) constructs a map dynamically, by taking keys from one list and values from another list. diff --git a/website/docs/language/functions/max.mdx b/website/docs/language/functions/max.mdx index bb453cc5f7..05a4ee6b07 100644 --- a/website/docs/language/functions/max.mdx +++ b/website/docs/language/functions/max.mdx @@ -24,4 +24,4 @@ to individual arguments: ## Related Functions -* [`min`](/language/functions/min), which returns the _smallest_ number from a set. +* [`min`](/terraform/language/functions/min), which returns the _smallest_ number from a set. diff --git a/website/docs/language/functions/md5.mdx b/website/docs/language/functions/md5.mdx index fdaf0b9723..199de34e92 100644 --- a/website/docs/language/functions/md5.mdx +++ b/website/docs/language/functions/md5.mdx @@ -27,5 +27,5 @@ considerations applying to the MD5 algorithm. ## Related Functions -* [`filemd5`](/language/functions/filemd5) calculates the same hash from +* [`filemd5`](/terraform/language/functions/filemd5) calculates the same hash from the contents of a file rather than from a string value. diff --git a/website/docs/language/functions/merge.mdx b/website/docs/language/functions/merge.mdx index dfc70aaa28..6a3d230a73 100644 --- a/website/docs/language/functions/merge.mdx +++ b/website/docs/language/functions/merge.mdx @@ -39,7 +39,7 @@ type structure of the attributes after the merging rules have been applied. } ``` -The following example uses the expansion symbol (...) to transform the value into separate arguments. Refer to [Expanding Function Argument](/language/expressions/function-calls#expanding-function-arguments) for details. +The following example uses the expansion symbol (...) to transform the value into separate arguments. Refer to [Expanding Function Argument](/terraform/language/expressions/function-calls#expanding-function-arguments) for details. ``` > merge([{a="b", c="d"}, {}, {e="f", c="z"}]...) diff --git a/website/docs/language/functions/min.mdx b/website/docs/language/functions/min.mdx index d58765c272..f5388b2cc0 100644 --- a/website/docs/language/functions/min.mdx +++ b/website/docs/language/functions/min.mdx @@ -24,4 +24,4 @@ to individual arguments: ## Related Functions -* [`max`](/language/functions/max), which returns the _greatest_ number from a set. +* [`max`](/terraform/language/functions/max), which returns the _greatest_ number from a set. diff --git a/website/docs/language/functions/one.mdx b/website/docs/language/functions/one.mdx index fca597dfaf..ceb6a16164 100644 --- a/website/docs/language/functions/one.mdx +++ b/website/docs/language/functions/one.mdx @@ -47,7 +47,7 @@ no instances were created. ## Relationship to the "Splat" Operator The Terraform language has a built-in operator `[*]`, known as -[the _splat_ operator](/language/expressions/splat), and one of its functions +[the _splat_ operator](/terraform/language/expressions/splat), and one of its functions is to translate a primitive value that might be null into a list of either zero or one elements: diff --git a/website/docs/language/functions/parseint.mdx b/website/docs/language/functions/parseint.mdx index e7ecb94011..952a147a0a 100644 --- a/website/docs/language/functions/parseint.mdx +++ b/website/docs/language/functions/parseint.mdx @@ -46,5 +46,5 @@ Invalid value for "number" parameter: cannot parse "12" as a base 2 integer. ## Related Functions -* [`format`](/language/functions/format) can format numbers and other values into strings, +* [`format`](/terraform/language/functions/format) can format numbers and other values into strings, with optional zero padding, alignment, etc. diff --git a/website/docs/language/functions/regex.mdx b/website/docs/language/functions/regex.mdx index 08086e9234..d8e167caff 100644 --- a/website/docs/language/functions/regex.mdx +++ b/website/docs/language/functions/regex.mdx @@ -30,7 +30,7 @@ It's not valid to mix both named and unnamed capture groups in the same pattern. If the given pattern does not match at all, the `regex` raises an error. To _test_ whether a given pattern matches a string, use -[`regexall`](/language/functions/regexall) and test that the result has length greater than +[`regexall`](/terraform/language/functions/regexall) and test that the result has length greater than zero. The pattern is a string containing a mixture of literal characters and special @@ -152,8 +152,8 @@ string. ## Related Functions -- [`regexall`](/language/functions/regexall) searches for potentially multiple matches of a given pattern in a string. -- [`replace`](/language/functions/replace) replaces a substring of a string with another string, optionally matching using the same regular expression syntax as `regex`. +- [`regexall`](/terraform/language/functions/regexall) searches for potentially multiple matches of a given pattern in a string. +- [`replace`](/terraform/language/functions/replace) replaces a substring of a string with another string, optionally matching using the same regular expression syntax as `regex`. If Terraform already has a more specialized function to parse the syntax you are trying to match, prefer to use that function instead. Regular expressions diff --git a/website/docs/language/functions/regexall.mdx b/website/docs/language/functions/regexall.mdx index 886052ef4a..ea794af23b 100644 --- a/website/docs/language/functions/regexall.mdx +++ b/website/docs/language/functions/regexall.mdx @@ -15,7 +15,7 @@ to a string and returns a list of all matches. regexall(pattern, string) ``` -`regexall` is a variant of [`regex`](/language/functions/regex) and uses the same pattern +`regexall` is a variant of [`regex`](/terraform/language/functions/regex) and uses the same pattern syntax. For any given input to `regex`, `regexall` returns a list of whatever type `regex` would've returned, with one element per match. That is: @@ -48,7 +48,7 @@ false ## Related Functions -- [`regex`](/language/functions/regex) searches for a single match of a given pattern, and +- [`regex`](/terraform/language/functions/regex) searches for a single match of a given pattern, and returns an error if no match is found. If Terraform already has a more specialized function to parse the syntax you diff --git a/website/docs/language/functions/replace.mdx b/website/docs/language/functions/replace.mdx index 9ffd958325..e4e76a1c68 100644 --- a/website/docs/language/functions/replace.mdx +++ b/website/docs/language/functions/replace.mdx @@ -16,7 +16,7 @@ replace(string, substring, replacement) If `substring` is wrapped in forward slashes, it is treated as a regular expression, using the same pattern syntax as -[`regex`](/language/functions/regex). If using a regular expression for the substring +[`regex`](/terraform/language/functions/regex). If using a regular expression for the substring argument, the `replacement` string can incorporate captured strings from the input by using an `$n` sequence, where `n` is the index or name of a capture group. @@ -33,5 +33,5 @@ hello everybody ## Related Functions -- [`regex`](/language/functions/regex) searches a given string for a substring matching a +- [`regex`](/terraform/language/functions/regex) searches a given string for a substring matching a given regular expression pattern. diff --git a/website/docs/language/functions/reverse.mdx b/website/docs/language/functions/reverse.mdx index 257202c426..c46350a256 100644 --- a/website/docs/language/functions/reverse.mdx +++ b/website/docs/language/functions/reverse.mdx @@ -21,4 +21,4 @@ with all of the same elements as the given sequence but in reverse order. ## Related Functions -* [`strrev`](/language/functions/strrev) reverses a string. +* [`strrev`](/terraform/language/functions/strrev) reverses a string. diff --git a/website/docs/language/functions/sensitive.mdx b/website/docs/language/functions/sensitive.mdx index e974f3ec1b..4b82bbef9b 100644 --- a/website/docs/language/functions/sensitive.mdx +++ b/website/docs/language/functions/sensitive.mdx @@ -9,7 +9,7 @@ description: The sensitive function marks a value as being sensitive. `sensitive` takes any value and returns a copy of it marked so that Terraform will treat it as sensitive, with the same meaning and behavior as for -[sensitive input variables](/language/values/variables#suppressing-values-in-cli-output). +[sensitive input variables](/terraform/language/values/variables#suppressing-values-in-cli-output). Wherever possible we recommend marking your input variable and/or output value declarations as sensitive directly, instead of using this function, because in diff --git a/website/docs/language/functions/setintersection.mdx b/website/docs/language/functions/setintersection.mdx index 296c6a185c..95b37b7a64 100644 --- a/website/docs/language/functions/setintersection.mdx +++ b/website/docs/language/functions/setintersection.mdx @@ -30,10 +30,10 @@ the ordering of the given elements is not preserved. ## Related Functions -* [`contains`](/language/functions/contains) tests whether a given list or set contains +* [`contains`](/terraform/language/functions/contains) tests whether a given list or set contains a given element value. -* [`setproduct`](/language/functions/setproduct) computes the _Cartesian product_ of multiple +* [`setproduct`](/terraform/language/functions/setproduct) computes the _Cartesian product_ of multiple sets. -* [`setsubtract`](/language/functions/setsubtract) computes the _relative complement_ of two sets -* [`setunion`](/language/functions/setunion) computes the _union_ of +* [`setsubtract`](/terraform/language/functions/setsubtract) computes the _relative complement_ of two sets +* [`setunion`](/terraform/language/functions/setunion) computes the _union_ of multiple sets. diff --git a/website/docs/language/functions/setproduct.mdx b/website/docs/language/functions/setproduct.mdx index 62e64f5e06..077f4cbaa7 100644 --- a/website/docs/language/functions/setproduct.mdx +++ b/website/docs/language/functions/setproduct.mdx @@ -115,9 +115,9 @@ elements all have a consistent type: ## Finding combinations for `for_each` The -[resource `for_each`](/language/meta-arguments/for_each) +[resource `for_each`](/terraform/language/meta-arguments/for_each) and -[`dynamic` block](/language/expressions/dynamic-blocks) +[`dynamic` block](/terraform/language/expressions/dynamic-blocks) language features both require a collection value that has one element for each repetition. @@ -269,13 +269,13 @@ The `network_subnets` output would look similar to the following: ## Related Functions -- [`contains`](/language/functions/contains) tests whether a given list or set contains +- [`contains`](/terraform/language/functions/contains) tests whether a given list or set contains a given element value. -- [`flatten`](/language/functions/flatten) is useful for flattening hierarchical data +- [`flatten`](/terraform/language/functions/flatten) is useful for flattening hierarchical data into a single list, for situations where the relationships between two object types are defined explicitly. -- [`setintersection`](/language/functions/setintersection) computes the _intersection_ of +- [`setintersection`](/terraform/language/functions/setintersection) computes the _intersection_ of multiple sets. -- [`setsubtract`](/language/functions/setsubtract) computes the _relative complement_ of two sets -- [`setunion`](/language/functions/setunion) computes the _union_ of multiple +- [`setsubtract`](/terraform/language/functions/setsubtract) computes the _relative complement_ of two sets +- [`setunion`](/terraform/language/functions/setunion) computes the _union_ of multiple sets. diff --git a/website/docs/language/functions/setsubtract.mdx b/website/docs/language/functions/setsubtract.mdx index dafeca4231..26a865b985 100644 --- a/website/docs/language/functions/setsubtract.mdx +++ b/website/docs/language/functions/setsubtract.mdx @@ -35,8 +35,8 @@ setsubtract(a, b) ## Related Functions -* [`setintersection`](/language/functions/setintersection) computes the _intersection_ of multiple sets -* [`setproduct`](/language/functions/setproduct) computes the _Cartesian product_ of multiple +* [`setintersection`](/terraform/language/functions/setintersection) computes the _intersection_ of multiple sets +* [`setproduct`](/terraform/language/functions/setproduct) computes the _Cartesian product_ of multiple sets. -* [`setunion`](/language/functions/setunion) computes the _union_ of +* [`setunion`](/terraform/language/functions/setunion) computes the _union_ of multiple sets. diff --git a/website/docs/language/functions/setunion.mdx b/website/docs/language/functions/setunion.mdx index bbd36c6fe6..85874bd030 100644 --- a/website/docs/language/functions/setunion.mdx +++ b/website/docs/language/functions/setunion.mdx @@ -33,10 +33,10 @@ the ordering of the given elements is not preserved. ## Related Functions -* [`contains`](/language/functions/contains) tests whether a given list or set contains +* [`contains`](/terraform/language/functions/contains) tests whether a given list or set contains a given element value. -* [`setintersection`](/language/functions/setintersection) computes the _intersection_ of +* [`setintersection`](/terraform/language/functions/setintersection) computes the _intersection_ of multiple sets. -* [`setproduct`](/language/functions/setproduct) computes the _Cartesian product_ of multiple +* [`setproduct`](/terraform/language/functions/setproduct) computes the _Cartesian product_ of multiple sets. -* [`setsubtract`](/language/functions/setsubtract) computes the _relative complement_ of two sets +* [`setsubtract`](/terraform/language/functions/setsubtract) computes the _relative complement_ of two sets diff --git a/website/docs/language/functions/sha1.mdx b/website/docs/language/functions/sha1.mdx index f5e2e04c62..dde0142fd3 100644 --- a/website/docs/language/functions/sha1.mdx +++ b/website/docs/language/functions/sha1.mdx @@ -27,5 +27,5 @@ relevant literature to understand the security implications. ## Related Functions -* [`filesha1`](/language/functions/filesha1) calculates the same hash from +* [`filesha1`](/terraform/language/functions/filesha1) calculates the same hash from the contents of a file rather than from a string value. diff --git a/website/docs/language/functions/sha256.mdx b/website/docs/language/functions/sha256.mdx index 9dee5324b8..a4bba263e2 100644 --- a/website/docs/language/functions/sha256.mdx +++ b/website/docs/language/functions/sha256.mdx @@ -25,7 +25,7 @@ b94d27b9934d3e08a52e52d7da7dabfac484efe37a5380ee9088f7ace2efcde9 ## Related Functions -* [`filesha256`](/language/functions/filesha256) calculates the same hash from +* [`filesha256`](/terraform/language/functions/filesha256) calculates the same hash from the contents of a file rather than from a string value. -* [`base64sha256`](/language/functions/base64sha256) calculates the same hash but returns +* [`base64sha256`](/terraform/language/functions/base64sha256) calculates the same hash but returns the result in a more-compact Base64 encoding. diff --git a/website/docs/language/functions/sha512.mdx b/website/docs/language/functions/sha512.mdx index 37e68753d9..83f55882f2 100644 --- a/website/docs/language/functions/sha512.mdx +++ b/website/docs/language/functions/sha512.mdx @@ -23,7 +23,7 @@ then encoded to lowercase hexadecimal digits before returning. ## Related Functions -* [`filesha512`](/language/functions/filesha512) calculates the same hash from +* [`filesha512`](/terraform/language/functions/filesha512) calculates the same hash from the contents of a file rather than from a string value. -* [`base64sha512`](/language/functions/base64sha512) calculates the same hash but returns +* [`base64sha512`](/terraform/language/functions/base64sha512) calculates the same hash but returns the result in a more-compact Base64 encoding. diff --git a/website/docs/language/functions/slice.mdx b/website/docs/language/functions/slice.mdx index dfc0ddd5c1..570c282dd5 100644 --- a/website/docs/language/functions/slice.mdx +++ b/website/docs/language/functions/slice.mdx @@ -27,5 +27,5 @@ list. ## Related Functions -* [`substr`](/language/functions/substr) performs a similar function for characters in a +* [`substr`](/terraform/language/functions/substr) performs a similar function for characters in a string, although it uses a length instead of an end index. diff --git a/website/docs/language/functions/split.mdx b/website/docs/language/functions/split.mdx index 50036ed804..2d22e03a24 100644 --- a/website/docs/language/functions/split.mdx +++ b/website/docs/language/functions/split.mdx @@ -35,5 +35,5 @@ split(separator, string) ## Related Functions -* [`join`](/language/functions/join) performs the opposite operation: producing a string +* [`join`](/terraform/language/functions/join) performs the opposite operation: producing a string joining together a list of strings with a given separator. diff --git a/website/docs/language/functions/startswith.mdx b/website/docs/language/functions/startswith.mdx index c1cf70679f..d9ff41c912 100644 --- a/website/docs/language/functions/startswith.mdx +++ b/website/docs/language/functions/startswith.mdx @@ -24,4 +24,4 @@ false ## Related Functions -- [`endswith`](/language/functions/endswith) takes two values: a string to check and a suffix string. The function returns true if the first string ends with that exact suffix. \ No newline at end of file +- [`endswith`](/terraform/language/functions/endswith) takes two values: a string to check and a suffix string. The function returns true if the first string ends with that exact suffix. \ No newline at end of file diff --git a/website/docs/language/functions/strrev.mdx b/website/docs/language/functions/strrev.mdx index b94949c2c0..f5e1e36a2a 100644 --- a/website/docs/language/functions/strrev.mdx +++ b/website/docs/language/functions/strrev.mdx @@ -23,4 +23,4 @@ olleh ## Related Functions -* [`reverse`](/language/functions/reverse) reverses a sequence. +* [`reverse`](/terraform/language/functions/reverse) reverses a sequence. diff --git a/website/docs/language/functions/templatefile.mdx b/website/docs/language/functions/templatefile.mdx index eb51407142..5c81d93b19 100644 --- a/website/docs/language/functions/templatefile.mdx +++ b/website/docs/language/functions/templatefile.mdx @@ -15,7 +15,7 @@ templatefile(path, vars) ``` The template syntax is the same as for -[string templates](/language/expressions/strings#string-templates) +[string templates](/terraform/language/expressions/strings#string-templates) in the main Terraform language, including interpolation sequences delimited with `${` ... `}`. This function just allows longer template sequences to be factored out into a separate file for readability. @@ -99,9 +99,9 @@ YAML that will be interpreted correctly when using lots of individual interpolation sequences and directives. Instead, you can write a template that consists only of a single interpolated -call to either [`jsonencode`](/language/functions/jsonencode) or -[`yamlencode`](/language/functions/yamlencode), specifying the value to encode using -[normal Terraform expression syntax](/language/expressions) +call to either [`jsonencode`](/terraform/language/functions/jsonencode) or +[`yamlencode`](/terraform/language/functions/yamlencode), specifying the value to encode using +[normal Terraform expression syntax](/terraform/language/expressions) as in the following examples: ``` @@ -121,9 +121,9 @@ this will produce a valid JSON or YAML representation of the given data structure, without the need to manually handle escaping or delimiters. In the latest examples above, the repetition based on elements of `ip_addrs` is achieved by using a -[`for` expression](/language/expressions/for) +[`for` expression](/terraform/language/expressions/for) rather than by using -[template directives](/language/expressions/strings#directives). +[template directives](/terraform/language/expressions/strings#directives). ```json {"backends":["10.0.0.1:8080","10.0.0.2:8080"]} @@ -142,9 +142,9 @@ locals { ``` For more information, see the main documentation for -[`jsonencode`](/language/functions/jsonencode) and [`yamlencode`](/language/functions/yamlencode). +[`jsonencode`](/terraform/language/functions/jsonencode) and [`yamlencode`](/terraform/language/functions/yamlencode). ## Related Functions -* [`file`](/language/functions/file) reads a file from disk and returns its literal contents +* [`file`](/terraform/language/functions/file) reads a file from disk and returns its literal contents without any template interpretation. diff --git a/website/docs/language/functions/textdecodebase64.mdx b/website/docs/language/functions/textdecodebase64.mdx index 12ede76aab..2ee2007dc1 100644 --- a/website/docs/language/functions/textdecodebase64.mdx +++ b/website/docs/language/functions/textdecodebase64.mdx @@ -25,7 +25,7 @@ Terraform supports only a subset of the registered encodings, and the encoding support may vary between Terraform versions. Terraform accepts the encoding name `UTF-8`, which will produce the same result -as [`base64decode`](/language/functions/base64decode). +as [`base64decode`](/terraform/language/functions/base64decode). ## Examples @@ -36,7 +36,7 @@ Hello World ## Related Functions -* [`textencodebase64`](/language/functions/textencodebase64) performs the opposite operation, +* [`textencodebase64`](/terraform/language/functions/textencodebase64) performs the opposite operation, applying target encoding and then Base64 to a string. -* [`base64decode`](/language/functions/base64decode) is effectively a shorthand for +* [`base64decode`](/terraform/language/functions/base64decode) is effectively a shorthand for `textdecodebase64` where the character encoding is fixed as `UTF-8`. diff --git a/website/docs/language/functions/textencodebase64.mdx b/website/docs/language/functions/textencodebase64.mdx index 387a749667..b467c2cb40 100644 --- a/website/docs/language/functions/textencodebase64.mdx +++ b/website/docs/language/functions/textencodebase64.mdx @@ -31,7 +31,7 @@ support may vary between Terraform versions. In particular Terraform supports therefore sometimes expected by Windows-originated software such as PowerShell. Terraform also accepts the encoding name `UTF-8`, which will produce the same -result as [`base64encode`](/language/functions/base64encode). +result as [`base64encode`](/terraform/language/functions/base64encode). ## Examples @@ -42,10 +42,10 @@ SABlAGwAbABvACAAVwBvAHIAbABkAA== ## Related Functions -* [`textdecodebase64`](/language/functions/textdecodebase64) performs the opposite operation, +* [`textdecodebase64`](/terraform/language/functions/textdecodebase64) performs the opposite operation, decoding Base64 data and interpreting it as a particular character encoding. -* [`base64encode`](/language/functions/base64encode) applies Base64 encoding of the UTF-8 +* [`base64encode`](/terraform/language/functions/base64encode) applies Base64 encoding of the UTF-8 encoding of a string. -* [`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, without creating an intermediate Unicode string. diff --git a/website/docs/language/functions/timeadd.mdx b/website/docs/language/functions/timeadd.mdx index 14d889b0c0..f255237cb4 100644 --- a/website/docs/language/functions/timeadd.mdx +++ b/website/docs/language/functions/timeadd.mdx @@ -35,4 +35,4 @@ of adding the given direction to the given timestamp. # Related Functions -* [`timecmp`](/language/functions/timecmp) determines an ordering for two timestamps. +* [`timecmp`](/terraform/language/functions/timecmp) determines an ordering for two timestamps. diff --git a/website/docs/language/functions/timecmp.mdx b/website/docs/language/functions/timecmp.mdx index cf4f910af2..2c078a9b4e 100644 --- a/website/docs/language/functions/timecmp.mdx +++ b/website/docs/language/functions/timecmp.mdx @@ -44,7 +44,7 @@ both be strings conforming to this syntax. ``` `timecmp` can be particularly useful in defining -[custom condition checks](/language/expressions/custom-conditions) that +[custom condition checks](/terraform/language/expressions/custom-conditions) that involve a specified timestamp being within a particular range. For example, the following resource postcondition would raise an error if a TLS certificate (or other expiring object) expires sooner than 30 days from the time of @@ -61,6 +61,6 @@ the "apply" step: ## Related Functions -* [`timestamp`](/language/functions/timestamp) returns the current timestamp when it is evaluated +* [`timestamp`](/terraform/language/functions/timestamp) returns the current timestamp when it is evaluated during the apply step. -* [`timeadd`](/language/functions/timeadd) can perform arithmetic on timestamps by adding or removing a specified duration. +* [`timeadd`](/terraform/language/functions/timeadd) can perform arithmetic on timestamps by adding or removing a specified duration. diff --git a/website/docs/language/functions/timestamp.mdx b/website/docs/language/functions/timestamp.mdx index d52878c8b1..3920e45271 100644 --- a/website/docs/language/functions/timestamp.mdx +++ b/website/docs/language/functions/timestamp.mdx @@ -18,7 +18,7 @@ The result of this function will change every second, so using this function directly with resource attributes will cause a diff to be detected on every Terraform run. We do not recommend using this function in resource attributes, but in rare cases it can be used in conjunction with -[the `ignore_changes` lifecycle meta-argument](/language/meta-arguments/lifecycle#ignore_changes) +[the `ignore_changes` lifecycle meta-argument](/terraform/language/meta-arguments/lifecycle#ignore_changes) to take the timestamp only on initial creation of the resource. For more stable time handling, see the [Time Provider](https://registry.terraform.io/providers/hashicorp/time). @@ -35,5 +35,5 @@ taken only once the plan is being applied. ## Related Functions -* [`formatdate`](/language/functions/formatdate) can convert the resulting timestamp to +* [`formatdate`](/terraform/language/functions/formatdate) can convert the resulting timestamp to other date and time formats. diff --git a/website/docs/language/functions/title.mdx b/website/docs/language/functions/title.mdx index 2723d79462..ba7a6d98bb 100644 --- a/website/docs/language/functions/title.mdx +++ b/website/docs/language/functions/title.mdx @@ -20,5 +20,5 @@ This function uses Unicode's definition of letters and of upper- and lowercase. ## Related Functions -* [`upper`](/language/functions/upper) converts _all_ letters in a string to uppercase. -* [`lower`](/language/functions/lower) converts all letters in a string to lowercase. +* [`upper`](/terraform/language/functions/upper) converts _all_ letters in a string to uppercase. +* [`lower`](/terraform/language/functions/lower) converts all letters in a string to lowercase. diff --git a/website/docs/language/functions/trim.mdx b/website/docs/language/functions/trim.mdx index 96583bd154..7cdd03283e 100644 --- a/website/docs/language/functions/trim.mdx +++ b/website/docs/language/functions/trim.mdx @@ -34,7 +34,7 @@ and end of the string specified in the first argument. ## Related Functions -* [`trimprefix`](/language/functions/trimprefix) removes a word from the start of a string. -* [`trimsuffix`](/language/functions/trimsuffix) removes a word from the end of a string. -* [`trimspace`](/language/functions/trimspace) removes all types of whitespace from +* [`trimprefix`](/terraform/language/functions/trimprefix) removes a word from the start of a string. +* [`trimsuffix`](/terraform/language/functions/trimsuffix) removes a word from the end of a string. +* [`trimspace`](/terraform/language/functions/trimspace) removes all types of whitespace from both the start and the end of a string. diff --git a/website/docs/language/functions/trimprefix.mdx b/website/docs/language/functions/trimprefix.mdx index 9b141ee7c7..51b931bdb1 100644 --- a/website/docs/language/functions/trimprefix.mdx +++ b/website/docs/language/functions/trimprefix.mdx @@ -23,7 +23,7 @@ helloworld ## Related Functions -* [`trim`](/language/functions/trim) removes characters at the start and end of a string. -* [`trimsuffix`](/language/functions/trimsuffix) removes a word from the end of a string. -* [`trimspace`](/language/functions/trimspace) removes all types of whitespace from +* [`trim`](/terraform/language/functions/trim) removes characters at the start and end of a string. +* [`trimsuffix`](/terraform/language/functions/trimsuffix) removes a word from the end of a string. +* [`trimspace`](/terraform/language/functions/trimspace) removes all types of whitespace from both the start and the end of a string. diff --git a/website/docs/language/functions/trimspace.mdx b/website/docs/language/functions/trimspace.mdx index 950e3f935d..a1eafaba91 100644 --- a/website/docs/language/functions/trimspace.mdx +++ b/website/docs/language/functions/trimspace.mdx @@ -23,5 +23,5 @@ hello ## Related Functions -* [`chomp`](/language/functions/chomp) removes just line ending characters from the _end_ of +* [`chomp`](/terraform/language/functions/chomp) removes just line ending characters from the _end_ of a string. diff --git a/website/docs/language/functions/trimsuffix.mdx b/website/docs/language/functions/trimsuffix.mdx index d7aa7a296f..31f12f225a 100644 --- a/website/docs/language/functions/trimsuffix.mdx +++ b/website/docs/language/functions/trimsuffix.mdx @@ -18,7 +18,7 @@ hello ## Related Functions -* [`trim`](/language/functions/trim) removes characters at the start and end of a string. -* [`trimprefix`](/language/functions/trimprefix) removes a word from the start of a string. -* [`trimspace`](/language/functions/trimspace) removes all types of whitespace from +* [`trim`](/terraform/language/functions/trim) removes characters at the start and end of a string. +* [`trimprefix`](/terraform/language/functions/trimprefix) removes a word from the start of a string. +* [`trimspace`](/terraform/language/functions/trimspace) removes all types of whitespace from both the start and the end of a string. diff --git a/website/docs/language/functions/try.mdx b/website/docs/language/functions/try.mdx index a23d1def50..fffc932f0a 100644 --- a/website/docs/language/functions/try.mdx +++ b/website/docs/language/functions/try.mdx @@ -107,5 +107,5 @@ A local value with the name "nonexist" has not been declared. ## Related Functions -* [`can`](/language/functions/can), which tries evaluating an expression and returns a +* [`can`](/terraform/language/functions/can), which tries evaluating an expression and returns a boolean value indicating whether it succeeded. diff --git a/website/docs/language/functions/upper.mdx b/website/docs/language/functions/upper.mdx index 134a93b03b..874e40fe5b 100644 --- a/website/docs/language/functions/upper.mdx +++ b/website/docs/language/functions/upper.mdx @@ -22,5 +22,5 @@ This function uses Unicode's definition of letters and of upper- and lowercase. ## Related Functions -* [`lower`](/language/functions/lower) converts letters in a string to _lowercase_. -* [`title`](/language/functions/title) converts the first letter of each word in a string to uppercase. +* [`lower`](/terraform/language/functions/lower) converts letters in a string to _lowercase_. +* [`title`](/terraform/language/functions/title) converts the first letter of each word in a string to uppercase. diff --git a/website/docs/language/functions/uuid.mdx b/website/docs/language/functions/uuid.mdx index b203060226..2b7967c360 100644 --- a/website/docs/language/functions/uuid.mdx +++ b/website/docs/language/functions/uuid.mdx @@ -16,11 +16,11 @@ This function produces a new value each time it is called, and so using it directly in resource arguments will result in spurious diffs. We do not recommend using the `uuid` function in resource configurations, but it can be used with care in conjunction with -[the `ignore_changes` lifecycle meta-argument](/language/meta-arguments/lifecycle#ignore_changes). +[the `ignore_changes` lifecycle meta-argument](/terraform/language/meta-arguments/lifecycle#ignore_changes). In most cases we recommend using [the `random` provider](https://registry.terraform.io/providers/hashicorp/random/latest/docs) instead, since it allows the one-time generation of random values that are -then retained in the Terraform [state](/language/state) for use by +then retained in the Terraform [state](/terraform/language/state) for use by future operations. In particular, [`random_id`](https://registry.terraform.io/providers/hashicorp/random/latest/docs/resources/id) can generate results with equivalent randomness to the `uuid` function. @@ -34,4 +34,4 @@ b5ee72a3-54dd-c4b8-551c-4bdc0204cedb ## Related Functions -* [`uuidv5`](/language/functions/uuidv5), which generates name-based UUIDs. +* [`uuidv5`](/terraform/language/functions/uuidv5), which generates name-based UUIDs. diff --git a/website/docs/language/functions/uuidv5.mdx b/website/docs/language/functions/uuidv5.mdx index e80e5dc1f4..0b45bb57cc 100644 --- a/website/docs/language/functions/uuidv5.mdx +++ b/website/docs/language/functions/uuidv5.mdx @@ -16,7 +16,7 @@ uuidv5(namespace, name) ``` Unlike the pseudo-random UUIDs generated by -[`uuid`](/language/functions/uuid), name-based UUIDs derive from namespace and an name, +[`uuid`](/terraform/language/functions/uuid), name-based UUIDs derive from namespace and an name, producing the same UUID value every time if the namespace and name are unchanged. @@ -77,4 +77,4 @@ defined it. ## Related Functions -* [`uuid`](/language/functions/uuid), which generates pseudorandom UUIDs. +* [`uuid`](/terraform/language/functions/uuid), which generates pseudorandom UUIDs. diff --git a/website/docs/language/functions/values.mdx b/website/docs/language/functions/values.mdx index 40a6d6549d..b7362ab5d2 100644 --- a/website/docs/language/functions/values.mdx +++ b/website/docs/language/functions/values.mdx @@ -10,7 +10,7 @@ in that map. The values are returned in lexicographical order by their corresponding _keys_, so the values will be returned in the same order as their keys would be -returned from [`keys`](/language/functions/keys). +returned from [`keys`](/terraform/language/functions/keys). ## Examples @@ -25,4 +25,4 @@ returned from [`keys`](/language/functions/keys). ## Related Functions -* [`keys`](/language/functions/keys) returns a list of the _keys_ from a map. +* [`keys`](/terraform/language/functions/keys) returns a list of the _keys_ from a map. diff --git a/website/docs/language/functions/yamldecode.mdx b/website/docs/language/functions/yamldecode.mdx index 5f894e5a32..d1fa41eb33 100644 --- a/website/docs/language/functions/yamldecode.mdx +++ b/website/docs/language/functions/yamldecode.mdx @@ -14,7 +14,7 @@ This function supports a subset of [YAML 1.2](https://yaml.org/spec/1.2/spec.htm as described below. This function maps YAML values to -[Terraform language values](/language/expressions/types) +[Terraform language values](/terraform/language/expressions/types) in the following way: | YAML type | Terraform type | @@ -93,7 +93,7 @@ Call to function "yamldecode" failed: unsupported tag "!not-supported". ## Related Functions -- [`jsondecode`](/language/functions/jsondecode) is a similar operation using JSON instead +- [`jsondecode`](/terraform/language/functions/jsondecode) is a similar operation using JSON instead of YAML. -- [`yamlencode`](/language/functions/yamlencode) performs the opposite operation, _encoding_ +- [`yamlencode`](/terraform/language/functions/yamlencode) performs the opposite operation, _encoding_ a value as YAML. diff --git a/website/docs/language/functions/yamlencode.mdx b/website/docs/language/functions/yamlencode.mdx index af2dba3bf9..c06012492e 100644 --- a/website/docs/language/functions/yamlencode.mdx +++ b/website/docs/language/functions/yamlencode.mdx @@ -9,7 +9,7 @@ description: The yamlencode function encodes a given value as a YAML string. [YAML 1.2](https://yaml.org/spec/1.2/spec.html) block syntax. This function maps -[Terraform language values](/language/expressions/types) +[Terraform language values](/terraform/language/expressions/types) to YAML tags in the following way: | Terraform type | YAML type | @@ -33,7 +33,7 @@ identical value, but the Terraform language automatic type conversion rules mean that this is rarely a problem in practice. YAML is a superset of JSON, and so where possible we recommend generating -JSON using [`jsonencode`](/language/functions/jsonencode) instead, even if +JSON using [`jsonencode`](/terraform/language/functions/jsonencode) instead, even if a remote system supports YAML. JSON syntax is equivalent to flow-style YAML and Terraform can present detailed structural change information for JSON values in plans, whereas Terraform will treat block-style YAML just as a normal @@ -66,12 +66,12 @@ humans. `yamlencode` always uses YAML's "block style" for mappings and sequences, unless the mapping or sequence is empty. To generate flow-style YAML, use -[`jsonencode`](/language/functions/jsonencode) instead: YAML flow-style is a superset +[`jsonencode`](/terraform/language/functions/jsonencode) instead: YAML flow-style is a superset of JSON syntax. ## Related Functions -- [`jsonencode`](/language/functions/jsonencode) is a similar operation using JSON instead +- [`jsonencode`](/terraform/language/functions/jsonencode) is a similar operation using JSON instead of YAML. -- [`yamldecode`](/language/functions/yamldecode) performs the opposite operation, _decoding_ +- [`yamldecode`](/terraform/language/functions/yamldecode) performs the opposite operation, _decoding_ a YAML string to obtain its represented value. diff --git a/website/docs/language/index.mdx b/website/docs/language/index.mdx index ca63d372b0..c035ac79b2 100644 --- a/website/docs/language/index.mdx +++ b/website/docs/language/index.mdx @@ -7,21 +7,21 @@ description: >- # Terraform Language Documentation This is the documentation for Terraform's configuration language. It is relevant -to users of [Terraform CLI](/cli), +to users of [Terraform CLI](/terraform/cli), [Terraform Cloud](https://cloud.hashicorp.com/products/terraform), and -[Terraform Enterprise](/enterprise). Terraform's language is +[Terraform Enterprise](/terraform/enterprise). Terraform's language is its primary user interface. Configuration files you write in Terraform language tell Terraform what plugins to install, what infrastructure to create, and what data to fetch. Terraform language also lets you define dependencies between resources and create multiple similar resources from a single configuration block. -> **Hands-on:** Try the [Write Terraform Configuration](https://learn.hashicorp.com/collections/terraform/configuration-language) tutorials. +> **Hands-on:** Try the [Write Terraform Configuration](/terraform/tutorials/configuration-language) tutorials. ## About the Terraform Language The main purpose of the Terraform language is declaring -[resources](/language/resources), which represent infrastructure objects. All other +[resources](/terraform/language/resources), which represent infrastructure objects. All other language features exist only to make the definition of resources more flexible and convenient. diff --git a/website/docs/language/meta-arguments/count.mdx b/website/docs/language/meta-arguments/count.mdx index 9cf1709ea7..f08b3f7c11 100644 --- a/website/docs/language/meta-arguments/count.mdx +++ b/website/docs/language/meta-arguments/count.mdx @@ -12,16 +12,16 @@ previous versions can only use it with resources. -> **Note:** A given resource or module block cannot use both `count` and `for_each`. -> **Hands-on:** Try the [Manage Similar Resources With Count](https://learn.hashicorp.com/tutorials/terraform/count?in=terraform/0-13&utm_source=WEBSITE&utm_medium=WEB_IO&utm_offer=ARTICLE_PAGE&utm_content=DOCS) tutorial. +> **Hands-on:** Try the [Manage Similar Resources With Count](/terraform/tutorials/0-13/count?utm_source=WEBSITE&utm_medium=WEB_IO&utm_offer=ARTICLE_PAGE&utm_content=DOCS) tutorial. -By default, a [resource block](/language/resources/syntax) configures one real +By default, a [resource block](/terraform/language/resources/syntax) configures one real infrastructure object. (Similarly, a -[module block](/language/modules/syntax) includes a +[module block](/terraform/language/modules/syntax) includes a child module's contents into the configuration one time.) However, sometimes you want to manage several similar objects (like a fixed pool of compute instances) without writing a separate block for each one. Terraform has two ways to do this: -`count` and [`for_each`](/language/meta-arguments/for_each). +`count` and [`for_each`](/terraform/language/meta-arguments/for_each). If a resource or module block includes a `count` argument whose value is a whole number, Terraform will create that many instances. @@ -60,7 +60,7 @@ This object has one attribute: ## Using Expressions in `count` -The `count` meta-argument accepts numeric [expressions](/language/expressions). +The `count` meta-argument accepts numeric [expressions](/terraform/language/expressions). However, unlike most arguments, the `count` value must be known _before_ Terraform performs any remote resource actions. This means `count` can't refer to any resource attributes that aren't known until after a diff --git a/website/docs/language/meta-arguments/depends_on.mdx b/website/docs/language/meta-arguments/depends_on.mdx index 9edccf29cd..5f12751b53 100644 --- a/website/docs/language/meta-arguments/depends_on.mdx +++ b/website/docs/language/meta-arguments/depends_on.mdx @@ -14,11 +14,11 @@ Use the `depends_on` meta-argument to handle hidden resource or module dependenc ## Processing and Planning Consequences -The `depends_on` meta-argument instructs Terraform to complete all actions on the dependency object (including Read actions) before performing actions on the object declaring the dependency. When the dependency object is an entire module, `depends_on` affects the order in which Terraform processes all of the resources and data sources associated with that module. Refer to [Resource Dependencies](/language/resources/behavior#resource-dependencies) and [Data Resource Dependencies](/language/data-sources#data-resource-dependencies) for more details. +The `depends_on` meta-argument instructs Terraform to complete all actions on the dependency object (including Read actions) before performing actions on the object declaring the dependency. When the dependency object is an entire module, `depends_on` affects the order in which Terraform processes all of the resources and data sources associated with that module. Refer to [Resource Dependencies](/terraform/language/resources/behavior#resource-dependencies) and [Data Resource Dependencies](/terraform/language/data-sources#data-resource-dependencies) for more details. You should use `depends_on` as a last resort because it can cause Terraform to create more conservative plans that replace more resources than necessary. For example, Terraform may treat more values as unknown “(known after apply)” because it is uncertain what changes will occur on the upstream object. This is especially likely when you use `depends_on` for modules. -Instead of `depends_on`, we recommend using [expression references](/language/expressions/references) to imply dependencies when possible. Expression references let Terraform understand which value the reference derives from and avoid planning changes if that particular value hasn’t changed, even if other parts of the upstream object have planned changes. +Instead of `depends_on`, we recommend using [expression references](/terraform/language/expressions/references) to imply dependencies when possible. Expression references let Terraform understand which value the reference derives from and avoid planning changes if that particular value hasn’t changed, even if other parts of the upstream object have planned changes. ## Usage diff --git a/website/docs/language/meta-arguments/for_each.mdx b/website/docs/language/meta-arguments/for_each.mdx index 7839e0e475..423167cdd0 100644 --- a/website/docs/language/meta-arguments/for_each.mdx +++ b/website/docs/language/meta-arguments/for_each.mdx @@ -7,16 +7,16 @@ description: >- # The `for_each` Meta-Argument -By default, a [resource block](/language/resources/syntax) configures one real +By default, a [resource block](/terraform/language/resources/syntax) configures one real infrastructure object (and similarly, a -[module block](/language/modules/syntax) includes a +[module block](/terraform/language/modules/syntax) includes a child module's contents into the configuration one time). However, sometimes you want to manage several similar objects (like a fixed pool of compute instances) without writing a separate block for each one. Terraform has two ways to do this: -[`count`](/language/meta-arguments/count) and `for_each`. +[`count`](/terraform/language/meta-arguments/count) and `for_each`. -> **Hands-on:** Try the [Manage Similar Resources With For Each](https://learn.hashicorp.com/tutorials/terraform/for-each?in=terraform/configuration-language) tutorial. +> **Hands-on:** Try the [Manage Similar Resources With For Each](/terraform/tutorials/configuration-language/for-each) tutorial. If a resource or module block includes a `for_each` argument whose value is a map or a set of strings, Terraform creates one instance for each member of @@ -109,16 +109,16 @@ that cannot be determined before apply, and a `-target` may be needed. including `uuid`, `bcrypt`, or `timestamp`, as their evaluation is deferred during the main evaluation step. -Sensitive values, such as [sensitive input variables](/language/values/variables#suppressing-values-in-cli-output), -[sensitive outputs](/language/values/outputs#sensitive-suppressing-values-in-cli-output), -or [sensitive resource attributes](/language/expressions/references#sensitive-resource-attributes), +Sensitive values, such as [sensitive input variables](/terraform/language/values/variables#suppressing-values-in-cli-output), +[sensitive outputs](/terraform/language/values/outputs#sensitive-suppressing-values-in-cli-output), +or [sensitive resource attributes](/terraform/language/expressions/references#sensitive-resource-attributes), cannot be used as arguments to `for_each`. The value used in `for_each` is used to identify the resource instance and will always be disclosed in UI output, which is why sensitive values are not allowed. Attempts to use sensitive values as `for_each` arguments will result in an error. If you transform a value containing sensitive data into an argument to be used in `for_each`, be aware that -[most functions in Terraform will return a sensitive result if given an argument with any sensitive content](/language/expressions/function-calls#using-sensitive-data-as-function-arguments). +[most functions in Terraform will return a sensitive result if given an argument with any sensitive content](/terraform/language/expressions/function-calls#using-sensitive-data-as-function-arguments). In many cases, you can achieve similar results to a function used for this purpose by using a `for` expression. For example, if you would like to call `keys(local.map)`, where `local.map` is an object with sensitive values (but non-sensitive keys), you can create a @@ -126,7 +126,7 @@ value to pass to `for_each` with `toset([for k,v in local.map : k])`. ## Using Expressions in `for_each` -The `for_each` meta-argument accepts map or set [expressions](/language/expressions). +The `for_each` meta-argument accepts map or set [expressions](/terraform/language/expressions). However, unlike most arguments, the `for_each` value must be known _before_ Terraform performs any remote resource actions. This means `for_each` can't refer to any resource attributes that aren't known until after a @@ -135,7 +135,7 @@ an object is created). The `for_each` value must be a map or set with one element per desired resource instance. To use a sequence as the `for_each` value, you must use an expression -that explicitly returns a set value, like the [toset](/language/functions/toset) +that explicitly returns a set value, like the [toset](/terraform/language/functions/toset) function. To prevent unwanted surprises during conversion, the `for_each` argument does not implicitly convert lists or tuples to sets. If you need to declare resource instances based on a nested @@ -144,10 +144,10 @@ can use Terraform expressions and functions to derive a suitable value. For example: - Transform a multi-level nested structure into a flat list by - [using nested `for` expressions with the `flatten` function](/language/functions/flatten#flattening-nested-structures-for-for_each). + [using nested `for` expressions with the `flatten` function](/terraform/language/functions/flatten#flattening-nested-structures-for-for_each). - Produce an exhaustive list of combinations of elements from two or more collections by - [using the `setproduct` function inside a `for` expression](/language/functions/setproduct#finding-combinations-for-for_each). + [using the `setproduct` function inside a `for` expression](/terraform/language/functions/setproduct#finding-combinations-for-for_each). ### Chaining `for_each` Between Resources @@ -227,7 +227,7 @@ as a whole. ## Using Sets The Terraform language doesn't have a literal syntax for -[set values](/language/expressions/type-constraints#collection-types), but you can use the `toset` +[set values](/terraform/language/expressions/type-constraints#collection-types), but you can use the `toset` function to explicitly convert a list of strings to a set: ```hcl @@ -256,7 +256,7 @@ removes any duplicate elements. `toset(["b", "a", "b"])` will produce a set containing only `"a"` and `"b"` in no particular order; the second `"b"` is discarded. -If you are writing a module with an [input variable](/language/values/variables) that +If you are writing a module with an [input variable](/terraform/language/values/variables) that will be used as a set of strings for `for_each`, you can set its type to `set(string)` to avoid the need for an explicit type conversion: diff --git a/website/docs/language/meta-arguments/lifecycle.mdx b/website/docs/language/meta-arguments/lifecycle.mdx index 300654528e..a5a995bbda 100644 --- a/website/docs/language/meta-arguments/lifecycle.mdx +++ b/website/docs/language/meta-arguments/lifecycle.mdx @@ -7,9 +7,9 @@ description: >- # The `lifecycle` Meta-Argument -> **Hands-on:** Try the [Lifecycle Management](https://learn.hashicorp.com/tutorials/terraform/resource-lifecycle?utm_source=WEBSITE&utm_medium=WEB_IO&utm_offer=ARTICLE_PAGE&utm_content=DOCS) tutorial. +> **Hands-on:** Try the [Lifecycle Management](/terraform/tutorials/state/resource-lifecycle?utm_source=WEBSITE&utm_medium=WEB_IO&utm_offer=ARTICLE_PAGE&utm_content=DOCS) tutorial. -The [Resource Behavior](/language/resources/behavior) page describes the general lifecycle for resources. Some details of +The [Resource Behavior](/terraform/language/resources/behavior) page describes the general lifecycle for resources. Some details of that behavior can be customized using the special nested `lifecycle` block within a resource block body: @@ -144,7 +144,7 @@ The arguments available within a `lifecycle` block are `create_before_destroy`, } ``` - `replace_triggered_by` allows only resource addresses because the decision is based on the planned actions for all of the given resources. Plain values such as local values or input variables do not have planned actions of their own, but you can treat them with a resource-like lifecycle by using them with [the `terraform_data` resource type](/language/resources/terraform-data). + `replace_triggered_by` allows only resource addresses because the decision is based on the planned actions for all of the given resources. Plain values such as local values or input variables do not have planned actions of their own, but you can treat them with a resource-like lifecycle by using them with [the `terraform_data` resource type](/terraform/language/resources/terraform-data). ## Custom Condition Checks @@ -168,7 +168,7 @@ resource "aws_instance" "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 Conditions](/language/expressions/custom-conditions#preconditions-and-postconditions) for more details. +Refer to [Custom Conditions](/terraform/language/expressions/custom-conditions#preconditions-and-postconditions) for more details. ## Literal Values Only diff --git a/website/docs/language/meta-arguments/module-providers.mdx b/website/docs/language/meta-arguments/module-providers.mdx index 2b7f7d9a9e..3b7339cfdb 100644 --- a/website/docs/language/meta-arguments/module-providers.mdx +++ b/website/docs/language/meta-arguments/module-providers.mdx @@ -7,9 +7,9 @@ description: >- # The Module `providers` Meta-Argument -In a [module call](/language/modules/syntax) block, the +In a [module call](/terraform/language/modules/syntax) block, the optional `providers` meta-argument specifies which -[provider configurations](/language/providers/configuration) from the parent +[provider configurations](/terraform/language/providers/configuration) from the parent module will be available inside the child module. ```hcl @@ -38,7 +38,7 @@ module "example" { ## Default Behavior: Inherit Default Providers -If the child module does not declare any [configuration aliases](/language/modules/develop/providers#provider-aliases-within-modules), +If the child module does not declare any [configuration aliases](/terraform/language/modules/develop/providers#provider-aliases-within-modules), the `providers` argument is optional. If you omit it, a child module inherits all of the _default_ provider configurations from its parent module. (Default provider configurations are ones that don't use the `alias` argument.) @@ -123,4 +123,4 @@ names it needs. For more details and guidance about working with providers inside a re-usable child module, see -[Module Development: Providers Within Modules](/language/modules/develop/providers). +[Module Development: Providers Within Modules](/terraform/language/modules/develop/providers). diff --git a/website/docs/language/meta-arguments/resource-provider.mdx b/website/docs/language/meta-arguments/resource-provider.mdx index 683eaa3e01..a4b72a0b64 100644 --- a/website/docs/language/meta-arguments/resource-provider.mdx +++ b/website/docs/language/meta-arguments/resource-provider.mdx @@ -11,7 +11,7 @@ The `provider` meta-argument specifies which provider configuration to use for a overriding Terraform's default behavior of selecting one based on the resource type name. Its value should be an unquoted `.` reference. -As described in [Provider Configuration](/language/providers/configuration), you can optionally +As described in [Provider Configuration](/terraform/language/providers/configuration), you can optionally create multiple configurations for a single provider (usually to manage resources in different regions of multi-region services). Each provider can have one default configuration, and any number of alternate configurations that @@ -53,7 +53,7 @@ ensure that the provider is fully configured before any resource actions are taken. The `provider` meta-argument expects -[a `.` reference](/language/providers/configuration#referring-to-alternate-provider-configurations), +[a `.` reference](/terraform/language/providers/configuration#referring-to-alternate-provider-configurations), which does not need to be quoted. Arbitrary expressions are not permitted for `provider` because it must be resolved while Terraform is constructing the dependency graph, before it is safe to evaluate expressions. diff --git a/website/docs/language/modules/develop/composition.mdx b/website/docs/language/modules/develop/composition.mdx index c86aa380a6..de55a0775c 100644 --- a/website/docs/language/modules/develop/composition.mdx +++ b/website/docs/language/modules/develop/composition.mdx @@ -193,7 +193,7 @@ Every module has implicit assumptions and guarantees that define what data it ex - **Assumption:** A condition that must be true in order for the configuration of a particular resource to be usable. For example, an `aws_instance` configuration can have the assumption that the given AMI will always be configured for the `x86_64` CPU architecture. - **Guarantee:** A characteristic or behavior of an object that the rest of the configuration should be able to rely on. For example, an `aws_instance` configuration can have the guarantee that an EC2 instance will be running in a network that assigns it a private DNS record. -We recommend using [custom conditions](/language/expressions/custom-conditions) help capture and test for assumptions and guarantees. This helps future maintainers understand the configuration design and intent. Custom conditions also return useful information about errors earlier and in context, helping consumers more easily diagnose issues in their configurations. +We recommend using [custom conditions](/terraform/language/expressions/custom-conditions) help capture and test for assumptions and guarantees. This helps future maintainers understand the configuration design and intent. Custom conditions also return useful information about errors earlier and in context, helping consumers more easily diagnose issues in their configurations. The following examples creates a precondition that checks whether the EC2 instance has an encrypted root volume. @@ -331,7 +331,7 @@ Most modules contain `resource` blocks and thus describe infrastructure to be created and managed. It may sometimes be useful to write modules that do not describe any new infrastructure at all, but merely retrieve information about existing infrastructure that was created elsewhere using -[data sources](/language/data-sources). +[data sources](/terraform/language/data-sources). As with conventional modules, we suggest using this technique only when the module raises the level of abstraction in some way, in this case by @@ -367,7 +367,7 @@ data sources, or it could read saved information from a Consul cluster using [`consul_keys`](https://registry.terraform.io/providers/hashicorp/consul/latest/docs/data-sources/keys), or it might read the outputs directly from the state of the configuration that manages the network using -[`terraform_remote_state`](/language/state/remote-state-data). +[`terraform_remote_state`](/terraform/language/state/remote-state-data). The key benefit of this approach is that the source of this information can change over time without updating every configuration that depends on it. diff --git a/website/docs/language/modules/develop/index.mdx b/website/docs/language/modules/develop/index.mdx index bb41133b60..d4a321cd80 100644 --- a/website/docs/language/modules/develop/index.mdx +++ b/website/docs/language/modules/develop/index.mdx @@ -7,34 +7,34 @@ description: >- # Creating Modules -> **Hands-on:** Try the [Reuse Configuration with Modules](https://learn.hashicorp.com/collections/terraform/modules?utm_source=WEBSITE&utm_medium=WEB_IO&utm_offer=ARTICLE_PAGE&utm_content=DOCS) tutorials. +> **Hands-on:** Try the [Reuse Configuration with Modules](/terraform/tutorials/modules?utm_source=WEBSITE&utm_medium=WEB_IO&utm_offer=ARTICLE_PAGE&utm_content=DOCS) tutorials. A _module_ is a container for multiple resources that are used together. You can use modules to create lightweight abstractions, so that you can describe your infrastructure in terms of its architecture, rather than directly in terms of physical objects. -The `.tf` files in your working directory when you run [`terraform plan`](/cli/commands/plan) -or [`terraform apply`](/cli/commands/apply) together form the _root_ -module. That module may [call other modules](/language/modules/syntax#calling-a-child-module) +The `.tf` files in your working directory when you run [`terraform plan`](/terraform/cli/commands/plan) +or [`terraform apply`](/terraform/cli/commands/apply) together form the _root_ +module. That module may [call other modules](/terraform/language/modules/syntax#calling-a-child-module) and connect them together by passing output values from one to input values of another. -To learn how to _use_ modules, see [the Modules configuration section](/language/modules). +To learn how to _use_ modules, see [the Modules configuration section](/terraform/language/modules). This section is about _creating_ re-usable modules that other configurations can include using `module` blocks. ## Module structure Re-usable modules are defined using all of the same -[configuration language](/language) concepts we use in root modules. +[configuration language](/terraform/language) concepts we use in root modules. Most commonly, modules use: -* [Input variables](/language/values/variables) to accept values from +* [Input variables](/terraform/language/values/variables) to accept values from the calling module. -* [Output values](/language/values/outputs) to return results to the +* [Output values](/terraform/language/values/outputs) to return results to the calling module, which it can then use to populate arguments elsewhere. -* [Resources](/language/resources) to define one or more +* [Resources](/terraform/language/resources) to define one or more infrastructure objects that the module will manage. To define a module, create a new directory for it and place one or more `.tf` @@ -44,7 +44,7 @@ be re-used by lots of configurations you may wish to place it in its own version control repository. Modules can also call other modules using a `module` block, but we recommend -keeping the module tree relatively flat and using [module composition](/language/modules/develop/composition) +keeping the module tree relatively flat and using [module composition](/terraform/language/modules/develop/composition) as an alternative to a deeply-nested tree of modules, because this makes the individual modules easier to re-use in different combinations. @@ -74,11 +74,11 @@ calling module instead. You can also create no-code ready modules to enable the no-code provisioning workflow in Terraform Cloud. No-code provisioning lets users deploy a module's resources in Terraform Cloud without writing any Terraform configuration. -No-code ready modules have additional requirements and considerations. Refer to [Designing No-Code Ready Modules](/cloud-docs/no-code-provisioning/module-design) in the Terraform Cloud documentation for details. +No-code ready modules have additional requirements and considerations. Refer to [Designing No-Code Ready Modules](/terraform/cloud-docs/no-code-provisioning/module-design) in the Terraform Cloud documentation for details. ## Refactoring module resources -You can include [refactoring blocks](/language/modules/develop/refactoring) to record how resource +You can include [refactoring blocks](/terraform/language/modules/develop/refactoring) to record how resource names and module structure have changed from previous module versions. Terraform uses that information during planning to reinterpret existing objects as if they had been created at the corresponding new addresses, eliminating a diff --git a/website/docs/language/modules/develop/providers.mdx b/website/docs/language/modules/develop/providers.mdx index 717ef16618..8a4a540082 100644 --- a/website/docs/language/modules/develop/providers.mdx +++ b/website/docs/language/modules/develop/providers.mdx @@ -44,10 +44,10 @@ to reintroduce the provider configuration. ## Provider Version Constraints in Modules Although provider _configurations_ are shared between modules, each module must -declare its own [provider requirements](/language/providers/requirements), so that +declare its own [provider requirements](/terraform/language/providers/requirements), so that Terraform can ensure that there is a single version of the provider that is compatible with all modules in the configuration and to specify the -[source address](/language/providers/requirements#source-addresses) that serves as +[source address](/terraform/language/providers/requirements#source-addresses) that serves as the global (module-agnostic) identifier for a provider. To declare that a module requires particular versions of a specific provider, @@ -70,7 +70,7 @@ however, specify any of the configuration settings that determine what remote endpoints the provider will access, such as an AWS region; configuration settings come from provider _configurations_, and a particular overall Terraform configuration can potentially have -[several different configurations for the same provider](/language/providers/configuration#alias-multiple-provider-configurations). +[several different configurations for the same provider](/terraform/language/providers/configuration#alias-multiple-provider-configurations). ## Provider Aliases Within Modules @@ -102,7 +102,7 @@ features are needed by other parts of their overall configuration. ## Implicit Provider Inheritance For convenience in simple configurations, a child module automatically inherits -[default provider configurations](/language/providers/configuration#default-provider-configurations) from its parent. This means that +[default provider configurations](/terraform/language/providers/configuration#default-provider-configurations) from its parent. This means that explicit `provider` blocks appear only in the root module, and downstream modules can simply declare resources for that provider and have them automatically associated with the root provider configurations. @@ -132,10 +132,10 @@ resource "aws_s3_bucket" "example" { We recommend using this approach when a single configuration for each provider is sufficient for an entire configuration. -~> **Note:** Only provider configurations are inherited by child modules, not provider source or version requirements. Each module must [declare its own provider requirements](/language/providers/requirements). This is especially important for non-HashiCorp providers. +~> **Note:** Only provider configurations are inherited by child modules, not provider source or version requirements. Each module must [declare its own provider requirements](/terraform/language/providers/requirements). This is especially important for non-HashiCorp providers. In more complex situations there may be -[multiple provider configurations](/language/providers/configuration#alias-multiple-provider-configurations), +[multiple provider configurations](/terraform/language/providers/configuration#alias-multiple-provider-configurations), or a child module may need to use different provider settings than its parent. For such situations, you must pass providers explicitly. @@ -172,7 +172,7 @@ module "example" { ``` The `providers` argument within a `module` block is similar to -[the `provider` argument](/language/meta-arguments/resource-provider) +[the `provider` argument](/terraform/language/meta-arguments/resource-provider) within a resource, but is a map rather than a single string because a module may contain resources from many different providers. diff --git a/website/docs/language/modules/develop/publish.mdx b/website/docs/language/modules/develop/publish.mdx index 6a5e0992d6..c904a0a23a 100644 --- a/website/docs/language/modules/develop/publish.mdx +++ b/website/docs/language/modules/develop/publish.mdx @@ -6,12 +6,12 @@ description: A module is a container for multiple resources that are used togeth # Publishing Modules If you've built a module that you intend to be reused, we recommend -[publishing the module](/registry/modules/publish) on the +[publishing the module](/terraform/registry/modules/publish) on the [Terraform Registry](https://registry.terraform.io). This will version your module, generate documentation, and more. Published modules can be easily consumed by Terraform, and users can -[constrain module versions](/language/modules/syntax#version) +[constrain module versions](/terraform/language/modules/syntax#version) for safe and predictable updates. The following example shows how a caller might use a module from the Terraform Registry: @@ -22,7 +22,7 @@ module "consul" { ``` If you do not wish to publish your modules in the public registry, you can -instead use a [private registry](/registry/private) to get +instead use a [private registry](/terraform/registry/private) to get the same benefits. We welcome contributions of Terraform modules from our community members, partners, and customers. Our ecosystem is made richer by each new module created or an existing one updated, as they reflect the wide range of experience and technical requirements of the community that uses them. Our cloud provider partners often seek to develop specific modules for popular or challenging use cases on their platform and utilize them as valuable learning experiences to empathize with their users. Similarly, our community module developers incorporate a variety of opinions and use cases from the broader Terraform community. Both types of modules have their place in the Terraform registry, accessible to practitioners who can decide which modules best fit their requirements. @@ -31,11 +31,11 @@ We welcome contributions of Terraform modules from our community members, partne Although the registry is the native mechanism for distributing re-usable modules, Terraform can also install modules from -[various other sources](/language/modules/sources). The alternative sources +[various other sources](/terraform/language/modules/sources). The alternative sources do not support the first-class versioning mechanism, but some sources have their own mechanisms for selecting particular VCS commits, etc. We recommend that modules distributed via other protocols still use the -[standard module structure](/language/modules/develop/structure) so that they can +[standard module structure](/terraform/language/modules/develop/structure) so that they can be used in a similar way as a registry module or be published on the registry at a later time. diff --git a/website/docs/language/modules/develop/refactoring.mdx b/website/docs/language/modules/develop/refactoring.mdx index 41d8740f87..4be1c898bc 100644 --- a/website/docs/language/modules/develop/refactoring.mdx +++ b/website/docs/language/modules/develop/refactoring.mdx @@ -6,7 +6,7 @@ description: How to make backward-compatible changes to modules already in use. # Refactoring -> **Note:** Explicit refactoring declarations with `moved` blocks is available in Terraform v1.1 and later. For earlier Terraform versions or for refactoring actions too complex to express as `moved` blocks, you can -use the [`terraform state mv` CLI command](/cli/commands/state/mv) +use the [`terraform state mv` CLI command](/terraform/cli/commands/state/mv) as a separate step. In shared modules and long-lived configurations, you may eventually outgrow @@ -23,7 +23,7 @@ When you add `moved` blocks in your configuration to record where you've historically moved or renamed an object, Terraform treats an existing object at the old address as if it now belongs to the new address. -> **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. ## `moved` Block Syntax @@ -122,7 +122,7 @@ resource "aws_instance" "a" { Applying this configuration would lead to Terraform creating an object bound to the address `aws_instance.a`. -Later, you use [`for_each`](/language/meta-arguments/for_each) with this +Later, you use [`for_each`](/terraform/language/meta-arguments/for_each) with this resource to systematically declare multiple instances. To preserve an object that was previously associated with `aws_instance.a` alone, you must add a `moved` block to specify which instance key the object will take in the new @@ -261,7 +261,7 @@ Applying this configuration would cause Terraform to create objects whose addresses begin with `module.a`. In later module versions, you may need to use -[`count`](/language/meta-arguments/count) with this resource to systematically +[`count`](/terraform/language/meta-arguments/count) with this resource to systematically declare multiple instances. To preserve an object that was previously associated with `aws_instance.a` alone, you can add a `moved` block to specify which instance key that object will take in the new configuration: @@ -398,7 +398,7 @@ typical rule that a parent module sees its child module as a "closed box", unaware of exactly which resources are declared inside it. This compromise assumes that all three of these modules are maintained by the same people and distributed together in a single -[module package](/language/modules/sources#modules-in-package-sub-directories). +[module package](/terraform/language/modules/sources#modules-in-package-sub-directories). Terraform resolves module references in `moved` blocks relative to the module instance they are defined in. For example, if the original module above were diff --git a/website/docs/language/modules/develop/structure.mdx b/website/docs/language/modules/develop/structure.mdx index dbe2db33c3..1746648691 100644 --- a/website/docs/language/modules/develop/structure.mdx +++ b/website/docs/language/modules/develop/structure.mdx @@ -53,8 +53,8 @@ don't need to do any extra work to follow the standard structure. * **Variables and outputs should have descriptions.** All variables and outputs should have one or two sentence descriptions that explain their purpose. This is used for documentation. See the documentation for - [variable configuration](/language/values/variables) and - [output configuration](/language/values/outputs) for more details. + [variable configuration](/terraform/language/values/variables) and + [output configuration](/terraform/language/values/outputs) for more details. * **Nested modules**. Nested modules should exist under the `modules/` subdirectory. Any nested module with a `README.md` is considered usable @@ -74,7 +74,7 @@ don't need to do any extra work to follow the standard structure. again separately. If a repository or package contains multiple nested modules, they should - ideally be [composable](/language/modules/develop/composition) by the caller, rather than + ideally be [composable](/terraform/language/modules/develop/composition) by the caller, rather than calling directly to each other and creating a deeply-nested tree of modules. * **Examples**. Examples of using the module should exist under the diff --git a/website/docs/language/modules/index.mdx b/website/docs/language/modules/index.mdx index 3f84f48def..b52b42bb87 100644 --- a/website/docs/language/modules/index.mdx +++ b/website/docs/language/modules/index.mdx @@ -7,7 +7,7 @@ description: >- # Modules -> **Hands-on:** Try the [Reuse Configuration with Modules](https://learn.hashicorp.com/collections/terraform/modules?utm_source=WEBSITE&utm_medium=WEB_IO&utm_offer=ARTICLE_PAGE&utm_content=DOCS) tutorials. +> **Hands-on:** Try the [Reuse Configuration with Modules](/terraform/tutorials/modules?utm_source=WEBSITE&utm_medium=WEB_IO&utm_offer=ARTICLE_PAGE&utm_content=DOCS) tutorials. _Modules_ are containers for multiple resources that are used together. A module consists of a collection of `.tf` and/or `.tf.json` files kept together in a @@ -45,26 +45,26 @@ a module call block. Also, members of your organization might produce modules specifically crafted for your own infrastructure needs. [Terraform Cloud](https://cloud.hashicorp.com/products/terraform) and -[Terraform Enterprise](/enterprise) both include a private +[Terraform Enterprise](/terraform/enterprise) both include a private module registry for sharing modules internally within your organization. ## Using Modules -- [Module Blocks](/language/modules/syntax) documents the syntax for +- [Module Blocks](/terraform/language/modules/syntax) documents the syntax for calling a child module from a parent module, including meta-arguments like `for_each`. -- [Module Sources](/language/modules/sources) documents what kinds of paths, +- [Module Sources](/terraform/language/modules/sources) documents what kinds of paths, addresses, and URIs can be used in the `source` argument of a module block. - The Meta-Arguments section documents special arguments that can be used with every module, including - [`providers`](/language/meta-arguments/module-providers), - [`depends_on`](/language/meta-arguments/depends_on), - [`count`](/language/meta-arguments/count), - and [`for_each`](/language/meta-arguments/for_each). + [`providers`](/terraform/language/meta-arguments/module-providers), + [`depends_on`](/terraform/language/meta-arguments/depends_on), + [`count`](/terraform/language/meta-arguments/count), + and [`for_each`](/terraform/language/meta-arguments/for_each). ## Developing Modules For information about developing reusable modules, see -[Module Development](/language/modules/develop). +[Module Development](/terraform/language/modules/develop). diff --git a/website/docs/language/modules/sources.mdx b/website/docs/language/modules/sources.mdx index b178577c88..5159597583 100644 --- a/website/docs/language/modules/sources.mdx +++ b/website/docs/language/modules/sources.mdx @@ -8,13 +8,13 @@ description: >- # Module Sources -The `source` argument in [a `module` block](/language/modules/syntax) +The `source` argument in [a `module` block](/terraform/language/modules/syntax) tells Terraform where to find the source code for the desired child module. Terraform uses this during the module installation step of `terraform init` to download the source code to a directory on local disk so that other Terraform commands can use it. -> **Hands-on:** Try the [Use Modules From the Registry](https://learn.hashicorp.com/tutorials/terraform/module-use) or [Build and Use a Local Module](https://learn.hashicorp.com/tutorials/terraform/module-create) tutorials. +> **Hands-on:** Try the [Use Modules From the Registry](/terraform/tutorials/modules/module-use) or [Build and Use a Local Module](/terraform/tutorials/modules/module-create) tutorials. The module installer supports installation from a number of different source types. @@ -97,10 +97,10 @@ to get started with Terraform and find modules created by others in the community. You can also use a -[private registry](/registry/private), either +[private registry](/terraform/registry/private), either via the built-in feature from Terraform Cloud, or by running a custom service that implements -[the module registry protocol](/registry/api-docs). +[the module registry protocol](/terraform/registry/api-docs). Modules on the public Terraform Registry can be referenced using a registry source address of the form `//`, with each @@ -132,17 +132,17 @@ If you are using the SaaS version of Terraform Cloud, its private registry hostname is `app.terraform.io`. If you use a self-hosted Terraform Enterprise instance, its private registry hostname is the same as the host where you'd access the web UI and the host you'd use when configuring -the [Terraform Cloud CLI integration](/cli/cloud). +the [Terraform Cloud CLI integration](/terraform/cli/cloud). Registry modules support versioning. You can provide a specific version as shown in the above examples, or use flexible -[version constraints](/language/modules/syntax#version). +[version constraints](/terraform/language/modules/syntax#version). You can learn more about the registry at the -[Terraform Registry documentation](/registry/modules/use#using-modules). +[Terraform Registry documentation](/terraform/registry/modules/use#using-modules). To access modules from a private registry, you may need to configure an access -token [in the CLI config](/cli/config/config-file#credentials). Use the +token [in the CLI config](/terraform/cli/config/config-file#credentials). Use the same hostname as used in the module source string. For a private registry within Terraform Cloud, use the same authentication token as you would use with the Enterprise API or command-line clients. @@ -229,7 +229,7 @@ to select a suitable source of credentials for your environment. If your Terraform configuration will be used within [Terraform Cloud](https://www.hashicorp.com/products/terraform), only SSH key authentication is supported, and -[keys can be configured on a per-workspace basis](/cloud-docs/workspaces/settings/ssh-keys). +[keys can be configured on a per-workspace basis](/terraform/cloud-docs/workspaces/settings/ssh-keys). ### Selecting a Revision @@ -318,7 +318,7 @@ repositories without interactive prompts. If your Terraform configuration will be used within [Terraform Cloud](https://www.hashicorp.com/products/terraform), only SSH key authentication is supported, and -[keys can be configured on a per-workspace basis](/cloud-docs/workspaces/settings/ssh-keys). +[keys can be configured on a per-workspace basis](/terraform/cloud-docs/workspaces/settings/ssh-keys). ### Selecting a Revision diff --git a/website/docs/language/modules/syntax.mdx b/website/docs/language/modules/syntax.mdx index 8d002ae167..198d5232d4 100644 --- a/website/docs/language/modules/syntax.mdx +++ b/website/docs/language/modules/syntax.mdx @@ -8,7 +8,7 @@ description: >- # Module Blocks -> **Hands-on:** Try the [Reuse Configuration with Modules](https://learn.hashicorp.com/collections/terraform/modules?utm_source=WEBSITE&utm_medium=WEB_IO&utm_offer=ARTICLE_PAGE&utm_content=DOCS) tutorials. +> **Hands-on:** Try the [Reuse Configuration with Modules](/terraform/tutorials/modules?utm_source=WEBSITE&utm_medium=WEB_IO&utm_offer=ARTICLE_PAGE&utm_content=DOCS) tutorials. A _module_ is a container for multiple resources that are used together. @@ -23,13 +23,13 @@ in separate configurations, allowing resource configurations to be packaged and re-used. This page describes how to call one module from another. For more information -about creating re-usable child modules, see [Module Development](/language/modules/develop). +about creating re-usable child modules, see [Module Development](/terraform/language/modules/develop). ## Calling a Child Module To _call_ a module means to include the contents of that module into the configuration with specific values for its -[input variables](/language/values/variables). Modules are called +[input variables](/terraform/language/values/variables). Modules are called from within other modules using `module` blocks: ```hcl @@ -53,7 +53,7 @@ Module calls use the following kinds of arguments: - The `version` argument is recommended for modules from a registry. -- Most other arguments correspond to [input variables](/language/values/variables) +- Most other arguments correspond to [input variables](/terraform/language/values/variables) defined by the module. (The `servers` argument in the example above is one of these.) @@ -67,7 +67,7 @@ Terraform. Its value is either the path to a local directory containing the module's configuration files, or a remote module source that Terraform should download and use. This value must be a literal string with no template sequences; arbitrary expressions are not allowed. For more information on -possible values for this argument, see [Module Sources](/language/modules/sources). +possible values for this argument, see [Module Sources](/terraform/language/modules/sources). The same source address can be specified in multiple `module` blocks to create multiple copies of the resources defined within, possibly with different @@ -95,14 +95,14 @@ module "consul" { } ``` -The `version` argument accepts a [version constraint string](/language/expressions/version-constraints). +The `version` argument accepts a [version constraint string](/terraform/language/expressions/version-constraints). Terraform will use the newest installed version of the module that meets the constraint; if no acceptable versions are installed, it will download the newest version that meets the constraint. Version constraints are supported only for modules installed from a module registry, such as the public [Terraform Registry](https://registry.terraform.io/) -or [Terraform Cloud's private module registry](/cloud-docs/registry). +or [Terraform Cloud's private module registry](/terraform/cloud-docs/registry). Other module sources can provide their own versioning mechanisms within the source string itself, or might not support versions at all. In particular, modules sourced from local file paths do not support `version`; since @@ -116,22 +116,22 @@ optional meta-arguments that have special meaning across all modules, described in more detail in the following pages: - `count` - Creates multiple instances of a module from a single `module` block. - See [the `count` page](/language/meta-arguments/count) + See [the `count` page](/terraform/language/meta-arguments/count) for details. - `for_each` - Creates multiple instances of a module from a single `module` block. See - [the `for_each` page](/language/meta-arguments/for_each) + [the `for_each` page](/terraform/language/meta-arguments/for_each) for details. - `providers` - Passes provider configurations to a child module. See - [the `providers` page](/language/meta-arguments/module-providers) + [the `providers` page](/terraform/language/meta-arguments/module-providers) for details. If not specified, the child module inherits all of the default (un-aliased) provider configurations from the calling module. - `depends_on` - Creates explicit dependencies between the entire module and the listed targets. See - [the `depends_on` page](/language/meta-arguments/depends_on) + [the `depends_on` page](/terraform/language/meta-arguments/depends_on) for details. Terraform does not use the `lifecycle` argument. However, the `lifecycle` block is reserved for future versions. @@ -140,7 +140,7 @@ Terraform does not use the `lifecycle` argument. However, the `lifecycle` block The resources defined in a module are encapsulated, so the calling module cannot access their attributes directly. However, the child module can -declare [output values](/language/values/outputs) to selectively +declare [output values](/terraform/language/values/outputs) to selectively export certain values to be accessed by the calling module. For example, if the `./app-cluster` module referenced in the example above @@ -156,7 +156,7 @@ resource "aws_elb" "example" { ``` For more information about referring to named values, see -[Expressions](/language/expressions). +[Expressions](/terraform/language/expressions). ## Transferring Resource State Into Modules @@ -166,7 +166,7 @@ result, Terraform plans to destroy all resource instances at the old address and create new instances at the new address. To preserve existing objects, you can use -[refactoring blocks](/language/modules/develop/refactoring) to record the old and new +[refactoring blocks](/terraform/language/modules/develop/refactoring) to record the old and new addresses for each resource instance. This directs Terraform to treat existing objects at the old addresses as if they had originally been created at the corresponding new addresses. @@ -176,7 +176,7 @@ corresponding new addresses. You may have an object that needs to be replaced with a new object for a reason that isn't automatically visible to Terraform, such as if a particular virtual machine is running on degraded underlying hardware. In this case, you can use -[the `-replace=...` planning option](/cli/commands/plan#replace-address) +[the `-replace=...` planning option](/terraform/cli/commands/plan#replace-address) to force Terraform to propose replacing that object. If the object belongs to a resource within a nested module, specify the full diff --git a/website/docs/language/providers/configuration.mdx b/website/docs/language/providers/configuration.mdx index 7dc88a4f29..f3cce651ed 100644 --- a/website/docs/language/providers/configuration.mdx +++ b/website/docs/language/providers/configuration.mdx @@ -16,7 +16,7 @@ configure settings for providers. Additionally, all Terraform configurations must declare which providers they require so that Terraform can install and use them. The -[Provider Requirements](/language/providers/requirements) +[Provider Requirements](/terraform/language/providers/requirements) page documents how to declare providers so Terraform can install them. ## Provider Configuration @@ -24,8 +24,8 @@ page documents how to declare providers so Terraform can install them. Provider configurations belong in the root module of a Terraform configuration. (Child modules receive their provider configurations from the root module; for more information, see -[The Module `providers` Meta-Argument](/language/meta-arguments/module-providers) -and [Module Development: Providers Within Modules](/language/modules/develop/providers).) +[The Module `providers` Meta-Argument](/terraform/language/meta-arguments/module-providers) +and [Module Development: Providers Within Modules](/terraform/language/modules/develop/providers).) A provider configuration is created using a `provider` block: @@ -37,7 +37,7 @@ provider "google" { ``` The name given in the block header (`"google"` in this example) is the -[local name](/language/providers/requirements#local-names) of the provider to +[local name](/terraform/language/providers/requirements#local-names) of the provider to configure. This provider should already be included in a `required_providers` block. @@ -46,7 +46,7 @@ the provider. Most arguments in this section are defined by the provider itself; in this example both `project` and `region` are specific to the `google` provider. -You can use [expressions](/language/expressions) in the values of these +You can use [expressions](/terraform/language/expressions) in the values of these configuration arguments, but can only reference values that are known before the configuration is applied. This means you can safely reference input variables, but not attributes exported by resources (with an exception for resource @@ -68,7 +68,7 @@ and available for all `provider` blocks: - [`alias`, for using the same provider with different configurations for different resources][inpage-alias] - [`version`, which we no longer recommend][inpage-versions] (use - [provider requirements](/language/providers/requirements) instead) + [provider requirements](/terraform/language/providers/requirements) instead) Unlike many other objects in the Terraform language, a `provider` block may be omitted if its contents would otherwise be empty. Terraform assumes an @@ -175,7 +175,7 @@ module "aws_vpc" { ``` Modules have some special requirements when passing in providers; see -[The Module `providers` Meta-Argument](/language/meta-arguments/module-providers) +[The Module `providers` Meta-Argument](/terraform/language/meta-arguments/module-providers) for more details. In most cases, only _root modules_ should define provider configurations, with all child modules obtaining their provider configurations from their parents. @@ -188,11 +188,11 @@ from their parents. The `version` meta-argument specifies a version constraint for a provider, and works the same way as the `version` argument in a -[`required_providers` block](/language/providers/requirements). The version +[`required_providers` block](/terraform/language/providers/requirements). The version constraint in a provider configuration is only used if `required_providers` does not include one for that provider. ~**Warning:** The `version` argument in provider configurations is deprecated, and we will remove it in a future Terraform version. In Terraform 0.13 and later, always declare provider version constraints in -[the `required_providers` block](/language/providers/requirements). +[the `required_providers` block](/terraform/language/providers/requirements). diff --git a/website/docs/language/providers/index.mdx b/website/docs/language/providers/index.mdx index f28df97ffc..ff65605270 100644 --- a/website/docs/language/providers/index.mdx +++ b/website/docs/language/providers/index.mdx @@ -7,7 +7,7 @@ description: >- # Providers -> **Hands-on:** Try the [Perform CRUD Operations with Providers](https://learn.hashicorp.com/tutorials/terraform/provider-use?in=terraform/configuration-language&utm_source=WEBSITE&utm_medium=WEB_IO&utm_offer=ARTICLE_PAGE&utm_content=DOCS) tutorial. +> **Hands-on:** Try the [Perform CRUD Operations with Providers](/terraform/tutorials/configuration-language/provider-use?utm_source=WEBSITE&utm_medium=WEB_IO&utm_offer=ARTICLE_PAGE&utm_content=DOCS) tutorial. Terraform relies on plugins called providers to interact with cloud providers, SaaS providers, and other APIs. @@ -18,8 +18,8 @@ configuration (like endpoint URLs or cloud regions) before they can be used. ## What Providers Do -Each provider adds a set of [resource types](/language/resources) -and/or [data sources](/language/data-sources) that Terraform can +Each provider adds a set of [resource types](/terraform/language/resources) +and/or [data sources](/terraform/language/data-sources) that Terraform can manage. Every resource type is implemented by a provider; without providers, Terraform @@ -51,20 +51,20 @@ Provider documentation in the Registry is versioned; you can use the version menu in the header to change which version you're viewing. For details about writing, generating, and previewing provider documentation, -see the [provider publishing documentation](/registry/providers/docs). +see the [provider publishing documentation](/terraform/registry/providers/docs). ## How to Use Providers To use resources from a given provider, you need to include some information about it in your configuration. See the following pages for details: -- [Provider Requirements](/language/providers/requirements) +- [Provider Requirements](/terraform/language/providers/requirements) documents how to declare providers so Terraform can install them. -- [Provider Configuration](/language/providers/configuration) +- [Provider Configuration](/terraform/language/providers/configuration) documents how to configure settings for providers. -- [Dependency Lock File](/language/files/dependency-lock) +- [Dependency Lock File](/terraform/language/files/dependency-lock) documents an additional HCL file that can be included with a configuration, which tells Terraform to always use a specific set of provider versions. @@ -73,23 +73,23 @@ about it in your configuration. See the following pages for details: - Terraform Cloud and Terraform Enterprise install providers as part of every run. - Terraform CLI finds and installs providers when - [initializing a working directory](/cli/init). It can + [initializing a working directory](/terraform/cli/init). It can automatically download providers from a Terraform registry, or load them from a local mirror or cache. If you are using a persistent working directory, you must reinitialize whenever you change a configuration's providers. To save time and bandwidth, Terraform CLI supports an optional plugin cache. You can enable the cache using the `plugin_cache_dir` setting in - [the CLI configuration file](/cli/config/config-file). + [the CLI configuration file](/terraform/cli/config/config-file). To ensure Terraform always installs the same provider versions for a given configuration, you can use Terraform CLI to create a -[dependency lock file](/language/files/dependency-lock) +[dependency lock file](/terraform/language/files/dependency-lock) and commit it to version control along with your configuration. If a lock file is present, Terraform Cloud, CLI, and Enterprise will all obey it when installing providers. -> **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. ## How to Find Providers @@ -109,5 +109,5 @@ develops and maintains a given provider. Providers are written in Go, using the Terraform Plugin SDK. For more information on developing providers, see: -- The [Plugin Development](/plugin) documentation -- The [Call APIs with Terraform Providers](https://learn.hashicorp.com/collections/terraform/providers?utm_source=WEBSITE&utm_medium=WEB_IO&utm_offer=ARTICLE_PAGE&utm_content=DOCS) tutorials +- The [Plugin Development](/terraform/plugin) documentation +- The [Call APIs with Terraform Providers](/terraform/tutorials/providers?utm_source=WEBSITE&utm_medium=WEB_IO&utm_offer=ARTICLE_PAGE&utm_content=DOCS) tutorials diff --git a/website/docs/language/providers/requirements.mdx b/website/docs/language/providers/requirements.mdx index 8c17b45539..5d51e6e52e 100644 --- a/website/docs/language/providers/requirements.mdx +++ b/website/docs/language/providers/requirements.mdx @@ -12,11 +12,11 @@ Terraform configurations must declare which providers they require, so that Terraform can install and use them. This page documents how to declare providers so Terraform can install them. -> **Hands-on:** Try the [Perform CRUD Operations with Providers](https://learn.hashicorp.com/tutorials/terraform/provider-use) tutorial. +> **Hands-on:** Try the [Perform CRUD Operations with Providers](/terraform/tutorials/providers/provider-use) tutorial. Additionally, some providers require configuration (like endpoint URLs or cloud regions) before they can be used. The [Provider -Configuration](/language/providers/configuration) page documents how +Configuration](/terraform/language/providers/configuration) page documents how to configure settings for providers. -> **Note:** This page is about a feature of Terraform 0.13 and later; it also @@ -44,7 +44,7 @@ terraform { ``` The `required_providers` block must be nested inside the top-level -[`terraform` block](/language/settings) (which can also contain other settings). +[`terraform` block](/terraform/language/settings) (which can also contain other settings). Each argument in the `required_providers` block enables one provider. The key determines the provider's [local name](#local-names) (its unique identifier @@ -81,7 +81,7 @@ Local names must be unique per-module. Outside of the `required_providers` block, Terraform configurations always refer to providers by their local names. For example, the following configuration declares `mycloud` as the local name for `mycorp/mycloud`, then uses that local -name when [configuring the provider](/language/providers/configuration): +name when [configuring the provider](/terraform/language/providers/configuration): ```hcl terraform { @@ -210,7 +210,7 @@ avoiding typing. Each provider plugin has its own set of available versions, allowing the functionality of the provider to evolve over time. Each provider dependency you -declare should have a [version constraint](/language/expressions/version-constraints) given in +declare should have a [version constraint](/terraform/language/expressions/version-constraints) given in the `version` argument so Terraform can select a single version per provider that all modules are compatible with. @@ -220,12 +220,12 @@ a version constraint for every provider your module depends on. To ensure Terraform always installs the same provider versions for a given configuration, you can use Terraform CLI to create a -[dependency lock file](/language/files/dependency-lock) +[dependency lock file](/terraform/language/files/dependency-lock) and commit it to version control along with your configuration. If a lock file is present, Terraform Cloud, CLI, and Enterprise will all obey it when installing providers. -> **Hands-on:** Try the [Lock and Upgrade Provider Versions](https://learn.hashicorp.com/tutorials/terraform/provider-versioning) tutorial. +> **Hands-on:** Try the [Lock and Upgrade Provider Versions](/terraform/tutorials/configuration-language/provider-versioning) tutorial. ### Best Practices for Provider Versions @@ -273,7 +273,7 @@ incompatibilities, and let the root module manage the maximum version. Most Terraform providers are distributed separately as plugins, but there is one provider that is built into Terraform itself. This provider enables the -[the `terraform_remote_state` data source](/language/state/remote-state-data). +[the `terraform_remote_state` data source](/terraform/language/state/remote-state-data). Because this provider is built in to Terraform, you don't need to declare it in the `required_providers` block in order to use its features. However, for @@ -292,7 +292,7 @@ compatible with Terraform v0.11 or later and should never be declared in a ## In-house Providers Anyone can develop and distribute their own Terraform providers. See -the [Call APIs with Terraform Providers](https://learn.hashicorp.com/collections/terraform/providers) +the [Call APIs with Terraform Providers](/terraform/tutorials/providers) tutorials for more about provider development. Some organizations develop their own providers to configure @@ -301,11 +301,11 @@ publishing them on the public Terraform Registry. One option for distributing such a provider is to run an in-house _private_ registry, by implementing -[the provider registry protocol](/internals/provider-registry-protocol). +[the provider registry protocol](/terraform/internals/provider-registry-protocol). Running an additional service just to distribute a single provider internally may be undesirable, so Terraform also supports -[other provider installation methods](/cli/config/config-file#provider-installation), +[other provider installation methods](/terraform/cli/config/config-file#provider-installation), including placing provider plugins directly in specific directories in the local filesystem, via _filesystem mirrors_. @@ -334,7 +334,7 @@ terraform { To make version 1.0.0 of this provider available for installation from the local filesystem, choose one of the -[implied local mirror directories](/cli/config/config-file#implied-local-mirror-directories) +[implied local mirror directories](/terraform/cli/config/config-file#implied-local-mirror-directories) and create a directory structure under it like this: ``` diff --git a/website/docs/language/resources/behavior.mdx b/website/docs/language/resources/behavior.mdx index 8f3f91f1db..c65de9d1f4 100644 --- a/website/docs/language/resources/behavior.mdx +++ b/website/docs/language/resources/behavior.mdx @@ -20,7 +20,7 @@ match the configuration. When Terraform creates a new infrastructure object represented by a `resource` block, the identifier for that real object is saved in Terraform's -[state](/language/state), allowing it to be updated and destroyed +[state](/terraform/language/state), allowing it to be updated and destroyed in response to future changes. For resource blocks that already have an associated infrastructure object in the state, Terraform compares the actual configuration of the object with the arguments given in the @@ -44,7 +44,7 @@ customized on a per-resource basis. ## Accessing Resource Attributes -[Expressions](/language/expressions) within a Terraform module can access +[Expressions](/terraform/language/expressions) within a Terraform module can access information about resources in the same module, and you can use that information to help configure other resources. Use the `..` syntax to reference a resource attribute in an expression. @@ -54,7 +54,7 @@ read-only attributes with information obtained from the remote API; this often includes things that can't be known until the resource is created, like the resource's unique random ID. -Many providers also include [data sources](/language/data-sources), +Many providers also include [data sources](/terraform/language/data-sources), which are a special type of resource used only for looking up information. For a list of the attributes a resource or data source type provides, consult @@ -62,7 +62,7 @@ its documentation; these are generally included in a second list below its list of configurable arguments. For more information about referencing resource attributes in expressions, see -[Expressions: References to Resource Attributes](/language/expressions/references#references-to-resource-attributes). +[Expressions: References to Resource Attributes](/terraform/language/expressions/references#references-to-resource-attributes). ## Resource Dependencies @@ -75,7 +75,7 @@ resource's configuration just requires information generated by another resource. Most resource dependencies are handled automatically. Terraform analyses any -[expressions](/language/expressions) within a `resource` block to find references +[expressions](/terraform/language/expressions) within a `resource` block to find references to other objects, and treats those references as implicit ordering requirements when creating, updating, or destroying resources. Since most resources with behavioral dependencies on other resources also refer to those resources' data, @@ -86,10 +86,10 @@ example, if Terraform must manage access control policies _and_ take actions that require those policies to be present, there is a hidden dependency between the access policy and a resource whose creation depends on it. In these rare cases, -[the `depends_on` meta-argument](/language/meta-arguments/depends_on) +[the `depends_on` meta-argument](/terraform/language/meta-arguments/depends_on) can explicitly specify a dependency. -You can also use the [`replace_triggered_by` meta-argument](/language/meta-arguments/lifecycle#replace_triggered_by) to add dependencies between otherwise independent resources. It forces Terraform to replace the parent resource when there is a change to a referenced resource or resource attribute. +You can also use the [`replace_triggered_by` meta-argument](/terraform/language/meta-arguments/lifecycle#replace_triggered_by) to add dependencies between otherwise independent resources. It forces Terraform to replace the parent resource when there is a change to a referenced resource or resource attribute. ## Local-only Resources diff --git a/website/docs/language/resources/index.mdx b/website/docs/language/resources/index.mdx index 0d6756b8ff..0c3d230f91 100644 --- a/website/docs/language/resources/index.mdx +++ b/website/docs/language/resources/index.mdx @@ -7,29 +7,29 @@ description: >- # Resources -> **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. _Resources_ are the most important element in the Terraform language. Each resource block describes one or more infrastructure objects, such as virtual networks, compute instances, or higher-level components such as DNS records. -- [Resource Blocks](/language/resources/syntax) documents +- [Resource Blocks](/terraform/language/resources/syntax) documents the syntax for declaring resources. -- [Resource Behavior](/language/resources/behavior) explains in +- [Resource Behavior](/terraform/language/resources/behavior) explains in more detail how Terraform handles resource declarations when applying a configuration. - The Meta-Arguments section documents special arguments that can be used with every resource type, including - [`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), - and [`lifecycle`](/language/meta-arguments/lifecycle). + [`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), + and [`lifecycle`](/terraform/language/meta-arguments/lifecycle). -- [Provisioners](/language/resources/provisioners/syntax) +- [Provisioners](/terraform/language/resources/provisioners/syntax) documents configuring post-creation actions for a resource using the `provisioner` and `connection` blocks. Since provisioners are non-declarative and potentially unpredictable, we strongly recommend that you treat them as a diff --git a/website/docs/language/resources/provisioners/connection.mdx b/website/docs/language/resources/provisioners/connection.mdx index 655f617e3d..0e2ba5c33b 100644 --- a/website/docs/language/resources/provisioners/connection.mdx +++ b/website/docs/language/resources/provisioners/connection.mdx @@ -11,7 +11,7 @@ Most provisioners require access to the remote resource via SSH or WinRM and expect a nested `connection` block with details about how to connect. ~> **Important:** Use provisioners as a last resort. There are better alternatives for most situations. Refer to -[Declaring Provisioners](/language/resources/provisioners/syntax) for more details. +[Declaring Provisioners](/terraform/language/resources/provisioners/syntax) for more details. ## Connection Block @@ -84,8 +84,8 @@ The `connection` block supports the following argments. Some arguments are only | `port` | Both| The port to connect to. | `22` for type `"ssh"`
`5985` for type `"winrm"` | | `timeout` | Both | The timeout to wait for the connection to become available. Should be provided as a string (e.g., `"30s"` or `"5m"`.) | `"5m"` | | `script_path` | Both | The path used to copy scripts meant for remote execution. Refer to [How Provisioners Execute Remote Scripts](#how-provisioners-execute-remote-scripts) below for more details. | (details below) | -| `private_key` | SSH | The contents of an SSH key to use for the connection. These can be loaded from a file on disk using [the `file` function](/language/functions/file). This takes preference over `password` if provided. | | -| `certificate` | SSH | The contents of a signed CA Certificate. The certificate argument must be used in conjunction with a `private_key`. These can be loaded from a file on disk using the [the `file` function](/language/functions/file). | | +| `private_key` | SSH | The contents of an SSH key to use for the connection. These can be loaded from a file on disk using [the `file` function](/terraform/language/functions/file). This takes preference over `password` if provided. | | +| `certificate` | SSH | The contents of a signed CA Certificate. The certificate argument must be used in conjunction with a `private_key`. These can be loaded from a file on disk using the [the `file` function](/terraform/language/functions/file). | | | `agent` | SSH | Set to `false` to disable using `ssh-agent` to authenticate. On Windows the only supported SSH authentication agent is [Pageant](http://the.earth.li/\~sgtatham/putty/0.66/htmldoc/Chapter9.html#pageant). | | | `agent_identity` | SSH | The preferred identity from the ssh agent for authentication. | | | `host_key` | SSH | The public key from the remote host or the signing CA, used to verify the connection. | | @@ -110,8 +110,8 @@ indirectly with a [bastion host](https://en.wikipedia.org/wiki/Bastion_host). | `bastion_port` | The port to use connect to the bastion host. | The value of the `port` field.| | `bastion_user`| The user for the connection to the bastion host. | The value of the `user` field. | | `bastion_password` | The password to use for the bastion host. | The value of the `password` field. | -| `bastion_private_key` | The contents of an SSH key file to use for the bastion host. These can be loaded from a file on disk using [the `file` function](/language/functions/file). | The value of the `private_key` field. | -| `bastion_certificate` | The contents of a signed CA Certificate. The certificate argument must be used in conjunction with a `bastion_private_key`. These can be loaded from a file on disk using the [the `file` function](/language/functions/file). | +| `bastion_private_key` | The contents of an SSH key file to use for the bastion host. These can be loaded from a file on disk using [the `file` function](/terraform/language/functions/file). | The value of the `private_key` field. | +| `bastion_certificate` | The contents of a signed CA Certificate. The certificate argument must be used in conjunction with a `bastion_private_key`. These can be loaded from a file on disk using the [the `file` function](/terraform/language/functions/file). | ## Connection through a HTTP Proxy with SSH diff --git a/website/docs/language/resources/provisioners/file.mdx b/website/docs/language/resources/provisioners/file.mdx index 7618e3d04d..9655e8a3de 100644 --- a/website/docs/language/resources/provisioners/file.mdx +++ b/website/docs/language/resources/provisioners/file.mdx @@ -10,10 +10,10 @@ description: >- The `file` provisioner copies files or directories from the machine running Terraform to the newly created resource. The `file` provisioner -supports both `ssh` and `winrm` type [connections](/language/resources/provisioners/connection). +supports both `ssh` and `winrm` type [connections](/terraform/language/resources/provisioners/connection). ~> **Important:** Use provisioners as a last resort. There are better alternatives for most situations. Refer to -[Declaring Provisioners](/language/resources/provisioners/syntax) for more details. +[Declaring Provisioners](/terraform/language/resources/provisioners/syntax) for more details. ## Example usage diff --git a/website/docs/language/resources/provisioners/local-exec.mdx b/website/docs/language/resources/provisioners/local-exec.mdx index 83241ffa43..ed19ec9499 100644 --- a/website/docs/language/resources/provisioners/local-exec.mdx +++ b/website/docs/language/resources/provisioners/local-exec.mdx @@ -11,7 +11,7 @@ description: >- The `local-exec` provisioner invokes a local executable after a resource is created. This invokes a process on the machine running Terraform, not on the resource. See the `remote-exec` -[provisioner](/language/resources/provisioners/remote-exec) to run commands on the +[provisioner](/terraform/language/resources/provisioners/remote-exec) to run commands on the resource. Note that even though the resource will be fully created when the provisioner is @@ -19,7 +19,7 @@ run, there is no guarantee that it will be in an operable state - for example system services such as `sshd` may not be started yet on compute resources. ~> **Important:** Use provisioners as a last resort. There are better alternatives for most situations. Refer to -[Declaring Provisioners](/language/resources/provisioners/syntax) for more details. +[Declaring Provisioners](/terraform/language/resources/provisioners/syntax) for more details. ## Example usage @@ -59,7 +59,7 @@ The following arguments are supported: * `when` - (Optional) If provided, specifies when Terraform will execute the command. For example, `when = destroy` specifies that the provisioner will run when the associated resource - is destroyed. Refer to [Destroy-Time Provisioners](/language/resources/provisioners/syntax#destroy-time-provisioners) + is destroyed. Refer to [Destroy-Time Provisioners](/terraform/language/resources/provisioners/syntax#destroy-time-provisioners) for details. * `quiet` - (Optional) If set to `true`, Terraform will not print the command to be executed to stdout, and will instead print "Suppressed by quiet=true". Note that the output of the command will still be printed in any case. diff --git a/website/docs/language/resources/provisioners/null_resource.mdx b/website/docs/language/resources/provisioners/null_resource.mdx index 8722938bec..eab3322dfc 100644 --- a/website/docs/language/resources/provisioners/null_resource.mdx +++ b/website/docs/language/resources/provisioners/null_resource.mdx @@ -10,16 +10,16 @@ description: >- If you need to run provisioners that aren't directly associated with a specific resource, you can associate them with a `null_resource`. -Instances of [`terraform_data`](language/resources/terraform-data) are treated +Instances of [`terraform_data`](/terraform/language/resources/terraform-data) are treated like normal resources, but they don't do anything. Like with any other resource -type, you can configure [provisioners](/language/resources/provisioners/syntax) -and [connection details](/language/resources/provisioners/connection) on a +type, you can configure [provisioners](/terraform/language/resources/provisioners/syntax) +and [connection details](/terraform/language/resources/provisioners/connection) on a `terraform_data` resource. You can also use its `triggers` argument and any meta-arguments to control exactly where in the dependency graph its provisioners will run. ~> **Important:** Use provisioners as a last resort. There are better alternatives for most situations. Refer to -[Declaring Provisioners](/language/resources/provisioners/syntax) for more details. +[Declaring Provisioners](/terraform/language/resources/provisioners/syntax) for more details. ## Example usage diff --git a/website/docs/language/resources/provisioners/remote-exec.mdx b/website/docs/language/resources/provisioners/remote-exec.mdx index 0203231a60..ef548d5ddd 100644 --- a/website/docs/language/resources/provisioners/remote-exec.mdx +++ b/website/docs/language/resources/provisioners/remote-exec.mdx @@ -13,12 +13,12 @@ description: >- The `remote-exec` provisioner invokes a script on a remote resource after it is created. This can be used to run a configuration management tool, bootstrap into a cluster, etc. To invoke a local process, see the `local-exec` -[provisioner](/language/resources/provisioners/local-exec) instead. The `remote-exec` -provisioner requires a [connection](/language/resources/provisioners/connection) +[provisioner](/terraform/language/resources/provisioners/local-exec) instead. The `remote-exec` +provisioner requires a [connection](/terraform/language/resources/provisioners/connection) and supports both `ssh` and `winrm`. ~> **Important:** Use provisioners as a last resort. There are better alternatives for most situations. Refer to -[Declaring Provisioners](/language/resources/provisioners/syntax) for more details. +[Declaring Provisioners](/terraform/language/resources/provisioners/syntax) for more details. ## Example usage @@ -60,14 +60,14 @@ The following arguments are supported: that will be copied to the remote resource and then executed. They are executed in the order they are provided. This cannot be provided with `inline` or `script`. --> **Note:** Since `inline` is implemented by concatenating commands into a script, [`on_failure`](/language/resources/provisioners/syntax#failure-behavior) applies only to the final command in the list. In particular, with `on_failure = fail` (the default behaviour) earlier commands will be allowed to fail, and later commands will also execute. If this behaviour is not desired, consider using `"set -o errexit"` as the first command. +-> **Note:** Since `inline` is implemented by concatenating commands into a script, [`on_failure`](/terraform/language/resources/provisioners/syntax#failure-behavior) applies only to the final command in the list. In particular, with `on_failure = fail` (the default behaviour) earlier commands will be allowed to fail, and later commands will also execute. If this behaviour is not desired, consider using `"set -o errexit"` as the first command. ## Script Arguments You cannot pass any arguments to scripts using the `script` or `scripts` arguments to this provisioner. If you want to specify arguments, upload the script with the -[file provisioner](/language/resources/provisioners/file) +[file provisioner](/terraform/language/resources/provisioners/file) and then use `inline` to call it. Example: ```hcl diff --git a/website/docs/language/resources/provisioners/syntax.mdx b/website/docs/language/resources/provisioners/syntax.mdx index 6ac33576b9..c05221f114 100644 --- a/website/docs/language/resources/provisioners/syntax.mdx +++ b/website/docs/language/resources/provisioners/syntax.mdx @@ -11,11 +11,11 @@ You can use provisioners to model specific actions on the local machine or on a remote machine in order to prepare servers or other infrastructure objects for service. --> **Note:** We removed the Chef, Habitat, Puppet, and Salt Masterless provisioners in Terraform v0.15.0. Information about these legacy provisioners is still available in the documentation for [Terraform v1.1 (and earlier)](/language/v1.1.x/resources/provisioners/syntax). +-> **Note:** We removed the Chef, Habitat, Puppet, and Salt Masterless provisioners in Terraform v0.15.0. Information about these legacy provisioners is still available in the documentation for [Terraform v1.1 (and earlier)](/terraform/language/v1.1.x/resources/provisioners/syntax). ## Provisioners are a Last Resort -> **Hands-on:** Try the [Provision Infrastructure Deployed with Terraform](https://learn.hashicorp.com/collections/terraform/provision?utm_source=WEBSITE&utm_medium=WEB_IO&utm_offer=ARTICLE_PAGE&utm_content=DOCS) tutorials to learn about more declarative ways to handle provisioning actions. +> **Hands-on:** Try the [Provision Infrastructure Deployed with Terraform](/terraform/tutorials/provision?utm_source=WEBSITE&utm_medium=WEB_IO&utm_offer=ARTICLE_PAGE&utm_content=DOCS) tutorials to learn about more declarative ways to handle provisioning actions. Terraform includes the concept of provisioners as a measure of pragmatism, knowing that there are always certain behaviors that cannot be directly @@ -78,7 +78,7 @@ process in various ways data passed via the means described above, allowing you to run arbitrary scripts and do basic system configuration immediately during the boot process and without the need to access the machine over SSH. -> **Hands-on:** Try the [Provision Infrastructure with Cloud-Init](https://learn.hashicorp.com/tutorials/terraform/cloud-init?in=terraform/provision&utm_source=WEBSITE&utm_medium=WEB_IO&utm_offer=ARTICLE_PAGE&utm_content=DOCS) tutorial. +> **Hands-on:** Try the [Provision Infrastructure with Cloud-Init](/terraform/tutorials/provision/cloud-init?utm_source=WEBSITE&utm_medium=WEB_IO&utm_offer=ARTICLE_PAGE&utm_content=DOCS) tutorial. If you are building custom machine images, you can make use of the "user data" or "metadata" passed by the above means in whatever way makes sense to your @@ -108,7 +108,7 @@ configuration management provisioners and can run their installation steps during a separate build process, before creating a system disk image that you can deploy many times. -> **Hands-on:** Try the [Provision Infrastructure with Packer](https://learn.hashicorp.com/tutorials/terraform/packer?in=terraform/provision&utm_source=WEBSITE&utm_medium=WEB_IO&utm_offer=ARTICLE_PAGE&utm_content=DOCS) tutorial. +> **Hands-on:** Try the [Provision Infrastructure with Packer](/terraform/tutorials/provision/packer?utm_source=WEBSITE&utm_medium=WEB_IO&utm_offer=ARTICLE_PAGE&utm_content=DOCS) tutorial. If you are using configuration management software that has a centralized server component, you will need to delay the _registration_ step until the final @@ -163,7 +163,7 @@ resource "aws_instance" "web" { The `local-exec` provisioner requires no other configuration, but most other provisioners must connect to the remote system using SSH or WinRM. -You must include [a `connection` block](/language/resources/provisioners/connection) so that Terraform knows how to communicate with the server. +You must include [a `connection` block](/terraform/language/resources/provisioners/connection) so that Terraform knows how to communicate with the server. Terraform includes several built-in provisioners. You can also use third-party provisioners as plugins, by placing them in `%APPDATA%\terraform.d\plugins`, `~/.terraform.d/plugins`, or the same @@ -191,8 +191,8 @@ block would create a dependency cycle. ## Suppressing Provisioner Logs in CLI Output The configuration for a `provisioner` block may use sensitive values, such as -[`sensitive` variables](/language/values/variables#suppressing-values-in-cli-output) or -[`sensitive` output values](/language/values/outputs#sensitive-suppressing-values-in-cli-output). +[`sensitive` variables](/terraform/language/values/variables#suppressing-values-in-cli-output) or +[`sensitive` output values](/terraform/language/values/outputs#sensitive-suppressing-values-in-cli-output). In this case, all log output from the provisioner is automatically suppressed to prevent the sensitive values from being displayed. diff --git a/website/docs/language/resources/syntax.mdx b/website/docs/language/resources/syntax.mdx index 5b1e28f0dc..f72489f998 100644 --- a/website/docs/language/resources/syntax.mdx +++ b/website/docs/language/resources/syntax.mdx @@ -8,7 +8,7 @@ description: >- # Resource Blocks -> **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. _Resources_ are the most important element in the Terraform language. Each resource block describes one or more infrastructure objects, such @@ -53,7 +53,7 @@ attributes the resource supports. ### Providers -Each resource type is implemented by a [provider](/language/providers/requirements), +Each resource type is implemented by a [provider](/terraform/language/providers/requirements), which is a plugin for Terraform that offers a collection of resource types. A provider usually provides resources to manage a single cloud or on-premises infrastructure platform. Providers are distributed separately from Terraform @@ -66,16 +66,16 @@ access their remote APIs, and the root module must provide that configuration. For more information, see: -- [Provider Requirements](/language/providers/requirements), for declaring which +- [Provider Requirements](/terraform/language/providers/requirements), for declaring which providers a module uses. -- [Provider Configuration](/language/providers/configuration), for configuring provider settings. +- [Provider Configuration](/terraform/language/providers/configuration), for configuring provider settings. Terraform usually automatically determines which provider to use based on a resource type's name. (By convention, resource type names start with their provider's preferred local name.) When using multiple configurations of a provider (or non-preferred local provider names), you must use the `provider` meta-argument to manually choose an alternate provider configuration. See -[the `provider` meta-argument](/language/meta-arguments/resource-provider) for more details. +[the `provider` meta-argument](/terraform/language/meta-arguments/resource-provider) for more details. ### Resource Arguments @@ -84,7 +84,7 @@ selected resource type. The resource type's documentation lists which arguments are available and how their values should be formatted. The values for resource arguments can make full use of -[expressions](/language/expressions) and other dynamic Terraform +[expressions](/terraform/language/expressions) and other dynamic Terraform language features. There are also some _meta-arguments_ that are defined by Terraform itself @@ -114,7 +114,7 @@ public provider docs. For more information about how Terraform manages resources when applying a configuration, see -[Resource Behavior](/language/resources/behavior). +[Resource Behavior](/terraform/language/resources/behavior). ## Meta-Arguments @@ -123,12 +123,12 @@ any resource type to change the behavior of resources. The following meta-arguments are documented on separate pages: -- [`depends_on`, for specifying hidden dependencies](/language/meta-arguments/depends_on) -- [`count`, for creating multiple resource instances according to a count](/language/meta-arguments/count) -- [`for_each`, to create multiple instances according to a map, or set of strings](/language/meta-arguments/for_each) -- [`provider`, for selecting a non-default provider configuration](/language/meta-arguments/resource-provider) -- [`lifecycle`, for lifecycle customizations](/language/meta-arguments/lifecycle) -- [`provisioner`, for taking extra actions after resource creation](/language/resources/provisioners/syntax) +- [`depends_on`, for specifying hidden dependencies](/terraform/language/meta-arguments/depends_on) +- [`count`, for creating multiple resource instances according to a count](/terraform/language/meta-arguments/count) +- [`for_each`, to create multiple instances according to a map, or set of strings](/terraform/language/meta-arguments/for_each) +- [`provider`, for selecting a non-default provider configuration](/terraform/language/meta-arguments/resource-provider) +- [`lifecycle`, for lifecycle customizations](/terraform/language/meta-arguments/lifecycle) +- [`provisioner`, for taking extra actions after resource creation](/terraform/language/resources/provisioners/syntax) ## Custom Condition Checks @@ -152,7 +152,7 @@ resource "aws_instance" "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. ## Operation Timeouts diff --git a/website/docs/language/resources/terraform-data.mdx b/website/docs/language/resources/terraform-data.mdx index 4e03d3d80b..4e82c44815 100644 --- a/website/docs/language/resources/terraform-data.mdx +++ b/website/docs/language/resources/terraform-data.mdx @@ -8,7 +8,7 @@ description: >- # The `terraform_data` Managed Resource Type The `terraform_data` implements the standard resource lifecycle, but does not directly take any other actions. -You can use the `terraform_data` resource without requiring or configuring a provider. It is always available through a built-in provider with the [source address](/language/providers/requirements#source-addresses) `terraform.io/builtin/terraform`. +You can use the `terraform_data` resource without requiring or configuring a provider. It is always available through a built-in provider with the [source address](/terraform/language/providers/requirements#source-addresses) `terraform.io/builtin/terraform`. The `terraform_data` resource is useful for storing values which need to follow a manage resource lifecycle, and for triggering provisioners when there is no other logical managed resource in which to place them. @@ -16,9 +16,9 @@ The `terraform_data` resource is useful for storing values which need to follow ## Example Usage (data for `replace_triggered_by`) -[The `replace_triggered_by` lifecycle argument](/language/meta-arguments/lifecycle#replace_triggered_by) requires all of the given addresses to be for resources, because the decision to force replacement is based on the planned actions for all of the mentioned resources. +[The `replace_triggered_by` lifecycle argument](/terraform/language/meta-arguments/lifecycle#replace_triggered_by) requires all of the given addresses to be for resources, because the decision to force replacement is based on the planned actions for all of the mentioned resources. -Plain data values such as [Local Values](/language/values/locals) and [Input Variables](/language/values/variables) don't have any side-effects to plan against and so they aren't valid in `replace_triggered_by`. You can use `terraform_data`'s behavior of planning an action each time `input` changes to _indirectly_ use a plain value to trigger replacement. +Plain data values such as [Local Values](/terraform/language/values/locals) and [Input Variables](/terraform/language/values/variables) don't have any side-effects to plan against and so they aren't valid in `replace_triggered_by`. You can use `terraform_data`'s behavior of planning an action each time `input` changes to _indirectly_ use a plain value to trigger replacement. ```hcl diff --git a/website/docs/language/settings/backends/azurerm.mdx b/website/docs/language/settings/backends/azurerm.mdx index 77ee491c17..d973f1be61 100644 --- a/website/docs/language/settings/backends/azurerm.mdx +++ b/website/docs/language/settings/backends/azurerm.mdx @@ -117,7 +117,7 @@ terraform { } ``` --> **NOTE:** When using a Service Principal or an Access Key - we recommend using a [Partial Configuration](/language/settings/backends/configuration#partial-configuration) for the credentials. +-> **NOTE:** When using a Service Principal or an Access Key - we recommend using a [Partial Configuration](/terraform/language/settings/backends/configuration#partial-configuration) for the credentials. ## Data Source Configuration @@ -232,7 +232,7 @@ data "terraform_remote_state" "foo" { ## Configuration Variables -!> **Warning:** We recommend using environment variables to supply credentials and other sensitive data. If you use `-backend-config` or hardcode these values directly in your configuration, Terraform will include these values in both the `.terraform` subdirectory and in plan files. Refer to [Credentials and Sensitive Data](/language/settings/backends/configuration#credentials-and-sensitive-data) for details. +!> **Warning:** We recommend using environment variables to supply credentials and other sensitive data. If you use `-backend-config` or hardcode these values directly in your configuration, Terraform will include these values in both the `.terraform` subdirectory and in plan files. Refer to [Credentials and Sensitive Data](/terraform/language/settings/backends/configuration#credentials-and-sensitive-data) for details. The following configuration options are supported: diff --git a/website/docs/language/settings/backends/configuration.mdx b/website/docs/language/settings/backends/configuration.mdx index bf67313f06..ffcee8fef6 100644 --- a/website/docs/language/settings/backends/configuration.mdx +++ b/website/docs/language/settings/backends/configuration.mdx @@ -4,26 +4,26 @@ page_title: Backend Configuration - Configuration Language # Backend Configuration -A backend defines where Terraform stores its [state](/language/state) data files. +A backend defines where Terraform stores its [state](/terraform/language/state) data files. -Terraform uses persisted state data to keep track of the resources it manages. Most non-trivial Terraform configurations either [integrate with Terraform Cloud](/language/settings/terraform-cloud) or use a backend to store state remotely. This lets multiple people access the state data and work together on that collection of infrastructure resources. +Terraform uses persisted state data to keep track of the resources it manages. Most non-trivial Terraform configurations either [integrate with Terraform Cloud](/terraform/language/settings/terraform-cloud) or use a backend to store state remotely. This lets multiple people access the state data and work together on that collection of infrastructure resources. This page describes how to configure a backend by adding the [`backend` block](#using-a-backend-block) to your configuration. --> **Note:** In Terraform versions before 1.1.0, we classified backends as standard or enhanced. The enhanced label differentiated the [`remote` backend](/language/settings/backends/remote), which could both store state and perform Terraform operations. This classification has been removed. Refer to [Using Terraform Cloud](/cli/cloud) for details about storing state, executing remote operations, and using Terraform Cloud directly from Terraform. +-> **Note:** In Terraform versions before 1.1.0, we classified backends as standard or enhanced. The enhanced label differentiated the [`remote` backend](/terraform/language/settings/backends/remote), which could both store state and perform Terraform operations. This classification has been removed. Refer to [Using Terraform Cloud](/terraform/cli/cloud) for details about storing state, executing remote operations, and using Terraform Cloud directly from Terraform. ## Available Backends -By default, Terraform uses a backend called [`local`](/language/settings/backends/local), which stores state as a local file on disk. You can also configure one of the built-in backends included in this documentation. +By default, Terraform uses a backend called [`local`](/terraform/language/settings/backends/local), which stores state as a local file on disk. You can also configure one of the built-in backends included in this documentation. Some of these backends act like plain remote disks for state files, while others support locking the state while operations are being performed. This helps prevent conflicts and inconsistencies. The built-in backends listed are the only backends. You cannot load additional backends as plugins. --> **Note:** We removed the `artifactory`, `etcd`, `etcdv3`, `manta`, and `swift` backends in Terraform v1.3. Information about their behavior in older versions is still available in the [Terraform v1.2 documentation](/language/v1.2.x/settings/backends/configuration). For migration paths from these removed backends, refer to [Upgrading to Terraform v1.3](/language/v1.3.x/upgrade-guides). +-> **Note:** We removed the `artifactory`, `etcd`, `etcdv3`, `manta`, and `swift` backends in Terraform v1.3. Information about their behavior in older versions is still available in the [Terraform v1.2 documentation](/terraform/language/v1.2.x/settings/backends/configuration). For migration paths from these removed backends, refer to [Upgrading to Terraform v1.3](/terraform/language/v1.3.x/upgrade-guides). ## Using a Backend Block You do not need to configure a backend when using Terraform Cloud because -Terraform Cloud automatically manages state in the workspaces associated with your configuration. If your configuration includes a [`cloud` block](/language/settings/terraform-cloud), it cannot include a `backend` block. +Terraform Cloud automatically manages state in the workspaces associated with your configuration. If your configuration includes a [`cloud` block](/terraform/language/settings/terraform-cloud), it cannot include a `backend` block. To configure a backend, add a nested `backend` block within the top-level `terraform` block. The following example configures the `remote` backend. @@ -79,7 +79,7 @@ or state operations. After you initialize, Terraform creates a `.terraform/` directory locally. This directory contains the most recent backend configuration, including any authentication parameters you provided to the Terraform CLI. Do not check this directory into Git, as it may contain sensitive credentials for your remote backend. -The local backend configuration is different and entirely separate from the `terraform.tfstate` file that contains [state data](/language/state) about your real-world infrastruture. Terraform stores the `terraform.tfstate` file in your remote backend. +The local backend configuration is different and entirely separate from the `terraform.tfstate` file that contains [state data](/terraform/language/state) about your real-world infrastruture. Terraform stores the `terraform.tfstate` file in your remote backend. When you change backends, Terraform gives you the option to migrate your state to the new backend. This lets you adopt backends without losing @@ -96,7 +96,7 @@ automatically by an automation script running Terraform. When some or all of the arguments are omitted, we call this a _partial configuration_. With a partial configuration, the remaining configuration arguments must be -provided as part of [the initialization process](/cli/init). +provided as part of [the initialization process](/terraform/cli/init). There are several ways to supply the remaining arguments: @@ -179,12 +179,12 @@ both the configuration itself as well as the type of backend (for example from "consul" to "s3"). Terraform will automatically detect any changes in your configuration -and request a [reinitialization](/cli/init). As part of +and request a [reinitialization](/terraform/cli/init). As part of the reinitialization process, Terraform will ask if you'd like to migrate your existing state to the new configuration. This allows you to easily switch from one backend to another. -If you're using multiple [workspaces](/language/state/workspaces), +If you're using multiple [workspaces](/terraform/language/state/workspaces), Terraform can copy all workspaces to the destination. If Terraform detects you have multiple workspaces, it will ask if this is what you want to do. @@ -195,7 +195,7 @@ want to migrate your state. You can respond "no" in this scenario. If you no longer want to use any backend, you can simply remove the configuration from the file. Terraform will detect this like any other -change and prompt you to [reinitialize](/cli/init). +change and prompt you to [reinitialize](/terraform/cli/init). As part of the reinitialization, Terraform will ask if you'd like to migrate your state back down to normal local state. Once this is complete then diff --git a/website/docs/language/settings/backends/consul.mdx b/website/docs/language/settings/backends/consul.mdx index 603fcfb2cd..2c4cf106ce 100644 --- a/website/docs/language/settings/backends/consul.mdx +++ b/website/docs/language/settings/backends/consul.mdx @@ -7,7 +7,7 @@ description: Terraform can store state in Consul. Stores the state in the [Consul](https://www.consul.io/) KV store at a given path. -This backend supports [state locking](/language/state/locking). +This backend supports [state locking](/terraform/language/state/locking). ## Example Configuration @@ -22,7 +22,7 @@ terraform { ``` Note that for the access credentials we recommend using a -[partial configuration](/language/settings/backends/configuration#partial-configuration). +[partial configuration](/terraform/language/settings/backends/configuration#partial-configuration). ## Data Source Configuration @@ -37,7 +37,7 @@ data "terraform_remote_state" "foo" { ## Configuration Variables -!> **Warning:** We recommend using environment variables to supply credentials and other sensitive data. If you use `-backend-config` or hardcode these values directly in your configuration, Terraform will include these values in both the `.terraform` subdirectory and in plan files. Refer to [Credentials and Sensitive Data](/language/settings/backends/configuration#credentials-and-sensitive-data) for details. +!> **Warning:** We recommend using environment variables to supply credentials and other sensitive data. If you use `-backend-config` or hardcode these values directly in your configuration, Terraform will include these values in both the `.terraform` subdirectory and in plan files. Refer to [Credentials and Sensitive Data](/terraform/language/settings/backends/configuration#credentials-and-sensitive-data) for details. The following configuration options / environment variables are supported: diff --git a/website/docs/language/settings/backends/cos.mdx b/website/docs/language/settings/backends/cos.mdx index 94037c2ca6..67c5686efc 100644 --- a/website/docs/language/settings/backends/cos.mdx +++ b/website/docs/language/settings/backends/cos.mdx @@ -9,7 +9,7 @@ description: >- Stores the state as an object in a configurable prefix in a given bucket on [Tencent Cloud Object Storage](https://intl.cloud.tencent.com/product/cos) (COS). -This backend supports [state locking](/language/state/locking). +This backend supports [state locking](/terraform/language/state/locking). ~> **Warning!** It is highly recommended that you enable [Object Versioning](https://intl.cloud.tencent.com/document/product/436/19883) on the COS bucket to allow for state recovery in the case of accidental deletions and human error. @@ -31,7 +31,7 @@ Terraform state will be written into the file `terraform/state/terraform.tfstate ## Data Source Configuration -To make use of the COS remote state in another configuration, use the [`terraform_remote_state` data source](/language/state/remote-state-data). +To make use of the COS remote state in another configuration, use the [`terraform_remote_state` data source](/terraform/language/state/remote-state-data). ```hcl data "terraform_remote_state" "foo" { @@ -47,7 +47,7 @@ data "terraform_remote_state" "foo" { ## Configuration Variables -!> **Warning:** We recommend using environment variables to supply credentials and other sensitive data. If you use `-backend-config` or hardcode these values directly in your configuration, Terraform will include these values in both the `.terraform` subdirectory and in plan files. Refer to [Credentials and Sensitive Data](/language/settings/backends/configuration#credentials-and-sensitive-data) for details. +!> **Warning:** We recommend using environment variables to supply credentials and other sensitive data. If you use `-backend-config` or hardcode these values directly in your configuration, Terraform will include these values in both the `.terraform` subdirectory and in plan files. Refer to [Credentials and Sensitive Data](/terraform/language/settings/backends/configuration#credentials-and-sensitive-data) for details. The following configuration options or environment variables are supported: diff --git a/website/docs/language/settings/backends/gcs.mdx b/website/docs/language/settings/backends/gcs.mdx index c01dc8d066..9910da282e 100644 --- a/website/docs/language/settings/backends/gcs.mdx +++ b/website/docs/language/settings/backends/gcs.mdx @@ -10,7 +10,7 @@ description: >- Stores the state as an object in a configurable prefix in a pre-existing bucket on [Google Cloud Storage](https://cloud.google.com/storage/) (GCS). The bucket must exist prior to configuring the backend. -This backend supports [state locking](/language/state/locking). +This backend supports [state locking](/terraform/language/state/locking). ~> **Warning!** It is highly recommended that you enable [Object Versioning](https://cloud.google.com/storage/docs/object-versioning) @@ -95,13 +95,13 @@ To get started, follow this guide: [Use customer-managed encryption keys](https: If you want to remove customer-managed keys from your backend configuration or change to a different customer-managed key, Terraform _can_ manage a state migration without manual intervention. This ability is because GCP stores customer-managed encryption keys and are accessible during the state migration process. However, these changes do not fully come into effect until the first write operation occurs on the state file after state migration occurs. In the first write operation after state migration, the file decrypts with the old key and then writes with the new encryption method. This method is equivalent to the [rewrite](https://cloud.google.com/storage/docs/gsutil/commands/rewrite) operation described in the customer-supplied encryption keys section. Because of the importance of the first write to state after state migration, you should not delete old KMS keys until any state file(s) encrypted with that key update. -Customer-managed keys do not need to be sent in requests to read files from GCS buckets because decryption occurs automatically within GCS. This process means that if you use the `terraform_remote_state` [data source](/language/state/remote-state-data) to access KMS-encrypted state, you do not need to specify the KMS key in the data source's `config` object. +Customer-managed keys do not need to be sent in requests to read files from GCS buckets because decryption occurs automatically within GCS. This process means that if you use the `terraform_remote_state` [data source](/terraform/language/state/remote-state-data) to access KMS-encrypted state, you do not need to specify the KMS key in the data source's `config` object. ~> **Important:** To use customer-managed encryption keys, you need to create a key and give your project's GCS service agent permission to use it with the Cloud KMS CryptoKey Encrypter/Decrypter predefined role. ## Configuration Variables -!> **Warning:** We recommend using environment variables to supply credentials and other sensitive data. If you use `-backend-config` or hardcode these values directly in your configuration, Terraform includes these values in both the `.terraform` subdirectory and in plan files. Refer to [Credentials and Sensitive Data](/language/settings/backends/configuration#credentials-and-sensitive-data) for details. +!> **Warning:** We recommend using environment variables to supply credentials and other sensitive data. If you use `-backend-config` or hardcode these values directly in your configuration, Terraform includes these values in both the `.terraform` subdirectory and in plan files. Refer to [Credentials and Sensitive Data](/terraform/language/settings/backends/configuration#credentials-and-sensitive-data) for details. The following configuration options are supported: diff --git a/website/docs/language/settings/backends/http.mdx b/website/docs/language/settings/backends/http.mdx index f4d405a747..041b64b2de 100644 --- a/website/docs/language/settings/backends/http.mdx +++ b/website/docs/language/settings/backends/http.mdx @@ -9,7 +9,7 @@ Stores the state using a simple [REST](https://en.wikipedia.org/wiki/Representat State will be fetched via GET, updated via POST, and purged with DELETE. The method used for updating is configurable. -This backend optionally supports [state locking](/language/state/locking). When locking +This backend optionally supports [state locking](/terraform/language/state/locking). When locking support is enabled it will use LOCK and UNLOCK requests providing the lock info in the body. The endpoint should return a 423: Locked or 409: Conflict with the holding lock info when it's already taken, 200: OK for success. Any other status will be considered an error. The ID of the holding lock @@ -40,7 +40,7 @@ data "terraform_remote_state" "foo" { ## Configuration Variables -!> **Warning:** We recommend using environment variables to supply credentials and other sensitive data. If you use `-backend-config` or hardcode these values directly in your configuration, Terraform will include these values in both the `.terraform` subdirectory and in plan files. Refer to [Credentials and Sensitive Data](/language/settings/backends/configuration#credentials-and-sensitive-data) for details. +!> **Warning:** We recommend using environment variables to supply credentials and other sensitive data. If you use `-backend-config` or hardcode these values directly in your configuration, Terraform will include these values in both the `.terraform` subdirectory and in plan files. Refer to [Credentials and Sensitive Data](/terraform/language/settings/backends/configuration#credentials-and-sensitive-data) for details. The following configuration options / environment variables are supported: diff --git a/website/docs/language/settings/backends/kubernetes.mdx b/website/docs/language/settings/backends/kubernetes.mdx index 1dd16537f3..262d99e941 100644 --- a/website/docs/language/settings/backends/kubernetes.mdx +++ b/website/docs/language/settings/backends/kubernetes.mdx @@ -9,7 +9,7 @@ description: Terraform can store state remotely in Kubernetes and lock that stat Stores the state in a [Kubernetes secret](https://kubernetes.io/docs/concepts/configuration/secret/). -This backend supports [state locking](/language/state/locking), with locking done using a Lease resource. +This backend supports [state locking](/terraform/language/state/locking), with locking done using a Lease resource. ## Example Configuration @@ -30,7 +30,7 @@ If the `in_cluster_config` flag is set the backend will attempt to use a [servic For most use cases either `in_cluster_config`, `config_path`, or `config_paths` will need to be set. If all flags are set the configuration at `config_path` will be used. -Note that for the access credentials we recommend using a [partial configuration](/language/settings/backends/configuration#partial-configuration). +Note that for the access credentials we recommend using a [partial configuration](/terraform/language/settings/backends/configuration#partial-configuration). ## Example Referencing @@ -46,7 +46,7 @@ data "terraform_remote_state" "foo" { ## Configuration Variables -!> **Warning:** We recommend using environment variables to supply credentials and other sensitive data. If you use `-backend-config` or hardcode these values directly in your configuration, Terraform will include these values in both the `.terraform` subdirectory and in plan files. Refer to [Credentials and Sensitive Data](/language/settings/backends/configuration#credentials-and-sensitive-data) for details. +!> **Warning:** We recommend using environment variables to supply credentials and other sensitive data. If you use `-backend-config` or hardcode these values directly in your configuration, Terraform will include these values in both the `.terraform` subdirectory and in plan files. Refer to [Credentials and Sensitive Data](/terraform/language/settings/backends/configuration#credentials-and-sensitive-data) for details. The following configuration options are supported: diff --git a/website/docs/language/settings/backends/local.mdx b/website/docs/language/settings/backends/local.mdx index 4aefa69930..32a9411794 100644 --- a/website/docs/language/settings/backends/local.mdx +++ b/website/docs/language/settings/backends/local.mdx @@ -77,7 +77,7 @@ the three arguments would typically all be paths within a temporary directory used just for one operation. Because these old workflows predate the introduction of the possibility of -[multiple workspaces](/language/state/workspaces), setting them +[multiple workspaces](/terraform/language/state/workspaces), setting them overrides Terraform's usual behavior of selecting a different state filename based on the selected workspace. If you use all three of these options then the selected workspace has no effect on which filenames Terraform will select @@ -89,7 +89,7 @@ backend type selected. We do not recommend using these options in new systems, even if you are running Terraform in automation. Instead, -[select a different backend which supports remote state](/language/settings/backends/configuration) and configure it +[select a different backend which supports remote state](/terraform/language/settings/backends/configuration) and configure it within your root module, which ensures that everyone working on your configuration will automatically retrieve and store state in the correct shared location without any special command line options. diff --git a/website/docs/language/settings/backends/oss.mdx b/website/docs/language/settings/backends/oss.mdx index 1fbd9c7f30..2498318cd9 100644 --- a/website/docs/language/settings/backends/oss.mdx +++ b/website/docs/language/settings/backends/oss.mdx @@ -11,7 +11,7 @@ This backend also supports state locking and consistency checking via [Alibaba Cloud Table Store](https://www.alibabacloud.com/help/doc-detail/27280.htm), which can be enabled by setting the `tablestore_table` field to an existing TableStore table name. -This backend supports [state locking](/language/state/locking) via TableStore. +This backend supports [state locking](/terraform/language/state/locking) via TableStore. -> **Note:** The OSS backend is available from terraform version 0.12.2. @@ -39,7 +39,7 @@ Terraform state will be written into the file `path/mystate/version-1.tfstate`. To make use of the OSS remote state in another configuration, use the [`terraform_remote_state` data -source](/language/state/remote-state-data). +source](/terraform/language/state/remote-state-data). ```hcl terraform { @@ -71,7 +71,7 @@ data "terraform_remote_state" "network" { ## Configuration Variables -!> **Warning:** We recommend using environment variables to supply credentials and other sensitive data. If you use `-backend-config` or hardcode these values directly in your configuration, Terraform will include these values in both the `.terraform` subdirectory and in plan files. Refer to [Credentials and Sensitive Data](/language/settings/backends/configuration#credentials-and-sensitive-data) for details. +!> **Warning:** We recommend using environment variables to supply credentials and other sensitive data. If you use `-backend-config` or hardcode these values directly in your configuration, Terraform will include these values in both the `.terraform` subdirectory and in plan files. Refer to [Credentials and Sensitive Data](/terraform/language/settings/backends/configuration#credentials-and-sensitive-data) for details. The following configuration options or environment variables are supported: diff --git a/website/docs/language/settings/backends/pg.mdx b/website/docs/language/settings/backends/pg.mdx index 1375792fda..fe2acb6664 100644 --- a/website/docs/language/settings/backends/pg.mdx +++ b/website/docs/language/settings/backends/pg.mdx @@ -7,7 +7,7 @@ description: Terraform can store state remotely in a Postgres database with lock Stores the state in a [Postgres database](https://www.postgresql.org) version 10 or newer. -This backend supports [state locking](/language/state/locking). +This backend supports [state locking](/terraform/language/state/locking). ## Example Configuration @@ -28,7 +28,7 @@ createdb terraform_backend This `createdb` command is found in [Postgres client applications](https://www.postgresql.org/docs/10/reference-client.html) which are installed along with the database server. We recommend using a -[partial configuration](/language/settings/backends/configuration#partial-configuration) +[partial configuration](/terraform/language/settings/backends/configuration#partial-configuration) for the `conn_str` variable, because it typically contains access credentials that should not be committed to source control: ```hcl @@ -51,7 +51,7 @@ terraform init -backend-config="conn_str=postgres://localhost/terraform_backend? ## Data Source Configuration -To make use of the pg remote state in another configuration, use the [`terraform_remote_state` data source](/language/state/remote-state-data). +To make use of the pg remote state in another configuration, use the [`terraform_remote_state` data source](/terraform/language/state/remote-state-data). ```hcl data "terraform_remote_state" "network" { @@ -64,7 +64,7 @@ data "terraform_remote_state" "network" { ## Configuration Variables -!> **Warning:** We recommend using environment variables to supply credentials and other sensitive data. If you use `-backend-config` or hardcode these values directly in your configuration, Terraform will include these values in both the `.terraform` subdirectory and in plan files. Refer to [Credentials and Sensitive Data](/language/settings/backends/configuration#credentials-and-sensitive-data) for details. +!> **Warning:** We recommend using environment variables to supply credentials and other sensitive data. If you use `-backend-config` or hardcode these values directly in your configuration, Terraform will include these values in both the `.terraform` subdirectory and in plan files. Refer to [Credentials and Sensitive Data](/terraform/language/settings/backends/configuration#credentials-and-sensitive-data) for details. The following configuration options or environment variables are supported: @@ -78,9 +78,9 @@ The following configuration options or environment variables are supported: This backend creates one table **states** in the automatically-managed Postgres schema configured by the `schema_name` variable. -The table is keyed by the [workspace](/language/state/workspaces) name. If workspaces are not in use, the name `default` is used. +The table is keyed by the [workspace](/terraform/language/state/workspaces) name. If workspaces are not in use, the name `default` is used. -Locking is supported using [Postgres advisory locks](https://www.postgresql.org/docs/9.5/explicit-locking.html#ADVISORY-LOCKS). [`force-unlock`](/cli/commands/force-unlock) is not supported, because these database-native locks will automatically unlock when the session is aborted or the connection fails. To see outstanding locks in a Postgres server, use the [`pg_locks` system view](https://www.postgresql.org/docs/9.5/view-pg-locks.html). +Locking is supported using [Postgres advisory locks](https://www.postgresql.org/docs/9.5/explicit-locking.html#ADVISORY-LOCKS). [`force-unlock`](/terraform/cli/commands/force-unlock) is not supported, because these database-native locks will automatically unlock when the session is aborted or the connection fails. To see outstanding locks in a Postgres server, use the [`pg_locks` system view](https://www.postgresql.org/docs/9.5/view-pg-locks.html). The **states** table contains: diff --git a/website/docs/language/settings/backends/remote.mdx b/website/docs/language/settings/backends/remote.mdx index 721fc4f57c..4731590311 100644 --- a/website/docs/language/settings/backends/remote.mdx +++ b/website/docs/language/settings/backends/remote.mdx @@ -7,9 +7,9 @@ description: >- # remote --> **Note:** We introduced the remote backend in Terraform v0.11.13 and Terraform Enterprise v201809-1. As of Terraform v1.1.0 and Terraform Enterprise v202201-1, **we recommend using the Terraform Cloud's built-in [`cloud` integration](/cli/cloud/settings)** instead of this backend. The `cloud` option includes an improved user experience and more features. +-> **Note:** We introduced the remote backend in Terraform v0.11.13 and Terraform Enterprise v201809-1. As of Terraform v1.1.0 and Terraform Enterprise v202201-1, **we recommend using the Terraform Cloud's built-in [`cloud` integration](/terraform/cli/cloud/settings)** instead of this backend. The `cloud` option includes an improved user experience and more features. -The remote backend is unique among all other Terraform backends because it can both store state snapshots and execute operations for Terraform Cloud's [CLI-driven run workflow](/cloud-docs/run/cli). It used to be called an "enhanced" backend. +The remote backend is unique among all other Terraform backends because it can both store state snapshots and execute operations for Terraform Cloud's [CLI-driven run workflow](/terraform/cloud-docs/run/cli). It used to be called an "enhanced" backend. When using full remote operations, operations like `terraform plan` or `terraform apply` can be executed in Terraform Cloud's run environment, with log output streaming to the local terminal. Remote plans and applies use variable values from the associated Terraform Cloud workspace. @@ -51,7 +51,7 @@ determines which mode it uses: all of the desired remote workspace names. For example, set `prefix = "networking-"` to use Terraform cloud workspaces with names like `networking-dev` and `networking-prod`. This is helpful when - mapping multiple Terraform CLI [workspaces](/language/state/workspaces) + mapping multiple Terraform CLI [workspaces](/terraform/language/state/workspaces) used in a single Terraform configuration to multiple Terraform Cloud workspaces. @@ -69,7 +69,7 @@ running any remote operations against them. Terraform uses shortened names without the common prefix to interact with workspaces on the command line. For example, if `prefix = "networking-"`, use `terraform workspace select prod` to switch to the Terraform CLI workspace `prod` within the current configuration. However, remote Terraform operations such as `plan` and `apply` for that Terraform CLI workspace will take place in the Terraform Cloud workspace `networking-prod`. -Because of this, the [`terraform.workspace`](/language/state/workspaces#current-workspace-interpolation) interpolation expression produces different results depending on whether a remote workspace is configured to perform operations locally or remotely. For example, in a remote workspace called `networking-prod` created with `prefix = "networking-"` the expression produces the following: +Because of this, the [`terraform.workspace`](/terraform/language/state/workspaces#current-workspace-interpolation) interpolation expression produces different results depending on whether a remote workspace is configured to perform operations locally or remotely. For example, in a remote workspace called `networking-prod` created with `prefix = "networking-"` the expression produces the following: - For local operations, `terraform.workspace` = `prod` - For remote operations, `terraform.workspace`= `networking-prod` @@ -79,7 +79,7 @@ which workspace you set with the `terraform workspace select` command. Therefore ### Determining Run Environment -If you need to determine whether a run is local or remote in your Terraform configuration, we recommend using [Terraform Cloud run environment variables](/cloud-docs/run/run-environment#environment-variables). The example below uses `TFC_RUN_ID`. +If you need to determine whether a run is local or remote in your Terraform configuration, we recommend using [Terraform Cloud run environment variables](/terraform/cloud-docs/run/run-environment#environment-variables). The example below uses `TFC_RUN_ID`. ``` output "current_workspace_name" { @@ -100,8 +100,8 @@ output "remote_execution_determine" { ## Example Configurations -> **Note:** We recommend omitting the token from the configuration, and instead using -[`terraform login`](/cli/commands/login) or manually configuring -`credentials` in the [CLI config file](/cli/config/config-file#credentials). +[`terraform login`](/terraform/cli/commands/login) or manually configuring +`credentials` in the [CLI config file](/terraform/cli/config/config-file#credentials). ### Basic Configuration @@ -175,7 +175,7 @@ data "terraform_remote_state" "foo" { ## Configuration Variables -!> **Warning:** We recommend using environment variables to supply credentials and other sensitive data. If you use `-backend-config` or hardcode these values directly in your configuration, Terraform will include these values in both the `.terraform` subdirectory and in plan files. Refer to [Credentials and Sensitive Data](/language/settings/backends/configuration#credentials-and-sensitive-data) for details. +!> **Warning:** We recommend using environment variables to supply credentials and other sensitive data. If you use `-backend-config` or hardcode these values directly in your configuration, Terraform will include these values in both the `.terraform` subdirectory and in plan files. Refer to [Credentials and Sensitive Data](/terraform/language/settings/backends/configuration#credentials-and-sensitive-data) for details. The following configuration options are supported: @@ -185,9 +185,9 @@ The following configuration options are supported: targeted workspace(s). - `token` - (Optional) The token used to authenticate with the remote backend. 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). - `workspaces` - (Required) A block specifying which remote workspace(s) to use. The `workspaces` block supports the following keys: @@ -227,7 +227,7 @@ the remote workspace accept the following option to modify that behavior: -> **Version note:** `.terraformignore` support was added in Terraform 0.12.11. -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), an archive of your configuration directory is uploaded to Terraform Cloud. You can define paths to ignore from upload via a `.terraformignore` file at the root of your configuration directory. If this file is not present, the archive will exclude the following by default: diff --git a/website/docs/language/settings/backends/s3.mdx b/website/docs/language/settings/backends/s3.mdx index 3519140473..9fc128ace8 100644 --- a/website/docs/language/settings/backends/s3.mdx +++ b/website/docs/language/settings/backends/s3.mdx @@ -32,7 +32,7 @@ This assumes we have a bucket created called `mybucket`. The Terraform state is written to the key `path/to/my/key`. Note that for the access credentials we recommend using a -[partial configuration](/language/settings/backends/configuration#partial-configuration). +[partial configuration](/terraform/language/settings/backends/configuration#partial-configuration). ### S3 Bucket Permissions @@ -105,7 +105,7 @@ This is seen in the following AWS IAM Statement: To make use of the S3 remote state in another configuration, use the [`terraform_remote_state` data -source](/language/state/remote-state-data). +source](/terraform/language/state/remote-state-data). ```hcl data "terraform_remote_state" "network" { @@ -144,7 +144,7 @@ This backend requires the configuration of the AWS Region and S3 state storage. ### Credentials and Shared Configuration -!> **Warning:** We recommend using environment variables to supply credentials and other sensitive data. If you use `-backend-config` or hardcode these values directly in your configuration, Terraform will include these values in both the `.terraform` subdirectory and in plan files. Refer to [Credentials and Sensitive Data](/language/settings/backends/configuration#credentials-and-sensitive-data) for details. +!> **Warning:** We recommend using environment variables to supply credentials and other sensitive data. If you use `-backend-config` or hardcode these values directly in your configuration, Terraform will include these values in both the `.terraform` subdirectory and in plan files. Refer to [Credentials and Sensitive Data](/terraform/language/settings/backends/configuration#credentials-and-sensitive-data) for details. The following configuration is required: @@ -182,7 +182,7 @@ The following configuration is optional: The following configuration is required: * `bucket` - (Required) Name of the S3 Bucket. -* `key` - (Required) Path to the state file inside the S3 Bucket. When using a non-default [workspace](/language/state/workspaces), the state path will be `/workspace_key_prefix/workspace_name/key` (see also the `workspace_key_prefix` configuration). +* `key` - (Required) Path to the state file inside the S3 Bucket. When using a non-default [workspace](/terraform/language/state/workspaces), the state path will be `/workspace_key_prefix/workspace_name/key` (see also the `workspace_key_prefix` configuration). The following configuration is optional: @@ -214,7 +214,7 @@ The S3 backend can be used in a number of different ways that make different tradeoffs between convenience, security, and isolation in such an organization. This section describes one such approach that aims to find a good compromise between these tradeoffs, allowing use of -[Terraform's workspaces feature](/language/state/workspaces) to switch +[Terraform's workspaces feature](/terraform/language/state/workspaces) to switch conveniently between multiple isolated deployments of the same configuration. Use this section as a starting-point for your approach, but note that @@ -322,7 +322,7 @@ provider "aws" { If workspace IAM roles are centrally managed and shared across many separate Terraform configurations, the role ARNs could also be obtained via a data -source such as [`terraform_remote_state`](/language/state/remote-state-data) +source such as [`terraform_remote_state`](/terraform/language/state/remote-state-data) to avoid repeating these values. ### Creating and Selecting Workspaces @@ -363,7 +363,7 @@ $ terraform apply ### Running Terraform in Amazon EC2 Teams that make extensive use of Terraform for infrastructure management -often [run 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) +often [run Terraform in automation](/terraform/tutorials/automation/automate-terraform?utm_source=WEBSITE&utm_medium=WEB_IO&utm_offer=ARTICLE_PAGE&utm_content=DOCS) to ensure a consistent operating environment and to limit access to the various secrets and other sensitive information that Terraform configurations tend to require. diff --git a/website/docs/language/settings/index.mdx b/website/docs/language/settings/index.mdx index a3ea0b3ef5..441d6eac4b 100644 --- a/website/docs/language/settings/index.mdx +++ b/website/docs/language/settings/index.mdx @@ -33,11 +33,11 @@ following sections. ## Configuring Terraform Cloud The nested `cloud` block configures Terraform Cloud for enabling its -[CLI-driven run workflow](/cloud-docs/run/cli). +[CLI-driven run workflow](/terraform/cloud-docs/run/cli). -- Refer to [Terraform Cloud Configuration](/language/settings/terraform-cloud) for a summary of the `cloud` block's syntax. +- Refer to [Terraform Cloud Configuration](/terraform/language/settings/terraform-cloud) for a summary of the `cloud` block's syntax. -- Refer to [Using Terraform Cloud](/cli/cloud) in the +- Refer to [Using Terraform Cloud](/terraform/cli/cloud) in the Terraform CLI documentation for complete details about how to initialize and configure the Terraform Cloud CLI integration. ## Configuring a Terraform Backend @@ -45,20 +45,20 @@ The nested `cloud` block configures Terraform Cloud for enabling its The nested `backend` block configures which state backend Terraform should use. The syntax and behavior of the `backend` block is described in [Backend -Configuration](/language/settings/backends/configuration). +Configuration](/terraform/language/settings/backends/configuration). ## Specifying a Required Terraform Version -> **Hands-on:** Try the [Manage Terraform Versions](https://learn.hashicorp.com/tutorials/terraform/versions?in=terraform/configuration-language) or [Manage Terraform Versions in Terraform Cloud](https://learn.hashicorp.com/tutorials/terraform/cloud-versions?in=terraform/cloud) tutorials. +> **Hands-on:** Try the [Manage Terraform Versions](/terraform/tutorials/configuration-language/versions) or [Manage Terraform Versions in Terraform Cloud](/terraform/tutorials/cloud/cloud-versions) tutorials. The `required_version` setting accepts a [version constraint -string,](/language/expressions/version-constraints) which specifies which versions of Terraform +string,](/terraform/language/expressions/version-constraints) which specifies which versions of Terraform can be used with your configuration. If the running version of Terraform doesn't match the constraints specified, Terraform will produce an error and exit without taking any further actions. -When you use [child modules](/language/modules), each module can specify its own +When you use [child modules](/terraform/language/modules), each module can specify its own version requirements. The requirements of all modules in the tree must be satisfied. @@ -69,7 +69,7 @@ a minimum Terraform version that has behavior expected by the configuration. The `required_version` setting applies only to the version of Terraform CLI. Terraform's resource types are implemented by provider plugins, whose release cycles are independent of Terraform CLI and of each other. -Use [the `required_providers` block](/language/providers/requirements) to manage +Use [the `required_providers` block](/terraform/language/providers/requirements) to manage the expected versions for each provider you use. ## Specifying Provider Requirements @@ -91,7 +91,7 @@ terraform { } ``` -For more information, see [Provider Requirements](/language/providers/requirements). +For more information, see [Provider Requirements](/terraform/language/providers/requirements). ## Experimental Language Features @@ -136,4 +136,4 @@ provider a module is using, if the provider defines a schema for it. This allows the provider to receive module-specific information, and is primarily intended for modules distributed by the same vendor as the associated provider. -For more information, see [Provider Metadata](/internals/provider-meta). +For more information, see [Provider Metadata](/terraform/internals/provider-meta). diff --git a/website/docs/language/settings/terraform-cloud.mdx b/website/docs/language/settings/terraform-cloud.mdx index 184256d883..556aea35ac 100644 --- a/website/docs/language/settings/terraform-cloud.mdx +++ b/website/docs/language/settings/terraform-cloud.mdx @@ -7,16 +7,16 @@ description: >- # Terraform Cloud Configuration -The main module of a Terraform configuration can integrate with Terraform Cloud to enable its [CLI-driven run workflow](/cloud-docs/run/cli). You only need to configure these settings when you want to use Terraform CLI to interact with Terraform Cloud. Terraform Cloud ignores them when interacting with +The main module of a Terraform configuration can integrate with Terraform Cloud to enable its [CLI-driven run workflow](/terraform/cloud-docs/run/cli). You only need to configure these settings when you want to use Terraform CLI to interact with Terraform Cloud. Terraform Cloud ignores them when interacting with Terraform through version control or the API. -> **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. ## Usage Example -To configure the Terraform Cloud CLI integration, add a nested `cloud` block within the `terraform` block. You cannot use the CLI integration and a [state backend](/language/settings/backends/configuration) in the same configuration. +To configure the Terraform Cloud CLI integration, add a nested `cloud` block within the `terraform` block. You cannot use the CLI integration and a [state backend](/terraform/language/settings/backends/configuration) in the same configuration. -Refer to [Using Terraform Cloud](/cli/cloud) in the Terraform CLI documentation for full configuration details, migration instructions, and command line arguments. +Refer to [Using Terraform Cloud](/terraform/cli/cloud) in the Terraform CLI documentation for full configuration details, migration instructions, and command line arguments. ```hcl terraform { diff --git a/website/docs/language/state/backends.mdx b/website/docs/language/state/backends.mdx index 3ada78e073..72af00c005 100644 --- a/website/docs/language/state/backends.mdx +++ b/website/docs/language/state/backends.mdx @@ -8,7 +8,7 @@ description: >- # State Storage and Locking Backends are responsible for storing state and providing an API for -[state locking](/language/state/locking). State locking is optional. +[state locking](/terraform/language/state/locking). State locking is optional. Despite the state being stored remotely, all Terraform commands such as `terraform console`, the `terraform state` operations, `terraform taint`, @@ -63,10 +63,10 @@ prior to forcing the overwrite. ## State Locking -Backends are responsible for supporting [state locking](/language/state/locking) +Backends are responsible for supporting [state locking](/terraform/language/state/locking) if possible. -Not all backends support locking. The [documentation for each backend](/language/settings/backends/configuration#available-backends) includes details about whether it supports locking or not. +Not all backends support locking. The [documentation for each backend](/terraform/language/settings/backends/configuration#available-backends) includes details about whether it supports locking or not. For more information on state locking, view the -[page dedicated to state locking](/language/state/locking). +[page dedicated to state locking](/terraform/language/state/locking). diff --git a/website/docs/language/state/import.mdx b/website/docs/language/state/import.mdx index d42037a95c..a9de85e93b 100644 --- a/website/docs/language/state/import.mdx +++ b/website/docs/language/state/import.mdx @@ -11,4 +11,4 @@ Terraform is able to import existing infrastructure. This allows you to take resources you have created by some other means and bring them under Terraform management. To learn more about this, please visit the -[pages dedicated to import](/cli/import). +[pages dedicated to import](/terraform/cli/import). diff --git a/website/docs/language/state/index.mdx b/website/docs/language/state/index.mdx index fea81b2cbe..ca2b1445af 100644 --- a/website/docs/language/state/index.mdx +++ b/website/docs/language/state/index.mdx @@ -17,7 +17,7 @@ but it can also be stored remotely, which works better in a team environment. Terraform uses this local state to create plans and make changes to your infrastructure. Prior to any operation, Terraform does a -[refresh](/cli/commands/refresh) to update the state with the +[refresh](/terraform/cli/commands/refresh) to update the state with the real infrastructure. The primary purpose of Terraform state is to store bindings between objects in @@ -28,13 +28,13 @@ resource instance, and then potentially update or delete that object in response to future configuration changes. For more information on why Terraform requires state and why Terraform cannot -function without state, please see the page [state purpose](/language/state/purpose). +function without state, please see the page [state purpose](/terraform/language/state/purpose). ## Inspection and Modification While the format of the state files are just JSON, direct file editing of the state is discouraged. Terraform provides the -[terraform state](/cli/commands/state) command to perform +[terraform state](/terraform/cli/commands/state) command to perform basic modifications of the state using the CLI. The CLI usage and output of the state commands is structured to be @@ -67,10 +67,10 @@ in new versions. Alternatively, there are several integration points which produce JSON output that is specifically intended for consumption by external software: -* [The `terraform output` command](/cli/commands/output) +* [The `terraform output` command](/terraform/cli/commands/output) has a `-json` option, for obtaining either the full set of root module output values or a specific named output value from the latest state snapshot. -* [The `terraform show` command](/cli/commands/show) has a `-json` +* [The `terraform show` command](/terraform/cli/commands/show) has a `-json` option for inspecting the latest state snapshot in full, and also for inspecting saved plan files which include a copy of the prior state at the time the plan was made. diff --git a/website/docs/language/state/locking.mdx b/website/docs/language/state/locking.mdx index f81bcbd040..a5fa145a3b 100644 --- a/website/docs/language/state/locking.mdx +++ b/website/docs/language/state/locking.mdx @@ -7,7 +7,7 @@ description: >- # State Locking -If supported by your [backend](/language/settings/backends/configuration), Terraform will lock your +If supported by your [backend](/terraform/language/settings/backends/configuration), Terraform will lock your state for all operations that could write state. This prevents others from acquiring the lock and potentially corrupting your state. @@ -21,12 +21,12 @@ a status message. If Terraform doesn't output a message, state locking is still occurring if your backend supports it. Not all backends support locking. The -[documentation for each backend](/language/settings/backends/configuration) +[documentation for each backend](/terraform/language/settings/backends/configuration) includes details on whether it supports locking or not. ## Force Unlock -Terraform has a [force-unlock command](/cli/commands/force-unlock) +Terraform has a [force-unlock command](/terraform/cli/commands/force-unlock) to manually unlock the state if unlocking failed. **Be very careful with this command.** If you unlock the state when someone diff --git a/website/docs/language/state/purpose.mdx b/website/docs/language/state/purpose.mdx index 45fef6cb25..681e996385 100644 --- a/website/docs/language/state/purpose.mdx +++ b/website/docs/language/state/purpose.mdx @@ -102,7 +102,7 @@ started, but when using Terraform in a team it is important for everyone to be working with the same state so that operations will be applied to the same remote objects. -[Remote state](/language/state/remote) is the recommended solution +[Remote state](/terraform/language/state/remote) is the recommended solution to this problem. With a fully-featured state backend, Terraform can use remote locking as a measure to avoid two or more different users accidentally running Terraform at the same time, and thus ensure that each Terraform run diff --git a/website/docs/language/state/remote-state-data.mdx b/website/docs/language/state/remote-state-data.mdx index 437be4fffb..1cbe2986e2 100644 --- a/website/docs/language/state/remote-state-data.mdx +++ b/website/docs/language/state/remote-state-data.mdx @@ -7,12 +7,12 @@ description: >- # The `terraform_remote_state` Data Source -[backends]: /language/settings/backends/configuration +[backends]: /terraform/language/settings/backends/configuration The `terraform_remote_state` data source uses the latest state snapshot from a specified state backend to retrieve the root module output values from some other Terraform configuration. -You can use the `terraform_remote_state` data source without requiring or configuring a provider. It is always available through a built-in provider with the [source address](/language/providers/requirements#source-addresses) `terraform.io/builtin/terraform`. That provider does not include any other resources or data sources. +You can use the `terraform_remote_state` data source without requiring or configuring a provider. It is always available through a built-in provider with the [source address](/terraform/language/providers/requirements#source-addresses) `terraform.io/builtin/terraform`. That provider does not include any other resources or data sources. ~> **Important:** We recommend using the [`tfe_outputs` data source](https://registry.terraform.io/providers/hashicorp/tfe/latest/docs/data-sources/outputs) in the [Terraform Cloud/Enterprise Provider](https://registry.terraform.io/providers/hashicorp/tfe/latest/docs) to access remote state outputs in Terraform Cloud or Terraform Enterprise. The `tfe_outputs` data source is more secure because it does not require full access to workspace state to fetch outputs. @@ -68,7 +68,7 @@ use of. For example: store or Consul service catalog can make that data also accessible via [Consul Template](https://github.com/hashicorp/consul-template) or the - [HashiCorp Nomad](https://developer.hashicorp.com/nomad/docs/job-specification/template) + [HashiCorp Nomad](/nomad/docs/job-specification/template) `template` stanza. * If you use Kubernetes then you can [make Config Maps available to your Pods](https://kubernetes.io/docs/tasks/configure-pod-container/configure-pod-configmap/). @@ -76,14 +76,14 @@ use of. For example: Some of the data stores listed above are specifically designed for storing small configuration values, while others are generic blob storage systems. For those generic systems, you can use -[the `jsonencode` function](/language/functions/jsonencode) +[the `jsonencode` function](/terraform/language/functions/jsonencode) and -[the `jsondecode` function](/language/functions/jsondecode) respectively +[the `jsondecode` function](/terraform/language/functions/jsondecode) respectively to store and retrieve structured data. You can encapsulate the implementation details of retrieving your published configuration data by writing a -[data-only module](/language/modules/develop/composition#data-only-modules) +[data-only module](/terraform/language/modules/develop/composition#data-only-modules) containing the necessary data source configuration and any necessary post-processing such as JSON decoding. You can then change that module later if you switch to a different strategy for sharing data between multiple @@ -153,7 +153,7 @@ The following arguments are supported: The `config` object can use any arguments that would be valid in the equivalent `terraform { backend "" { ... } }` block. See - [the documentation of your chosen backend](/language/settings/backends/configuration) + [the documentation of your chosen backend](/terraform/language/settings/backends/configuration) for details. -> **Note:** If the backend configuration requires a nested block, specify @@ -167,8 +167,8 @@ The following arguments are supported: In addition to the above, the following attributes are exported: * (v0.12+) `outputs` - An object containing every root-level - [output](/language/values/outputs) in the remote state. -* (<= v0.11) `` - Each root-level [output](/language/values/outputs) + [output](/terraform/language/values/outputs) in the remote state. +* (<= v0.11) `` - Each root-level [output](/terraform/language/values/outputs) in the remote state appears as a top level attribute on the data source. ## Root Outputs Only diff --git a/website/docs/language/state/remote.mdx b/website/docs/language/state/remote.mdx index a50db7a8eb..1709ab94a7 100644 --- a/website/docs/language/state/remote.mdx +++ b/website/docs/language/state/remote.mdx @@ -18,13 +18,13 @@ which can then be shared between all members of a team. Terraform supports storing state in [Terraform Cloud](https://www.hashicorp.com/products/terraform/), [HashiCorp Consul](https://www.consul.io/), Amazon S3, Azure Blob Storage, Google Cloud Storage, Alibaba Cloud OSS, and more. -Remote state is implemented by a [backend](/language/settings/backends/configuration) or by +Remote state is implemented by a [backend](/terraform/language/settings/backends/configuration) or by Terraform Cloud, both of which you can configure in your configuration's root module. ## Delegation and Teamwork Remote state allows you to share -[output values](/language/values/outputs) with other configurations. +[output values](/terraform/language/values/outputs) with other configurations. This allows your infrastructure to be decomposed into smaller components. Put another way, remote state also allows teams to share infrastructure @@ -38,7 +38,7 @@ you can expose things such as VPC IDs, subnets, NAT instance IDs, etc. through remote state and have other Terraform states consume that. For example usage, see -[the `terraform_remote_state` data source](/language/state/remote-state-data). +[the `terraform_remote_state` data source](/terraform/language/state/remote-state-data). While remote state can be a convenient, built-in mechanism for sharing data between configurations, you may prefer to use more general stores to @@ -52,7 +52,7 @@ another that consumes those values using ## Locking and Teamwork For fully-featured remote backends, Terraform can also use -[state locking](/language/state/locking) to prevent concurrent runs of +[state locking](/terraform/language/state/locking) to prevent concurrent runs of Terraform against the same state. [Terraform Cloud by HashiCorp](https://www.hashicorp.com/products/terraform/) diff --git a/website/docs/language/state/sensitive-data.mdx b/website/docs/language/state/sensitive-data.mdx index 0fcd5ea55a..aa473bf183 100644 --- a/website/docs/language/state/sensitive-data.mdx +++ b/website/docs/language/state/sensitive-data.mdx @@ -12,7 +12,7 @@ passwords. When using local state, state is stored in plain-text JSON files. -When using [remote state](/language/state/remote), state is only ever held in +When using [remote state](/terraform/language/state/remote), state is only ever held in memory when used by Terraform. It may be encrypted at rest, but this depends on the specific remote state backend. @@ -30,7 +30,7 @@ For example: - [Terraform Cloud](https://cloud.hashicorp.com/products/terraform) always encrypts state at rest and protects it with TLS in transit. Terraform Cloud also knows the identity of the user requesting state and maintains a history of state changes. This can - be used to control access and track activity. [Terraform Enterprise](/enterprise) + be used to control access and track activity. [Terraform Enterprise](/terraform/enterprise) also supports detailed audit logging. - The S3 backend supports encryption at rest when the `encrypt` option is enabled. IAM policies and logging can be used to identify any invalid access. diff --git a/website/docs/language/state/workspaces.mdx b/website/docs/language/state/workspaces.mdx index e469a965f4..61501d0c38 100644 --- a/website/docs/language/state/workspaces.mdx +++ b/website/docs/language/state/workspaces.mdx @@ -7,38 +7,38 @@ description: >- # Workspaces -Each Terraform configuration has an associated [backend](/language/settings/backends/configuration) that defines how Terraform executes operations and where Terraform stores persistent data, like [state](/language/state/purpose). +Each Terraform configuration has an associated [backend](/terraform/language/settings/backends/configuration) that defines how Terraform executes operations and where Terraform stores persistent data, like [state](/terraform/language/state/purpose). The persistent data stored in the backend belongs to a workspace. The backend initially has only one workspace containing one Terraform state associated with that configuration. Some backends support multiple named workspaces, allowing multiple states to be associated with a single configuration. The configuration still has only one backend, but you can deploy multiple distinct instances of that configuration without configuring a new backend or changing authentication credentials. --> **Note**: The Terraform CLI workspaces are different from [workspaces in Terraform Cloud](/cloud-docs/workspaces). Refer to [Initializing and Migrating](/cli/cloud/migrating) for details about migrating a configuration with multiple workspaces to Terraform Cloud. +-> **Note**: The Terraform CLI workspaces are different from [workspaces in Terraform Cloud](/terraform/cloud-docs/workspaces). Refer to [Initializing and Migrating](/terraform/cli/cloud/migrating) for details about migrating a configuration with multiple workspaces to Terraform Cloud. ## Backends Supporting Multiple Workspaces You can use multiple workspaces with the following backends: -- [AzureRM](/language/settings/backends/azurerm) -- [Consul](/language/settings/backends/consul) -- [COS](/language/settings/backends/cos) -- [GCS](/language/settings/backends/gcs) -- [Kubernetes](/language/settings/backends/kubernetes) -- [Local](/language/settings/backends/local) -- [OSS](/language/settings/backends/oss) -- [Postgres](/language/settings/backends/pg) -- [Remote](/language/settings/backends/remote) -- [S3](/language/settings/backends/s3) +- [AzureRM](/terraform/language/settings/backends/azurerm) +- [Consul](/terraform/language/settings/backends/consul) +- [COS](/terraform/language/settings/backends/cos) +- [GCS](/terraform/language/settings/backends/gcs) +- [Kubernetes](/terraform/language/settings/backends/kubernetes) +- [Local](/terraform/language/settings/backends/local) +- [OSS](/terraform/language/settings/backends/oss) +- [Postgres](/terraform/language/settings/backends/pg) +- [Remote](/terraform/language/settings/backends/remote) +- [S3](/terraform/language/settings/backends/s3) ## Using Workspaces -~> **Important:** Workspaces are not appropriate for system decomposition or deployments requiring separate credentials and access controls. Refer to [Use Cases](/cli/workspaces#use-cases) in the Terraform CLI documentation for details and recommended alternatives. +~> **Important:** Workspaces are not appropriate for system decomposition or deployments requiring separate credentials and access controls. Refer to [Use Cases](/terraform/cli/workspaces#use-cases) in the Terraform CLI documentation for details and recommended alternatives. Terraform starts with a single, default workspace named `default` that you cannot delete. If you have not created a new workspace, you are using the default workspace in your Terraform working directory. When you run `terraform plan` in a new workspace, Terraform does not access existing resources in other workspaces. These resources still physically exist, but you must switch workspaces to manage them. -Refer to the [Terraform CLI workspaces](/cli/workspaces) documentation for full details about how to create and use workspaces. +Refer to the [Terraform CLI workspaces](/terraform/cli/workspaces) documentation for full details about how to create and use workspaces. ## Current Workspace Interpolation diff --git a/website/docs/language/syntax/configuration.mdx b/website/docs/language/syntax/configuration.mdx index 01467288b0..114249876a 100644 --- a/website/docs/language/syntax/configuration.mdx +++ b/website/docs/language/syntax/configuration.mdx @@ -15,7 +15,7 @@ those constructs are built from. This page describes the _native syntax_ of the Terraform language, which is a rich language designed to be relatively easy for humans to read and write. The constructs in the Terraform language can also be expressed in -[JSON syntax](/language/syntax/json), which is harder for humans +[JSON syntax](/terraform/language/syntax/json), which is harder for humans to read and edit but easier to generate and parse programmatically. This low-level syntax of the Terraform language is defined in terms of a @@ -46,7 +46,7 @@ after the equals sign is the argument's value. The context where the argument appears determines what value types are valid (for example, each resource type has a schema that defines the types of its arguments), but many arguments accept arbitrary -[expressions](/language/expressions), which allow the value to +[expressions](/terraform/language/expressions), which allow the value to either be specified literally or generated from other values programmatically. -> **Note:** Terraform's configuration language is based on a more general diff --git a/website/docs/language/syntax/index.mdx b/website/docs/language/syntax/index.mdx index 742a40fef8..199166bb78 100644 --- a/website/docs/language/syntax/index.mdx +++ b/website/docs/language/syntax/index.mdx @@ -11,13 +11,13 @@ The majority of the Terraform language documentation focuses on the practical uses of the language and the specific constructs it uses. The pages in this section offer a more abstract view of the Terraform language. -- [Configuration Syntax](/language/syntax/configuration) describes the native +- [Configuration Syntax](/terraform/language/syntax/configuration) describes the native grammar of the Terraform language. -- [JSON Configuration Syntax](/language/syntax/json) documents +- [JSON Configuration Syntax](/terraform/language/syntax/json) documents how to represent Terraform language constructs in the pure JSON variant of the Terraform language. Terraform's JSON syntax is unfriendly to humans, but can be very useful when generating infrastructure as code with other systems that don't have a readily available HCL library. -- [Style Conventions](/language/syntax/style) documents some commonly +- [Style Conventions](/terraform/language/syntax/style) documents some commonly accepted formatting guidelines for Terraform code. These conventions can be - enforced automatically with [`terraform fmt`](/cli/commands/fmt). + enforced automatically with [`terraform fmt`](/terraform/cli/commands/fmt). diff --git a/website/docs/language/syntax/json.mdx b/website/docs/language/syntax/json.mdx index 477ce9fd7e..9f8ae509fa 100644 --- a/website/docs/language/syntax/json.mdx +++ b/website/docs/language/syntax/json.mdx @@ -8,7 +8,7 @@ description: >- # JSON Configuration Syntax Most Terraform configurations are written in -[the native Terraform language syntax](/language/syntax/configuration), which is designed to be +[the native Terraform language syntax](/terraform/language/syntax/configuration), which is designed to be relatively easy for humans to read and update. Terraform also supports an alternative syntax that is JSON-compatible. This @@ -92,7 +92,7 @@ different (see the [block-type-specific exceptions](#block-type-specific-excepti correspond either to argument names or to nested block type names. * Where a property corresponds to an argument that accepts - [arbitrary expressions](/language/expressions) in the native syntax, the + [arbitrary expressions](/terraform/language/expressions) in the native syntax, the property value is mapped to an expression as described under [_Expression Mapping_](#expression-mapping) below. For arguments that do _not_ accept arbitrary expressions, the interpretation of the property @@ -109,7 +109,7 @@ different (see the [block-type-specific exceptions](#block-type-specific-excepti ## Expression Mapping Since JSON grammar is not able to represent all of the Terraform language -[expression syntax](/language/expressions), JSON values interpreted as expressions +[expression syntax](/terraform/language/expressions), JSON values interpreted as expressions are mapped as follows: | JSON | Terraform Language Interpretation | @@ -121,7 +121,7 @@ are mapped as follows: | Array | Each element is mapped per this table, producing a `tuple(...)` value with suitable element types. | | Null | A literal `null`. | -[string template]: /language/expressions/strings#string-templates +[string template]: /terraform/language/expressions/strings#string-templates When a JSON string is encountered in a location where arbitrary expressions are expected, its value is first parsed as a [string template][] diff --git a/website/docs/language/syntax/style.mdx b/website/docs/language/syntax/style.mdx index b29195dcae..418c077d9b 100644 --- a/website/docs/language/syntax/style.mdx +++ b/website/docs/language/syntax/style.mdx @@ -14,7 +14,7 @@ for consistency between files and modules written by different teams. Automatic source code formatting tools may apply these conventions automatically. --> **Note**: You can enforce these conventions automatically by running [`terraform fmt`](/cli/commands/fmt). +-> **Note**: You can enforce these conventions automatically by running [`terraform fmt`](/terraform/cli/commands/fmt). * Indent two spaces for each nesting level. diff --git a/website/docs/language/v1-compatibility-promises.mdx b/website/docs/language/v1-compatibility-promises.mdx index 8c31d001ae..95588fc191 100644 --- a/website/docs/language/v1-compatibility-promises.mdx +++ b/website/docs/language/v1-compatibility-promises.mdx @@ -66,35 +66,35 @@ The following top-level blocks and their defined "meta-arguments" (that is, arguments defined by Terraform Core rather than by external plugins such as providers) will retain their current functionality: -* [`resource`](/language/resources) and - [`data`](/language/data-sources) blocks to +* [`resource`](/terraform/language/resources) and + [`data`](/terraform/language/data-sources) blocks to declare resources, including their nested block types `lifecycle`, `connection`, and `provisioner`, and their meta-argument `provider`. -* [`module`](/language/modules/syntax) blocks to call other modules, +* [`module`](/terraform/language/modules/syntax) blocks to call other modules, and its meta-argument `providers`. -* The [`count`](/language/meta-arguments/count), - [`for_each`](/language/meta-arguments/for_each), and - [`depends_on`](/language/meta-arguments/depends_on) meta-arguments +* The [`count`](/terraform/language/meta-arguments/count), + [`for_each`](/terraform/language/meta-arguments/for_each), and + [`depends_on`](/terraform/language/meta-arguments/depends_on) meta-arguments in `resource`, `data`, and `module` blocks. -* [`provider`](/language/providers/configuration) blocks to configure +* [`provider`](/terraform/language/providers/configuration) blocks to configure providers, and the `alias` meta-argument. -* [`variable`](/language/values/variables#declaring-an-input-variable), - [`output`](/language/values/outputs#declaring-an-output-value), and - [`locals`](/language/values/locals#declaring-a-local-value) blocks +* [`variable`](/terraform/language/values/variables#declaring-an-input-variable), + [`output`](/terraform/language/values/outputs#declaring-an-output-value), and + [`locals`](/terraform/language/values/locals#declaring-a-local-value) blocks for declaring the various kinds of named values in a module. -* [`terraform`](/language/settings) blocks, including the nested - [`required_version`](/language/settings#specifying-a-required-terraform-version) +* [`terraform`](/terraform/language/settings) blocks, including the nested + [`required_version`](/terraform/language/settings#specifying-a-required-terraform-version) and - [`required_providers`](/language/providers/requirements#requiring-providers) + [`required_providers`](/terraform/language/providers/requirements#requiring-providers) arguments, and nested - [`backend`](/language/settings/backends/configuration#using-a-backend-block) + [`backend`](/terraform/language/settings/backends/configuration#using-a-backend-block) blocks for backend configuration. We also intend to keep compatibility with all -[expression operators](/language/expressions) and -[built-in functions](/language/functions), with the exception of +[expression operators](/terraform/language/expressions) and +[built-in functions](/terraform/language/functions), with the exception of references to -[`terraform.workspace`](/language/expressions/references#terraform-workspace), +[`terraform.workspace`](/terraform/language/expressions/references#terraform-workspace), whose behavior may change as part of future changes to the workspace model. We intend to retain broad compatibility with Terraform language features, with @@ -190,18 +190,18 @@ if you are still using a Terraform v1.x release. ### Provider Installation Methods Terraform normally installs providers from a provider registry implementing -[the Provider Registry Protocol](/internals/provider-registry-protocol), +[the Provider Registry Protocol](/terraform/internals/provider-registry-protocol), version 1. All Terraform v1.x releases will remain compatible with that protocol, and so correctly-implemented provider registries will stay compatible. Terraform also supports installation of providers from -[local filesystem directories](/cli/config/config-file#filesystem_mirror) +[local filesystem directories](/terraform/cli/config/config-file#filesystem_mirror) (filesystem mirrors) and from -[network mirrors](/cli/config/config-file#network_mirror) -(implementing [the Provider Mirror Protocol](/internals/provider-network-mirror-protocol). +[network mirrors](/terraform/cli/config/config-file#network_mirror) +(implementing [the Provider Mirror Protocol](/terraform/internals/provider-network-mirror-protocol). All Terraform v1.x releases will remain compatible with those installation methods, including -[the Implied Local Mirror Directories](/cli/config/config-file#implied-local-mirror-directories). +[the Implied Local Mirror Directories](/terraform/cli/config/config-file#implied-local-mirror-directories). Specific provider registries or network mirrors are run independently from Terraform itself and so their own behaviors are not subject to these @@ -237,11 +237,11 @@ and of Terraform itself. ### Module Installation Methods Terraform supports installing child modules from a number of different -[module source types](/language/modules/sources). We will continue +[module source types](/terraform/language/modules/sources). We will continue to support all of the existing source types throughout the v1.x releases. One of the supported source types is a module registry implementing -[the Module Registry Protocol](/internals/module-registry-protocol) +[the Module Registry Protocol](/terraform/internals/module-registry-protocol) version 1. All Terraform v1.x releases will remain compatible with correct implementations of that protocol. @@ -387,7 +387,7 @@ As noted above, compatibility with external software is limited to explicitly-machine-readable output (`-json` and `-raw` modes) and exit codes. Any natural-language output from these commands might change in later releases. -* [`init`](/cli/commands/init) +* [`init`](/terraform/cli/commands/init) * `-backend=false` * `-backend-config=FILE` * `-backend-config="KEY=VALUE"` @@ -399,10 +399,10 @@ Any natural-language output from these commands might change in later releases. * `-plugin-dir=DIR` * `-reconfigure` * `-upgrade` -* [`validate`](/cli/commands/validate) +* [`validate`](/terraform/cli/commands/validate) * `-json` * `-no-color` -* [`plan`](/cli/commands/plan) +* [`plan`](/terraform/cli/commands/plan) * `-compact-warnings` * `-destroy` * `-detailed-exitcode` @@ -419,7 +419,7 @@ Any natural-language output from these commands might change in later releases. * `-target=ADDRESS` * `-var 'NAME=VALUE'` * `-var-file=FILE` -* [`apply`](/cli/commands/apply) +* [`apply`](/terraform/cli/commands/apply) * `-auto-approve` * `-compact-warnings` * `-lock=false` @@ -434,53 +434,53 @@ Any natural-language output from these commands might change in later releases. * `-target=ADDRESS` * `-var 'NAME=VALUE'` * `-var-file=FILE` -* [`show`](/cli/commands/show) +* [`show`](/terraform/cli/commands/show) * `-no-color` * `-json` * (both with and without a plan file) -* [`providers`](/cli/commands/providers) (with no subcommand) -* [`providers lock`](/cli/commands/providers/lock) +* [`providers`](/terraform/cli/commands/providers) (with no subcommand) +* [`providers lock`](/terraform/cli/commands/providers/lock) * `-fs-mirror=PATH` * `-net-mirror=URL` * `-platform=OS_ARCH` -* [`providers mirror`](/cli/commands/providers/mirror) +* [`providers mirror`](/terraform/cli/commands/providers/mirror) * `-platform=OS_ARCH` -* [`providers schema`](/cli/commands/providers/schema) +* [`providers schema`](/terraform/cli/commands/providers/schema) * `-json` -* [`fmt`](/cli/commands/fmt) +* [`fmt`](/terraform/cli/commands/fmt) * `-list=false` * `-write=false` * `-diff` * `-recursive` * `-check` -* [`version`](/cli/commands/version) +* [`version`](/terraform/cli/commands/version) * `-json` -* [`output`](/cli/commands/output) +* [`output`](/terraform/cli/commands/output) * `-no-color` * `-json` * `-raw` -* [`taint`](/cli/commands/taint) +* [`taint`](/terraform/cli/commands/taint) * `-allow-missing` * `-lock=false` * `-lock-timeout=DURATION` * `-ignore-remote-version` -* [`untaint`](/cli/commands/untaint) +* [`untaint`](/terraform/cli/commands/untaint) * `-allow-missing` * `-lock=false` * `-lock-timeout=DURATION` * `-ignore-remote-version` -* [`force-unlock`](/cli/commands/force-unlock) +* [`force-unlock`](/terraform/cli/commands/force-unlock) * `-force` -* [`state list`](/cli/commands/state/list) +* [`state list`](/terraform/cli/commands/state/list) * `-id=ID` -* [`state pull`](/cli/commands/state/pull) -* [`state push`](/cli/commands/state/push) +* [`state pull`](/terraform/cli/commands/state/pull) +* [`state push`](/terraform/cli/commands/state/push) * `-force` * `-lock=false` * `-lock-timeout=DURATION` -* [`state show`](/cli/commands/state/show) +* [`state show`](/terraform/cli/commands/state/show) * `-ignore-remote-version` -* [`login`](/cli/commands/login) +* [`login`](/terraform/cli/commands/login) For commands or options not in the above list, we will still avoid breaking changes where possible, but can't promise full compatibility throughout the diff --git a/website/docs/language/values/index.mdx b/website/docs/language/values/index.mdx index d271492c31..bd207554bf 100644 --- a/website/docs/language/values/index.mdx +++ b/website/docs/language/values/index.mdx @@ -10,11 +10,11 @@ description: >- The Terraform language includes a few kinds of blocks for requesting or publishing named values. -- [Input Variables](/language/values/variables) serve as parameters for +- [Input Variables](/terraform/language/values/variables) serve as parameters for a Terraform module, so users can customize behavior without editing the source. -- [Output Values](/language/values/outputs) are like return values for a +- [Output Values](/terraform/language/values/outputs) are like return values for a Terraform module. -- [Local Values](/language/values/locals) are a convenience feature for +- [Local Values](/terraform/language/values/locals) are a convenience feature for assigning a short name to an expression. diff --git a/website/docs/language/values/locals.mdx b/website/docs/language/values/locals.mdx index 401757fb69..b6c18072e0 100644 --- a/website/docs/language/values/locals.mdx +++ b/website/docs/language/values/locals.mdx @@ -7,17 +7,17 @@ description: >- # Local Values -> **Hands-on:** Try the [Simplify Terraform Configuration with Locals](https://learn.hashicorp.com/tutorials/terraform/locals?in=terraform/configuration-language&utm_source=WEBSITE&utm_medium=WEB_IO&utm_offer=ARTICLE_PAGE&utm_content=DOCS) tutorial. +> **Hands-on:** Try the [Simplify Terraform Configuration with Locals](/terraform/tutorials/configuration-language/locals?utm_source=WEBSITE&utm_medium=WEB_IO&utm_offer=ARTICLE_PAGE&utm_content=DOCS) tutorial. -A local value assigns a name to an [expression](/language/expressions), +A local value assigns a name to an [expression](/terraform/language/expressions), so you can use the name multiple times within a module instead of repeating the expression. If you're familiar with traditional programming languages, it can be useful to compare Terraform modules to function definitions: -- [Input variables](/language/values/variables) are like function arguments. -- [Output values](/language/values/outputs) are like function return values. +- [Input variables](/terraform/language/values/variables) are like function arguments. +- [Output values](/terraform/language/values/outputs) are like function return values. - Local values are like a function's temporary local variables. -> **Note:** For brevity, local values are often referred to as just "locals" @@ -57,7 +57,7 @@ locals { ## Using Local Values Once a local value is declared, you can reference it in -[expressions](/language/expressions) as `local.`. +[expressions](/terraform/language/expressions) as `local.`. -> **Note:** Local values are _created_ by a `locals` block (plural), but you _reference_ them as attributes on an object named `local` (singular). Make sure diff --git a/website/docs/language/values/outputs.mdx b/website/docs/language/values/outputs.mdx index 708157f058..650eedb7d8 100644 --- a/website/docs/language/values/outputs.mdx +++ b/website/docs/language/values/outputs.mdx @@ -10,7 +10,7 @@ command line, and can expose information for other Terraform configurations to use. Output values are similar to return values in programming languages. > **Hands-on:** Try the [Output Data From -> Terraform](https://learn.hashicorp.com/tutorials/terraform/outputs) +> Terraform](/terraform/tutorials/configuration-language/outputs) > tutorial. Output values have several uses: @@ -19,9 +19,9 @@ Output values have several uses: to a parent module. - A root module can use outputs to print certain values in the CLI output after running `terraform apply`. -- When using [remote state](/language/state/remote), root module outputs can be +- When using [remote state](/terraform/language/state/remote), root module outputs can be accessed by other configurations via a - [`terraform_remote_state` data source](/language/state/remote-state-data). + [`terraform_remote_state` data source](/terraform/language/state/remote-state-data). Resource instances managed by Terraform each export attributes whose values can be used elsewhere in configuration. Output values are a way to expose some @@ -42,11 +42,11 @@ output "instance_ip_addr" { ``` The label immediately after the `output` keyword is the name, which must be a -valid [identifier](/language/syntax/configuration#identifiers). In a root module, this name is +valid [identifier](/terraform/language/syntax/configuration#identifiers). In a root module, this name is displayed to the user; in a child module, it can be used to access the output's value. -The `value` argument takes an [expression](/language/expressions) +The `value` argument takes an [expression](/terraform/language/expressions) whose result is to be returned to the user. In this example, the expression refers to the `private_ip` attribute exposed by an `aws_instance` resource defined elsewhere in this module (not shown). Any valid expression is allowed @@ -81,7 +81,7 @@ output "api_base_url" { 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. ## Optional Arguments @@ -174,10 +174,10 @@ value in the list of outputs at the end of `terraform apply`. However, the value could still display in the CLI output for other reasons, like if the value is referenced in an expression for a resource argument. -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). @@ -193,7 +193,7 @@ correctly determine the dependencies between resources defined in different modules. Just as with -[resource dependencies](/language/resources/behavior#resource-dependencies), +[resource dependencies](/terraform/language/resources/behavior#resource-dependencies), Terraform analyzes the `value` expression for an output value and automatically determines a set of dependencies, but in less-common cases there are dependencies that cannot be recognized implicitly. In these rare cases, the diff --git a/website/docs/language/values/variables.mdx b/website/docs/language/values/variables.mdx index 9ec218a729..3bc66dbb73 100644 --- a/website/docs/language/values/variables.mdx +++ b/website/docs/language/values/variables.mdx @@ -7,7 +7,7 @@ description: >- # Input Variables -> **Hands-on:** Try the [Customize Terraform Configuration with Variables](https://learn.hashicorp.com/tutorials/terraform/variables?in=terraform/configuration-language&utm_source=WEBSITE&utm_medium=WEB_IO&utm_offer=ARTICLE_PAGE&utm_content=DOCS) tutorial. +> **Hands-on:** Try the [Customize Terraform Configuration with Variables](/terraform/tutorials/configuration-language/variables?utm_source=WEBSITE&utm_medium=WEB_IO&utm_offer=ARTICLE_PAGE&utm_content=DOCS) tutorial. Input variables let you customize aspects of Terraform modules without altering the module's own source code. This functionality allows you to share modules across different @@ -15,22 +15,22 @@ Terraform configurations, making your module composable and reusable. When you declare variables in the root module of your configuration, you can set their values using CLI options and environment variables. -When you declare them in [child modules](/language/modules), +When you declare them in [child modules](/terraform/language/modules), the calling module should pass values in the `module` block. If you're familiar with traditional programming languages, it can be useful to compare Terraform modules to function definitions: * Input variables are like function arguments. -* [Output values](/language/values/outputs) are like function return values. -* [Local values](/language/values/locals) are like a function's temporary local variables. +* [Output values](/terraform/language/values/outputs) are like function return values. +* [Local values](/terraform/language/values/locals) are like a function's temporary local variables. -> **Note:** For brevity, input variables are often referred to as just "variables" or "Terraform variables" when it is clear from context what sort of variable is being discussed. Other kinds of variables in Terraform include _environment variables_ (set by the shell where Terraform runs) and _expression variables_ (used to indirectly represent a value in an -[expression](/language/expressions)). +[expression](/terraform/language/expressions)). ## Declaring an Input Variable @@ -68,11 +68,11 @@ be unique among all variables in the same module. This name is used to assign a value to the variable from outside and to reference the variable's value from within the module. -The name of a variable can be any valid [identifier](/language/syntax/configuration#identifiers) +The name of a variable can be any valid [identifier](/terraform/language/syntax/configuration#identifiers) _except_ the following: `source`, `version`, `providers`, `count`, `for_each`, `lifecycle`, `depends_on`, `locals`. These names are reserved for meta-arguments in -[module configuration blocks](/language/modules/syntax), and cannot be +[module configuration blocks](/terraform/language/modules/syntax), and cannot be declared as variable names. ## Arguments @@ -101,7 +101,7 @@ configuration. [inpage-type]: #type-constraints The `type` argument in a `variable` block allows you to restrict the -[type of value](/language/expressions/types) that will be accepted as +[type of value](/terraform/language/expressions/types) that will be accepted as the value for a variable. If no type constraint is set then a value of any type is accepted. @@ -128,7 +128,7 @@ collections: The keyword `any` may be used to indicate that any type is acceptable. For more information on the meaning and behavior of these different types, as well as detailed information about automatic conversion of complex types, see -[Type Constraints](/language/expressions/types). +[Type Constraints](/terraform/language/expressions/types). If both the `type` and `default` arguments are specified, the given default value must be convertible to the specified type. @@ -173,7 +173,7 @@ variable "image_id" { } } ``` -Refer to [Custom Condition Checks](/language/expressions/custom-conditions#input-variable-validation) for more details. +Refer to [Custom Condition Checks](/terraform/language/expressions/custom-conditions#input-variable-validation) for more details. ### Suppressing Values in CLI Output @@ -181,16 +181,16 @@ Refer to [Custom Condition Checks](/language/expressions/custom-conditions#input -> This feature was introduced in Terraform v0.14.0. -> **Hands-on:** Try the [Protect Sensitive Input Variables](https://learn.hashicorp.com/tutorials/terraform/sensitive-variables?in=terraform/configuration-language&utm_source=WEBSITE&utm_medium=WEB_IO&utm_offer=ARTICLE_PAGE&utm_content=DOCS) tutorial. +> **Hands-on:** Try the [Protect Sensitive Input Variables](/terraform/tutorials/configuration-language/sensitive-variables?utm_source=WEBSITE&utm_medium=WEB_IO&utm_offer=ARTICLE_PAGE&utm_content=DOCS) tutorial. Setting a variable as `sensitive` prevents Terraform from showing its value in the `plan` or `apply` output, when you use that variable elsewhere in your configuration. -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). Declare a variable as sensitive by setting the `sensitive` argument to `true`: @@ -241,13 +241,13 @@ disclosing the content of one block might imply the content of a sibling block. ``` A provider can also -[declare an attribute as sensitive](/plugin/sdkv2/best-practices/sensitive-state#using-the-sensitive-flag), +[declare an attribute as sensitive](/terraform/plugin/sdkv2/best-practices/sensitive-state#using-the-sensitive-flag), which will cause Terraform to hide it from regular output regardless of how you assign it a value. For more information, see -[Sensitive Resource Attributes](/language/expressions/references#sensitive-resource-attributes). +[Sensitive Resource Attributes](/terraform/language/expressions/references#sensitive-resource-attributes). If you use a sensitive value 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. @@ -307,7 +307,7 @@ the collection or structure itself is not null. ## Using Input Variable Values Within the module that declared a variable, its value can be accessed from -within [expressions](/language/expressions) as `var.`, +within [expressions](/terraform/language/expressions) as `var.`, where `` matches the label given in the declaration block: -> **Note:** Input variables are _created_ by a `variable` block, but you @@ -328,7 +328,7 @@ the module where it was declared. When variables are declared in the root module of your configuration, they can be set in a number of ways: -* [In a Terraform Cloud workspace](/cloud-docs/workspaces/variables). +* [In a Terraform Cloud workspace](/terraform/cloud-docs/workspaces/variables). * Individually, with the `-var` command line option. * In variable definitions (`.tfvars`) files, either specified on the command line or automatically loaded. @@ -337,7 +337,7 @@ can be set in a number of ways: The following sections describe these options in more detail. This section does not apply to _child_ modules, where values for input variables are instead assigned in the configuration of their parent module, as described in -[_Modules_](/language/modules). +[_Modules_](/terraform/language/modules). ### Variables on the Command Line @@ -353,7 +353,7 @@ terraform apply -var='image_id_map={"us-east-1":"ami-abc123","us-east-2":"ami-de The above examples show appropriate syntax for Unix-style shells, such as on Linux or macOS. For more information on shell quoting, including additional examples for Windows Command Prompt, see -[Input Variables on the Command Line](/cli/commands/plan#input-variables-on-the-command-line). +[Input Variables on the Command Line](/terraform/cli/commands/plan#input-variables-on-the-command-line). You can use the `-var` option multiple times in a single command to set several different variables. @@ -372,7 +372,7 @@ terraform apply -var-file="testing.tfvars" ``` -> **Note:** This is how Terraform Cloud passes -[workspace variables](/cloud-docs/workspaces/variables) to Terraform. +[workspace variables](/terraform/cloud-docs/workspaces/variables) to Terraform. A variable definitions file uses the same basic syntax as Terraform language files, but consists only of variable name assignments: @@ -426,7 +426,7 @@ and lower case letters as in the above example. When variable values are provided in a variable definitions file, you can use Terraform's usual syntax for -[literal expressions](/language/expressions/types#literal-expressions) +[literal expressions](/terraform/language/expressions/types#literal-expressions) to assign complex-typed values, like lists and maps. Some special rules apply to the `-var` command line option and to environment @@ -452,7 +452,7 @@ For readability, and to avoid the need to worry about shell escaping, we recommend always setting complex variable values via variable definitions files. For more information on quoting and escaping for `-var` arguments, see -[Input Variables on the Command Line](/cli/commands/plan#input-variables-on-the-command-line). +[Input Variables on the Command Line](/terraform/cli/commands/plan#input-variables-on-the-command-line). ### Values for Undeclared Variables @@ -485,7 +485,7 @@ Will cause Terraform to warn you that there is no variable declared `"mosse"`, w you spot this mistake. If you use `.tfvars` files across multiple configurations and expect to continue to see this warning, -you can use the [`-compact-warnings`](/cli/commands/plan#compact-warnings) +you can use the [`-compact-warnings`](/terraform/cli/commands/plan#compact-warnings) option to simplify your output. If you provide values for undeclared variables on the [command line](#variables-on-the-command-line), From c850399c0d5b554d70c6c0f8dea19deb7b4be335 Mon Sep 17 00:00:00 2001 From: Ashlee Boyer Date: Thu, 23 Feb 2023 12:57:23 -0500 Subject: [PATCH 6/6] Updating main-branch-preview-url --- .github/workflows/test-link-rewrites.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test-link-rewrites.yml b/.github/workflows/test-link-rewrites.yml index 349b60fbaa..ffa60f6b57 100644 --- a/.github/workflows/test-link-rewrites.yml +++ b/.github/workflows/test-link-rewrites.yml @@ -10,7 +10,7 @@ jobs: repo-owner: "hashicorp" repo-name: "terraform" commit-sha: ${{ github.sha }} - main-branch-preview-url: "https://terraform-lw0m5e91w-hashicorp.vercel.app/" + main-branch-preview-url: "https://terraform-i0v2w2p2g-hashicorp.vercel.app/" # Workflow is only intended to run for one single migration PR # This variable does not need to be updated pr-branch-preview-url: ${{ github.event.deployment_status.target_url }}