Skip to content

Commit

Permalink
Merge pull request #32624 from hashicorp/docs/amb.migrate-link-formats
Browse files Browse the repository at this point in the history
docs: Migrate link formats
  • Loading branch information
ashleemboyer authored Feb 24, 2023
2 parents 6fff41b + c850399 commit 984d8c1
Show file tree
Hide file tree
Showing 245 changed files with 1,159 additions and 1,126 deletions.
17 changes: 17 additions & 0 deletions .github/workflows/check-legacy-links-format.yml
Original file line number Diff line number Diff line change
@@ -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"
16 changes: 16 additions & 0 deletions .github/workflows/test-link-rewrites.yml
Original file line number Diff line number Diff line change
@@ -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-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 }}
10 changes: 5 additions & 5 deletions website/docs/cli/auth/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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)
16 changes: 8 additions & 8 deletions website/docs/cli/cloud/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -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.
10 changes: 5 additions & 5 deletions website/docs/cli/cloud/migrating.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand All @@ -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.

Expand All @@ -31,13 +31,13 @@ Because of this, Terraform will prompt you to rename the working directory's wor
according to a pattern relative to their existing names. This can indicate the fact that these specific workspaces share configuration. A typical strategy is
`<COMPONENT>-<ENVIRONMENT>-<REGION>` (e.g., `networking-prod-us-east`,
`networking-staging-us-east`). Refer to [Workspace
Naming](/cloud-docs/workspaces/naming) in the Terraform Cloud documentation for more detail.
Naming](/terraform/cloud-docs/workspaces/naming) in the Terraform Cloud documentation for more detail.

## Migrating from the `remote` Backend

If the working directory was already connected to Terraform Cloud with the `remote` backend, Terraform can continue using the same Terraform Cloud workspaces. The local names shown for those workspaces will change to match their remote names.

The [`remote` backend](/language/settings/backends/remote) was the primary implementation of Terraform Cloud's [CLI-driven run workflow](/cloud-docs/run/cli) for Terraform versions 0.11.13 through 1.0.x. We recommend using the native `cloud` integration for Terraform versions 1.1 or later, as it provides an improved user experience and various enhancements.
The [`remote` backend](/terraform/language/settings/backends/remote) was the primary implementation of Terraform Cloud's [CLI-driven run workflow](/terraform/cloud-docs/run/cli) for Terraform versions 0.11.13 through 1.0.x. We recommend using the native `cloud` integration for Terraform versions 1.1 or later, as it provides an improved user experience and various enhancements.

### Block Replacement

Expand Down
20 changes: 10 additions & 10 deletions website/docs/cli/cloud/settings.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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).
Expand All @@ -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`.

Expand All @@ -80,29 +80,29 @@ 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

-> **Note:** CLI integration environment variables are supported in Terraform v1.2.0 and later.

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:

- `TF_CLOUD_ORGANIZATION` - The name of the organization. Terraform reads this variable when `organization` omitted from the `cloud` block`. If both are specified, the configuration takes precedence.

- `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
Expand Down
16 changes: 8 additions & 8 deletions website/docs/cli/code/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -7,38 +7,38 @@ 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.

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
performing any other work, so `validate` isn't a crucial part of the core
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.
Loading

0 comments on commit 984d8c1

Please sign in to comment.