Update state
This commit is contained in:
parent
7924c6f2d3
commit
d31e1d9efa
|
@ -1,6 +1,6 @@
|
|||
---
|
||||
layout: "enterprise"
|
||||
page_title: "State: Collaborating"
|
||||
page_title: "Collaborating - State - Terraform Enterprise"
|
||||
sidebar_current: "docs-enterprise-state-collaborating"
|
||||
description: |-
|
||||
How to collaborate on states.
|
||||
|
@ -10,12 +10,14 @@ description: |-
|
|||
|
||||
Terraform Enterprise is one of a few options to store [remote state](/docs/enterprise/state).
|
||||
|
||||
Remote state gives you the ability to version and collaborate on Terraform changes. It
|
||||
stores information about the changes Terraform makes based on configuration.
|
||||
Remote state gives you the ability to version and collaborate on Terraform
|
||||
changes. It stores information about the changes Terraform makes based on
|
||||
configuration.
|
||||
|
||||
In order to collaborate safely on remote state, we recommend
|
||||
[creating an organization](/docs/enterprise/organizations/create.html) to manage teams of users.
|
||||
[creating an organization](/docs/enterprise/organizations/create.html) to
|
||||
manage teams of users.
|
||||
|
||||
Then, following a [remote state push](/docs/enterprise/state) you can view state versions
|
||||
in the changes tab of the environment created under the same name
|
||||
as the remote state.
|
||||
Then, following a [remote state push](/docs/enterprise/state) you can view state
|
||||
versions in the changes tab of the environment created under the same name as
|
||||
the remote state.
|
||||
|
|
|
@ -1,24 +1,24 @@
|
|||
---
|
||||
layout: "enterprise"
|
||||
page_title: "About Remote State"
|
||||
page_title: "State - Terraform Enterprise"
|
||||
sidebar_current: "docs-enterprise-state"
|
||||
description: |-
|
||||
Terraform stores the state of your managed infrastructure from the last time Terraform was run. This section is about states.
|
||||
---
|
||||
|
||||
# About Remote State
|
||||
# State
|
||||
|
||||
Terraform stores the state of your managed infrastructure from the last
|
||||
time Terraform was run. By default this state is stored in a local file
|
||||
named `terraform.tfstate`, but it can also be stored remotely, which
|
||||
works better in a team environment.
|
||||
Terraform stores the state of your managed infrastructure from the last time
|
||||
Terraform was run. By default this state is stored in a local file named
|
||||
`terraform.tfstate`, but it can also be stored remotely, which works better in a
|
||||
team environment.
|
||||
|
||||
Terraform Enterprise is a remote state provider, allowing you to store, version and
|
||||
collaborate on states.
|
||||
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. 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 can access.
|
||||
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
|
||||
infrastructure to be more easily broken down into components that multiple teams
|
||||
can access.
|
||||
|
||||
Read [more about remote state](https://www.terraform.io/docs/state/remote.html).
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
---
|
||||
layout: "enterprise"
|
||||
page_title: "State: Pushing"
|
||||
page_title: "Pushing - State - Terraform Enterprise"
|
||||
sidebar_current: "docs-enterprise-state-pushing"
|
||||
description: |-
|
||||
Pushing remote states.
|
||||
|
@ -10,10 +10,14 @@ description: |-
|
|||
|
||||
Terraform Enterprise is one of a few options to store [remote state](/docs/enterprise/state).
|
||||
|
||||
Remote state gives you the ability to version and collaborate on Terraform changes. It
|
||||
stores information about the changes Terraform makes based on configuration.
|
||||
Remote state gives you the ability to version and collaborate on Terraform
|
||||
changes. It stores information about the changes Terraform makes based on
|
||||
configuration.
|
||||
|
||||
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.
|
||||
|
||||
$ terraform remote config -backend-config="name=%{DEFAULT_USERNAME}/product"
|
||||
```shell
|
||||
$ terraform remote config \
|
||||
-backend-config="name=$USERNAME/product"
|
||||
```
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
---
|
||||
layout: "enterprise"
|
||||
page_title: "State: Resolving Conflicts"
|
||||
page_title: "Resolving Conflicts - State - Terraform Enterprise"
|
||||
sidebar_current: "docs-enterprise-state-resolving"
|
||||
description: |-
|
||||
Resolving conflicts with remote states.
|
||||
|
@ -8,64 +8,63 @@ description: |-
|
|||
|
||||
# Resolving Conflicts in Remote States
|
||||
|
||||
Resolving state conflicts can be time consuming and error prone, so
|
||||
it's important to approach it carefully.
|
||||
Resolving state conflicts can be time consuming and error prone, so it's
|
||||
important to approach it carefully.
|
||||
|
||||
There are several tools provided by Terraform Enterprise to help resolve conflicts
|
||||
and fix remote state issues. First, you can navigate between state
|
||||
versions in the changes view of your environment (after toggling on
|
||||
the remote state checkbox) and view plain-text differences between
|
||||
versions.
|
||||
There are several tools provided by Terraform Enterprise to help resolve
|
||||
conflicts and fix remote state issues. First, you can navigate between state
|
||||
versions in the changes view of your environment (after toggling on the remote
|
||||
state checkbox) and view plain-text differences between versions.
|
||||
|
||||
This allows you to pinpoint where things may have gone wrong and
|
||||
make a educated decision about resolving the conflict.
|
||||
This allows you to pinpoint where things may have gone wrong and make a educated
|
||||
decision about resolving the conflict.
|
||||
|
||||
### Rolling Back to a Specific State Version
|
||||
|
||||
The rollback feature allows you to choose a new version to set as the
|
||||
"Head" version of the state. Rolling back to a version means it will
|
||||
then return that state upon request from a client. It will not
|
||||
increment the serial in the state, but perform a hard rollback to the
|
||||
exact version of the state provided.
|
||||
The rollback feature allows you to choose a new version to set as the "Head"
|
||||
version of the state. Rolling back to a version means it will then return that
|
||||
state upon request from a client. It will not increment the serial in the state,
|
||||
but perform a hard rollback to the exact version of the state provided.
|
||||
|
||||
This allows you to reset the state to an older version, essentially
|
||||
forgetting changes made in versions after that point.
|
||||
This allows you to reset the state to an older version, essentially forgetting
|
||||
changes made in versions after that point.
|
||||
|
||||
To roll back to a specific version, navigate to it in the changes view
|
||||
and use the rollback link. You'll need to confirm the version number
|
||||
to perform the operation.
|
||||
To roll back to a specific version, navigate to it in the changes view and use
|
||||
the rollback link. You'll need to confirm the version number to perform the
|
||||
operation.
|
||||
|
||||
### Using Terraform Locally
|
||||
|
||||
Another way to resolve remote state conflicts
|
||||
is to merge and conflicted copies locally by inspecting the
|
||||
raw state available in the path `.terraform/terraform.tfstate`.
|
||||
Another way to resolve remote state conflicts is to merge and conflicted copies
|
||||
locally by inspecting the raw state available in the path
|
||||
`.terraform/terraform.tfstate`.
|
||||
|
||||
When making state changes, it's important to make backup copies in
|
||||
order to avoid losing any data.
|
||||
When making state changes, it's important to make backup copies in order to
|
||||
avoid losing any data.
|
||||
|
||||
Any state that is pushed with a serial that is lower
|
||||
than the known serial when the MD5 of the state does not match will be rejected.
|
||||
Any state that is pushed with a serial that is lower than the known serial when
|
||||
the MD5 of the state does not match will be rejected.
|
||||
|
||||
The serial is embedded in the state file:
|
||||
|
||||
{
|
||||
"version": 1,
|
||||
"serial": 555,
|
||||
"remote": {
|
||||
"type": "atlas",
|
||||
"config": {
|
||||
"name": "%{DEFAULT_USERNAME}/production"
|
||||
}
|
||||
},
|
||||
...
|
||||
```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 can be incremented past the current version and
|
||||
pushed:
|
||||
Once a conflict has been resolved locally by editing the state file, the serial
|
||||
can be incremented past the current version and pushed:
|
||||
|
||||
terraform remote push
|
||||
```shell
|
||||
$ terraform remote push
|
||||
```
|
||||
|
||||
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