github.com/erriapo/terraform@v0.6.12-0.20160203182612-0340ea72354f/website/source/docs/commands/remote-config.html.markdown (about)

     1  ---
     2  layout: "docs"
     3  page_title: "Command: remote config"
     4  sidebar_current: "docs-commands-remote-config"
     5  description: |-
     6    The `terraform remote config` 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 config
    12  
    13  The `terraform remote config` 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 storage.
    20  
    21  ## Usage
    22  
    23  Usage: `terraform remote config [options]`
    24  
    25  The `remote config` command can be used to enable remote storage, change
    26  configuration 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 config` 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 enabling remote storage, use the `-backend-config` flag to set
    37  the required configuration variables as documented below. See the example
    38  below this section for more details.
    39  
    40  When remote storage is disabled, the existing remote state is migrated
    41  to a local file. This defaults to the `-state` path during restore.
    42  
    43  Supported storage backends and supported features of those
    44  are documented in the [Remote State](/docs/state/remote/index.html) section.
    45  
    46  The command-line flags are all optional. The list of available flags are:
    47  
    48  * `-backend=Atlas` - The remote backend to use. Must be one of the
    49    supported backends.
    50  
    51  * `-backend-config="k=v"` - Specify a configuration variable for a backend.
    52    This is how you set the required variables for the backend.
    53  
    54  * `-backup=path` - Path to backup the existing state file before
    55    modifying. Defaults to the "-state" path with ".backup" extension.
    56    Set to "-" to disable backup.
    57  
    58  * `-disable` - Disables remote state management and migrates the state
    59    to the `-state` path.
    60  
    61  * `-pull=true` - Controls if the remote state is pulled before disabling
    62    or after enabling. This defaults to true to ensure the latest state
    63    is available under both conditions.
    64  
    65  * `-state=path` - Path to read state. Defaults to "terraform.tfstate"
    66    unless remote state is enabled.
    67  
    68  ## Example: Consul
    69  
    70  The example below will push your remote state to Consul. Note that for
    71  this example, it would go to the public Consul demo. In practice, you
    72  should use your own private Consul server:
    73  
    74  ```
    75  $ terraform remote config \
    76      -backend=consul \
    77      -backend-config="address=demo.consul.io:80" \
    78      -backend-config="path=tf"
    79  ```