another batch of updates

pull/36083/head
trujillo-adam 1 year ago
parent 2608a993ce
commit 89e96fa226

@ -77,7 +77,7 @@
]
},
{
"title": "Manipulating State",
"title": "Manually Update State",
"routes": [
{ "title": "Overview", "path": "state" },
{
@ -266,7 +266,6 @@
{ "title": "<code>apply</code>", "href": "/cli/commands/apply" },
{ "title": "<code>console</code>", "href": "/cli/commands/console" },
{ "title": "<code>destroy</code>", "href": "/cli/commands/destroy" },
{ "title": "<code>env</code>", "href": "/cli/commands/env" },
{ "title": "<code>fmt</code>", "href": "/cli/commands/fmt" },
{
"title": "<code>force-unlock</code>",
@ -367,7 +366,6 @@
{ "title": "apply", "path": "commands/apply" },
{ "title": "console", "path": "commands/console" },
{ "title": "destroy", "path": "commands/destroy" },
{ "title": "env", "path": "commands/env" },
{ "title": "fmt", "path": "commands/fmt" },
{ "title": "force-unlock", "path": "commands/force-unlock" },
{ "title": "get", "path": "commands/get" },

@ -1,10 +1,10 @@
---
page_title: Using HCP Terraform - Terraform CLI
page_title: Use HCP Terraform and Terraform Enterprise with Terraform CLI overview
description: >-
Learn how to use HCP Terraform and Terraform Enterprise on the command line with the Terraform CLI.
---
# Using HCP Terraform with Terraform CLI
# Use HCP Terraform with Terraform CLI Overview
The Terraform CLI integration with HCP Terraform lets you use HCP Terraform and Terraform Enterprise on the command line. In the documentation HCP Terraform instructions also apply to Terraform Enterprise, except where explicitly stated.

@ -1,11 +1,15 @@
---
page_title: 'Command: apply'
page_title: terraform apply command reference
description: >-
The terraform apply command executes the actions proposed in a Terraform plan
to create, update, or destroy infrastructure.
---
# Command: apply
# `terraform apply` command
This topic provides reference information about the `terraform apply` command.
## Introduction
The `terraform apply` command executes the actions proposed in a Terraform
plan.
@ -16,8 +20,6 @@ plan.
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`](/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

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

@ -1,18 +1,17 @@
---
page_title: 'Command: force-unlock'
page_title: terraform force-unlock command reference
description: >-
The terraform force-unlock command unlocks the state for a configuration. It
does not modify your infrastructure.
---
# Command: force-unlock
# `terraform force-unlock` command
Manually unlock the state for the defined configuration.
This topic provides reference information about the `terraform force-unlock` command. This command manually unlocks the state for the defined configuration.
This will not modify your infrastructure. This command removes the lock on the
state for the current configuration. The behavior of this lock is dependent
This command removes the lock on the state for the current configuration. The behavior of this lock is dependent
on the backend being used. Local state files cannot be unlocked by another
process.
process. The `terraform force-unlock` command does not modify your infrastructure.
## Usage
@ -27,4 +26,4 @@ process.
Options:
* `-force` - Don't ask for input for unlock confirmation.
- `-force` - Don't ask for input for unlock confirmation.

@ -1,12 +1,12 @@
---
page_title: 'Command: get'
page_title: terraform get command reference
description: The terraform get command downloads and updates modules.
---
# Command: get
# `terraform get` command
The `terraform get` command is used to download and update
[modules](/terraform/language/modules/develop) mentioned in the root module.
Run the `terraform get` command to download and update
[modules](/terraform/language/modules/develop) declared in the root module.
## Usage

@ -1,12 +1,17 @@
---
page_title: Basic CLI Features
description: An introduction to the terraform command and its available subcommands.
page_title: Terraform CLI overview
description: The Terrafrom CLI includes commands for provisioning infrastructure as code and managing the infrastructure lifecycle. Learn about Terraform CLI features.
---
# Basic CLI Features
# Terraform CLI Overview
This topic provides an overview of the Terraform command line.
> **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.
## Introduction
The command line interface to Terraform is the `terraform` command, which
accepts a variety of subcommands such as `terraform init` or `terraform plan`.

@ -1,14 +1,18 @@
---
page_title: 'Command: logout'
page_title: terraform logout command reference
description: >-
The terraform logout command is used to remove credentials stored by terraform
login.
The terraform logout command removes credentials stored after using the terraform
login command.
---
# Command: logout
# `terraform logout` command
The `terraform logout` command is used to remove credentials stored by
`terraform login`. These credentials are API tokens for HCP Terraform,
This topic provides reference information about the `terraform logout` command.
## Introduction
Use the `terraform logout` command to remove credentials stored after running the
`terraform login` command. These credentials are API tokens for HCP Terraform,
Terraform Enterprise, or any other host that offers Terraform services.
## Usage

@ -1,15 +1,18 @@
---
page_title: 'Command: providers lock'
page_title: terraform providers lock command reference
description: |-
The `terraform providers lock` command adds new provider selection information
to the dependency lock file without initializing the referenced providers.
---
# Command: terraform providers lock
# `terraform providers lock` command
The `terraform providers lock` consults upstream registries (by default) in
order to write provider dependency information into
[the dependency lock file](/terraform/language/files/dependency-lock).
The `terraform providers lock` adds new provider selection information to the dependency lock file without initializing the referenced providers.
## Introduction
When you run the command, Terraform consults upstream registries and writes provider dependency information into the
the dependency lock file. Refer to [Dependency Lock File](/terraform/language/files/dependency-lock) in the Terraform configuration language reference documentation for additional information about the lock file.
The common way to update the dependency lock file is as a side-effect of normal
provider installation during
@ -37,8 +40,6 @@ automatic approach may not be sufficient:
You can avoid that by pre-populating hashes for all of the platforms you
intend to use, using the `terraform providers lock` command.
-> `terraform providers lock` is available only in Terraform v0.14 or later.
## Usage
Usage: `terraform providers lock [options] [providers...]`

@ -1,40 +1,30 @@
---
page_title: 'Command: providers schema'
page_title: terraform providers schema command
description: >-
The `terraform providers schema` command prints detailed schemas for the
providers used
in the current configuration.
The `terraform providers schema` command prints detailed schemas for the providers declared in the configuration.
---
# Command: terraform providers schema
The `terraform providers schema` command is used to print detailed schemas for the providers used in the current configuration.
# `terraform providers schema` command
-> `terraform providers schema` requires **Terraform v0.12 or later**.
The `terraform providers schema` command print detailed schemas for the providers used in the current configuration.
## Usage
Usage: `terraform providers schema [options]`
```
$ terraform providers schema [options]
```
The following flags are available:
- `-json` - Displays the schemas in a machine-readable, JSON format.
Please note that, at this time, the `-json` flag is a _required_ option. In future releases, this command will be extended to allow for additional options.
- `-json` - Displays the schemas in a machine-readable JSON format. The `-json` flag is required.
The output includes a `format_version` key, which as of Terraform 1.1.0 has
value `"1.0"`. The semantics of this version are:
The output includes a `format_version` key, which has a default value of `"1.0"`. The semantics of this version are:
- We will increment the minor version, e.g. `"1.1"`, for backward-compatible
changes or additions. Ignore any object properties with unrecognized names to
- Versions between `1.0` and `2.0` are backward-compatible. You should ignore any object properties with unrecognized names to
remain forward-compatible with future minor versions.
- We will increment the major version, e.g. `"2.0"`, for changes that are not
backward-compatible. Reject any input which reports an unsupported major
- Major versions are not backward-compatible to older versions. You should reject any input that reports an unsupported major
version.
We will introduce new major versions only within the bounds of
[the Terraform 1.0 Compatibility Promises](/terraform/language/v1-compatibility-promises).
- Refer to [Terraform 1.0 Compatibility Promises](/terraform/language/v1-compatibility-promises) for additional information about version support.
## Format Summary

@ -1,21 +1,15 @@
---
page_title: 'Command: show'
description: >-
The `terraform show` command is used to provide human-readable output from a
state or plan file. This can be used to inspect a plan to ensure that the
planned operations are expected, or to inspect the current state as Terraform
sees it.
page_title: terraform show command reference
description: The `terraform show` command provides human-readable output from a state or plan file.
---
# Command: show
# `terraform show` command
The `terraform show` command is used to provide human-readable output
from a state or plan file. This can be used to inspect a plan to ensure
The `terraform show` command provides human-readable output
from a state or plan file. Use the command to inspect a plan to ensure
that the planned operations are expected, or to inspect the current state
as Terraform sees it.
Machine-readable output is generated by adding the `-json` command-line
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
@ -23,14 +17,16 @@ Terraform state will be displayed in plain text. For more information, see
## JSON Output
For Terraform state files (including when no path is provided),
`terraform show -json` will show a JSON representation of the state.
Add the `-json` command-line flag to generate machine-readable output.
For Terraform plan files, `terraform show -json` will show a JSON representation
For Terraform state files, including when no path is provided,
`terraform show -json` shows a JSON representation of the state.
For Terraform plan files, `terraform show -json` shows a JSON representation
of the plan, configuration, and current state.
If you've updated providers which contain new schema versions since the state
was written, the state needs to be upgraded before it can be displayed with
If you updated providers that contain new schema versions since the state
was written, upgrade the state before so that Terraform can display it with
`show -json`. If you are viewing a plan, it must be created without
`-refresh=false`. If you are viewing a state file, run `terraform refresh`
first.

@ -1,14 +1,16 @@
---
page_title: 'Command: untaint'
page_title: terraform untaint command reference
description: |-
The `terraform untaint` command tells Terraform that an object is functioning
correctly, even though its creation failed or it was previously manually
marked as degraded.
The `terraform untaint` command removes the `tainted` status from infrastructure objects tracked in the Terraform state data.
---
# Command: untaint
# `terraform untaint` command
Terraform has a marker called "tainted" which it uses to track that an object
This topic provides reference information about the `terraform untaint` command.
## Introduction
Terraform has a marker called `tainted` which it uses to track that an object
might be damaged and so a future Terraform plan ought to replace it.
Terraform automatically marks an object as "tainted" if an error occurs during

@ -1,34 +1,32 @@
---
page_title: Manipulating State - Terraform CLI
page_title: Update Terraform state manually
description: >-
State data tracks which real-world object corresponds to each resource.
Inspect state, move or import resources, and more.
State data is the record of how real-world objects map to resources in the Terraform configuration. Learn how to manually update with state data.
---
# Manipulating Terraform State
# Update Terraform state manually overview
This topic provides overview information about how to manually update state in Terraform.
> **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](/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.
Terraform updates state automatically during plans and applies. However, it's
sometimes necessary to make deliberate adjustments to Terraform's state data,
usually to compensate for changes to the configuration or the real managed
infrastructure.
Terraform CLI supports several workflows for interacting with state:
- [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](/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
your colleagues, or even compromise the security of your operations. Make sure
to keep backups of your state data when modifying state out-of-band.
## Introduction
Terraform stores information about real-world object that correspond to resources in the configuration as [state data](/terraform/language/state).
Doing so allows Terraform to modify an existing object when its resource declaration changes.
Terraform automatically updates state when you run the `terraform plan` and `terraform apply` commands, but you may need to manually adjustment state data as a result of changes to the configuration or the real managed infrastructure.
## Workflow
Modifying state data outside of normal `terraform plan` or `terraform apply` operations can cause Terraform to lose track of managed resources, leading to increased costs, reduced productivity, or compromised security. Make sure to keep backups of your state data if you choose to manually modify state.
You can use the Terraform CLI to perform the following state interations:
- [Inspect state](/terraform/cli/state/inspect)
- [Re-create resources](/terraform/cli/state/taint)
- [Move resources](/terraform/cli/state/move)
- [Import existing resources](/terraform/cli/import)
- [Recover state from backup](/terraform/cli/state/recover)

@ -1,9 +1,9 @@
---
page_title: Inspecting State - Terraform CLI
description: Commands that allow you to read and update state.
page_title: Inspect Terraform state overview
description: The `terraform state` group of commands help you inspect Terraform state. Learn how inspecting Terraform state can help you read and update state.
---
# Inspecting State
# Inspect Terraform State Overview
Terraform includes some commands for reading and updating state without taking
any other actions.

@ -1,11 +1,10 @@
---
page_title: Moving Resources - Terraform CLI
page_title: Move resources overview
description: >-
Commands that allow you to manage the way that resources are tracked in state.
They are helpful when you move or change resources.
Terraform state commands can move and remove resources and transfer existing resources to a different provider. Learn how about changing or moving resources.
---
# Moving Resources
# Move Resources
Terraform's state associates each real-world object with a configured resource
at a specific [resource address](/terraform/cli/state/resource-addressing). This

@ -1,25 +1,19 @@
---
page_title: Recovering from State Disasters - Terraform CLI
page_title: Recover state from backup overview
description: >-
Learn how to restore state backups and override Terraform state protections to fix state errors with the Terraform CLI.
---
# Recovering from State Disasters
# Recover state from backup overview
This topic provides overview information about recovering Terraform state from a backup after a disaster, such as an accident when performing
other state manipulation actions.
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.
## Workflow
- [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
destruction of the VM it's running in) before it can release its lock on the
state backend. Do not run this until you are completely certain what happened
to the process that caused the lock to get stuck.
1. **Unlock Terraform**: You may need to unlock Terraform when a `terraform apply` or other process unexpectedly terminates before Terraform can release its lock on the state backend. Unlocking Terraform overrides protectionsthat prevent two processes from modifying state at the same time. We do not recommend unlocking until you determine what caused the lock to get stuck.
- [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.
Refer to the [`terraform force-unlock` command](/terraform/cli/commands/force-unlock) documentation for additional information.
1. **Read state data**: Run the [`terraform state pull` command](/terraform/cli/commands/state/pull) to read the state files from the configured backend.
1. **Write state data**: Run the [`terraform state push` command](/terraform/cli/commands/state/push) to write state files to the configured backend.

@ -1,11 +1,13 @@
---
page_title: 'Internals: Resource Address'
description: |-
A resource address is a string that identifies zero or more resource
instances in your overall configuration.
page_title: Resource address reference
description: Use the resource address to reference specific instances of resources elsewhere in the configuration. Learn how Terraform creates addresses for resources.
---
# Resource Addressing
# Resource Address Reference
This topic provides reference information about resource addresses in Terraform.
## Syntax
A _resource address_ is a string that identifies zero or more resource
instances in your overall configuration.

@ -1,25 +1,35 @@
---
page_title: Forcing Re-creation of Resources - Terraform CLI
description: Commands that allow you to destroy and re-create resources manually.
page_title: Recreate resources overview
description: The -replace flag and taint command help you replace infrastructure objects. Learn how the -replace flag and taint command can help you recreate resources.
---
# Forcing Re-creation of Resources
# Recreate resources overview
During planning, by default Terraform retrieves the latest state of each
existing object and compares it with the current configuration, planning
actions only against objects whose current state does not match the
configuration.
This topic provides an overview of how to recreate resources in Terraform.
However, in some cases a remote object may become damaged or degraded in a
way that Terraform cannot automatically detect. For example, if software
running inside a virtual machine crashes but the virtual machine itself is
still running then Terraform will typically have no way to detect and respond
to the problem, because Terraform only directly manages the machine as a whole.
## Introduction
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](/terraform/cli/commands/plan#replace-address)
when you run either `terraform plan` or `terraform apply`:
By default, Terraform retrieves the latest state of each existing object and compares it with the current configuration when you run the `terraform apply` command. Terraform only takes action on objects that do not match the configuration.
When remote objects become damaged or degraded, such as when software
running inside a virtual machine crashes but the virtual machine is
still running, Terraform does not have no way to detect and respond
to the problem. This is because Terraform only directly manages the machine as a whole.
In some cases, Terraform can automatically infer that an object is in an
incomplete or degraded state. For example, when a complex object is partially created in the remote system or
when a provisioner step failed. When this occurs, Terraform automatically flags resources to recreate.
You can manually replace objects when Terraform is unable to infer that an object should be replaced.
## Workflows
When you meed to replace an object, you can use the following methods.
### Manually replace resources
Add the [`-replace` flag](/terraform/cli/commands/plan#replace-address)
to your `terraform plan` or `terraform apply` command:
```shellsession
$ terraform apply -replace="aws_instance.example"
@ -31,18 +41,9 @@ $ terraform apply -replace="aws_instance.example"
}
```
## The "tainted" status
Sometimes Terraform is able to infer automatically that an object is in an
incomplete or degraded state. For example, if creation of a complex object
fails in such a way that parts of it already exist in the remote system, or
if object creation succeeded but a provisioner step subsequently failed,
Terraform must remember that the object exists but may not be fully-functional.
### Replace resource in `tainted` state
Terraform represents this situation by marking an object in the state as
"tainted". When an object is marked with this status, the next plan will force
replacing that object in a similar way to if you had specified that object's
address using `-replace=...` as described above.
Terraform applies the `tainted` status to objects in the state data when Terraform is able to infer that the object is in a degraded or damaged state. This status indicates that the object exists but may not be fully-functional. Terraform replaces objects in a `tainted` states during the next `plan` or `apply` operation.
```
# aws_instance.example is tainted, so must be replaced
@ -57,7 +58,7 @@ determination using [the `terraform untaint` command](/terraform/cli/commands/un
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
You can force Terraform to mark a particular object as tainted using
[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.

@ -1,11 +1,10 @@
---
page_title: Managing Workspaces - Terraform CLI
page_title: Manage workspaces overview
description: >-
Commands to list, select, create, and output workspaces. Workspaces help
manage different groups of resources with one configuration.
Workspaces are separate instances of Terraform state data. Learn commands for managing workspaces.
---
# Managing Workspaces
# Manage Workspaces Overview
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 HCP Terraform](/terraform/cloud-docs/workspaces), which each have their own Terraform configuration and function as separate working directories.

Loading…
Cancel
Save