Skip to content

Commit 4e503d1

Browse files
armonmitchellh
authored andcommitted
website: Adding documentation for new commands
1 parent 8ceabbd commit 4e503d1

3 files changed

Lines changed: 131 additions & 0 deletions

File tree

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
---
2+
layout: "docs"
3+
page_title: "Command: pull"
4+
sidebar_current: "docs-commands-pull"
5+
description: |-
6+
The `terraform pull` refreshes the cached state file from the
7+
remote server when remote state storage is enabled.
8+
---
9+
10+
# Command: pull
11+
12+
The `terraform pull` refreshes the cached state file from the
13+
remote server when remote state storage is enabled. The [`remote`
14+
command](/docs/commands/remote.html) should be used to enable
15+
remote state storage.
16+
17+
## Usage
18+
19+
Usage: `terraform pull`
20+
21+
The `pull` command is invoked without options to refresh the
22+
cache copy of the state.
23+
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
---
2+
layout: "docs"
3+
page_title: "Command: push"
4+
sidebar_current: "docs-commands-push"
5+
description: |-
6+
The `terraform push` command is used to push a cached local copy
7+
of the state to a remote storage server.
8+
---
9+
10+
# Command: push
11+
12+
The `terraform push` uploads the cached state file to the
13+
remote server when remote state storage is enabled. The [`remote`
14+
command](/docs/commands/remote.html) should be used to enable
15+
remote state storage.
16+
17+
Uploading is typically done automatically when running a Terraform
18+
command that modifies state, but this can be used to retry uploads
19+
if a transient failure occurs.
20+
21+
## Usage
22+
23+
Usage: `terraform push`
24+
25+
The `push` command is invoked without options to upload the
26+
local cached state to the remote storage server.
27+
Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
---
2+
layout: "docs"
3+
page_title: "Command: remote"
4+
sidebar_current: "docs-commands-remote"
5+
description: |-
6+
The `terraform remote` command is used to configure Terraform to make
7+
use of remote state storage, change remote storage configuration, or
8+
to disable it.
9+
---
10+
11+
# Command: remote
12+
13+
The `terraform remote` command is used to configure use of remote
14+
state storage. By default, Terraform persists its state only to a local
15+
disk. When remote state storage is enabled, Terraform will automatically
16+
fetch the latest state from the remote server when necessary and if any
17+
updates are made, the newest state is persisted back to the remote server.
18+
In this mode, users do not need to durably store the state using version
19+
control or shared storaged.
20+
21+
## Usage
22+
23+
Usage: `terraform remote [options]`
24+
25+
The `remote` command can be used to enable remote storage, change configuration,
26+
or disable the use of remote storage. Terraform supports multiple types
27+
of storage backends, specified by using the `-backend` flag. By default,
28+
Atlas is assumed to be the storage backend. Each backend expects different,
29+
configuration arguments documented below.
30+
31+
When remote storage is enabled, an existing local state file can be migrated.
32+
By default, `remote` will look for the "terraform.tfstate" file, but that
33+
can be specified by the `-state` flag. If no state file exists, a blank
34+
state will be configured.
35+
36+
When remote storage is disabled, the existing remote state is migrated
37+
to a local file. This defaults to the `-state` path during restore.
38+
39+
The following backends are supported:
40+
41+
* Atlas - Stores the state in Atlas. Requires the `-name` and `-access-token` flag.
42+
The `-address` flag can optionally be provided.
43+
44+
* Consul - Stores the state in the KV store at a given path.
45+
Requires the `path` flag. The `-address` and `-access-token`
46+
flag can optionally be provided. Address is assumed to be the
47+
local agent if not provided.
48+
49+
* HTTP - Stores the state using a simple REST client. State will be fetched
50+
via GET, updated via POST, and purged with DELETE. Requires the `-address` flag.
51+
52+
The command-line flags are all optional. The list of available flags are:
53+
54+
* `-address=url` - URL of the remote storage server. Required for HTTP backend,
55+
optional for Atlas and Consul.
56+
57+
* `-access-token=token` - Authentication token for state storage server.
58+
Required for Atlas backend, optional for Consul.
59+
60+
* `-backend=Atlas` - Specifies the type of remote backend. Must be one
61+
of Atlas, Consul, or HTTP. Defaults to Atlas.
62+
63+
* `-backup=path` - Path to backup the existing state file before
64+
modifying. Defaults to the "-state" path with ".backup" extension.
65+
Set to "-" to disable backup.
66+
67+
* `-disable` - Disables remote state management and migrates the state
68+
to the `-state` path.
69+
70+
* `-name=name` - Name of the state file in the state storage server.
71+
Required for Atlas backend.
72+
73+
* `-path=path` - Path of the remote state in Consul. Required for the
74+
Consul backend.
75+
76+
* `-pull=true` - Controls if the remote state is pulled before disabling.
77+
This defaults to true to ensure the latest state is cached before disabling.
78+
79+
* `-state=path` - Path to read state. Defaults to "terraform.tfstate"
80+
unless remote state is enabled.
81+

0 commit comments

Comments
 (0)