Merge pull request #14022 from hashicorp/skierkowski/tfe-state-docs-0-9-update
Updating TFE state documentation for 0.9.X
This commit is contained in:
commit
5c4d85d7dc
|
@ -8,7 +8,7 @@ description: |-
|
||||||
|
|
||||||
# Collaborating on Terraform Remote State
|
# Collaborating on Terraform Remote State
|
||||||
|
|
||||||
Terraform Enterprise is one of a few options to store [remote state](/docs/enterprise/state).
|
Terraform Enterprise is one of a few options to store [remote state](/docs/state/remote.html).
|
||||||
|
|
||||||
Remote state gives you the ability to version and collaborate on Terraform
|
Remote state gives you the ability to version and collaborate on Terraform
|
||||||
changes. It stores information about the changes Terraform makes based on
|
changes. It stores information about the changes Terraform makes based on
|
||||||
|
@ -18,6 +18,5 @@ In order to collaborate safely on remote state, we recommend
|
||||||
[creating an organization](/docs/enterprise/organizations/create.html) to
|
[creating an organization](/docs/enterprise/organizations/create.html) to
|
||||||
manage teams of users.
|
manage teams of users.
|
||||||
|
|
||||||
Then, following a [remote state push](/docs/enterprise/state) you can view state
|
Then, following a [Terraform Enterprise Run](/docs/enterprise/runs) or [`apply`](/docs/commands/apply.html)
|
||||||
versions in the changes tab of the environment created under the same name as
|
you can view state versions in the `States` list of the environment.
|
||||||
the remote state.
|
|
||||||
|
|
|
@ -8,17 +8,17 @@ description: |-
|
||||||
|
|
||||||
# State
|
# State
|
||||||
|
|
||||||
Terraform stores the state of your managed infrastructure from the last time
|
Terraform Enterprise stores the state of your managed infrastructure from the
|
||||||
Terraform was run. By default this state is stored in a local file named
|
last time Terraform was run. The state is stored remotely, which works better in a
|
||||||
`terraform.tfstate`, but it can also be stored remotely, which works better in a
|
team environment, allowing you to store, version and collaborate on state.
|
||||||
team environment.
|
|
||||||
|
|
||||||
Terraform Enterprise is a remote state provider, allowing you to store, version
|
|
||||||
and collaborate on states.
|
|
||||||
|
|
||||||
Remote state gives you more than just easier version control and safer storage.
|
Remote state gives you more than just easier version control and safer storage.
|
||||||
It also allows you to delegate the outputs to other teams. This allows your
|
It also allows you to delegate the outputs to other teams. This allows your
|
||||||
infrastructure to be more easily broken down into components that multiple teams
|
infrastructure to be more easily broken down into components that multiple teams
|
||||||
can access.
|
can access.
|
||||||
|
|
||||||
Read [more about remote state](https://www.terraform.io/docs/state/remote.html).
|
Remote state is automatically updated when you run [`apply`](/docs/commands/apply.html)
|
||||||
|
locally. It is also updated when an `apply` is executed in a [Terraform Enterprise
|
||||||
|
Run](/docs/enterprise/runs/index.html).
|
||||||
|
|
||||||
|
Read [more about remote state](/docs/state/remote.html).
|
||||||
|
|
|
@ -17,6 +17,8 @@ configuration.
|
||||||
To use Terraform Enterprise to store remote state, you'll first need to have the
|
To use Terraform Enterprise to store remote state, you'll first need to have the
|
||||||
`ATLAS_TOKEN` environment variable set and run the following command.
|
`ATLAS_TOKEN` environment variable set and run the following command.
|
||||||
|
|
||||||
|
**NOTE:** `terraform remote config` command has been deprecated in 0.9.X. Remote configuration is now managed as a [backend configuration](/docs/backends/config.html).
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
$ terraform remote config \
|
$ terraform remote config \
|
||||||
-backend-config="name=$USERNAME/product"
|
-backend-config="name=$USERNAME/product"
|
||||||
|
|
|
@ -35,36 +35,22 @@ operation.
|
||||||
|
|
||||||
### Using Terraform Locally
|
### Using Terraform Locally
|
||||||
|
|
||||||
Another way to resolve remote state conflicts is to merge and conflicted copies
|
Another way to resolve remote state conflicts is by manual intervention of the
|
||||||
locally by inspecting the raw state available in the path
|
state file.
|
||||||
`.terraform/terraform.tfstate`.
|
|
||||||
|
|
||||||
When making state changes, it's important to make backup copies in order to
|
Use the [`state pull`](/docs/commands/state/pull.html) subcommand to pull the
|
||||||
avoid losing any data.
|
remote state into a local state file.
|
||||||
|
|
||||||
Any state that is pushed with a serial that is lower than the known serial when
|
```shell
|
||||||
the MD5 of the state does not match will be rejected.
|
$ terraform state pull > example.tfstate
|
||||||
|
|
||||||
The serial is embedded in the state file:
|
|
||||||
|
|
||||||
```json
|
|
||||||
{
|
|
||||||
"version": 1,
|
|
||||||
"serial": 555,
|
|
||||||
"remote": {
|
|
||||||
"type": "atlas",
|
|
||||||
"config": {
|
|
||||||
"name": "my-username/production"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
```
|
```
|
||||||
|
|
||||||
Once a conflict has been resolved locally by editing the state file, the serial
|
Once a conflict has been resolved locally by editing the state file, the serial
|
||||||
can be incremented past the current version and pushed:
|
can be incremented past the current version and pushed with the
|
||||||
|
[`state push`](/docs/commands/state/push.html) subcommand:
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
$ terraform remote push
|
$ terraform state push example.tfstate
|
||||||
```
|
```
|
||||||
|
|
||||||
This will upload the manually resolved state and set it as the head version.
|
This will upload the manually resolved state and set it as the head version.
|
||||||
|
|
Loading…
Reference in New Issue