github.com/armen/terraform@v0.5.2-0.20150529052519-caa8117a08f1/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 storaged.
    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  The following backends are supported:
    44  
    45  * Atlas - Stores the state in Atlas. Requires the `name` and `access-token`
    46    variables. The `address` variable can optionally be provided.
    47  
    48  * Consul - Stores the state in the KV store at a given path.
    49    Requires the `path` variable. The `address` and `access-token`
    50    variables can optionally be provided. Address is assumed to be the
    51    local agent if not provided.
    52  
    53  * S3 - Stores the state as a given key in a given bucket on Amazon S3.
    54    Requires the `bucket` and `key` variables. Supports and honors the standard
    55    AWS environment variables `AWS_ACCESS_KEY_ID`, `AWS_SECRET_ACCESS_KEY`
    56    and `AWS_DEFAULT_REGION`. These can optionally be provided as parameters
    57    in the `aws_access_key`, `aws_secret_key` and `region` variables
    58    respectively, but passing credentials this way is not recommended since they
    59    will be included in cleartext inside the persisted state.
    60  
    61  * HTTP - Stores the state using a simple REST client. State will be fetched
    62    via GET, updated via POST, and purged with DELETE. Requires the `address` variable.
    63  
    64  The command-line flags are all optional. The list of available flags are:
    65  
    66  * `-backend=Atlas` - The remote backend to use. Must be one of the above
    67    supported backends.
    68  
    69  * `-backend-config="k=v"` - Specify a configuration variable for a backend.
    70    This is how you set the required variables for the backends above.
    71  
    72  * `-backup=path` - Path to backup the existing state file before
    73    modifying. Defaults to the "-state" path with ".backup" extension.
    74    Set to "-" to disable backup.
    75  
    76  * `-disable` - Disables remote state management and migrates the state
    77    to the `-state` path.
    78  
    79  * `-pull=true` - Controls if the remote state is pulled before disabling
    80    or after enabling. This defaults to true to ensure the latest state
    81    is available under both conditions.
    82  
    83  * `-state=path` - Path to read state. Defaults to "terraform.tfstate"
    84    unless remote state is enabled.
    85  
    86  ## Example: Consul
    87  
    88  The example below will push your remote state to Consul. Note that for
    89  this example, it would go to the public Consul demo. In practice, you
    90  should use your own private Consul server:
    91  
    92  ```
    93  $ terraform remote config \
    94      -backend=consul \
    95      -backend-config="address=demo.consul.io:80" \
    96      -backend-config="path=tf"
    97  ```