github.com/turtlemonvh/terraform@v0.6.9-0.20151204001754-8e40b6b855e8/website/source/docs/state/remote.html.md (about)

     1  ---
     2  layout: "docs"
     3  page_title: "Remote State"
     4  sidebar_current: "docs-state-remote"
     5  description: |-
     6    Terraform can store the state remotely, making it easier to version and work with in a team.
     7  ---
     8  
     9  # Remote State
    10  
    11  By default, Terraform stores state locally in a file named "terraform.tfstate".
    12  Because this file must exist, it makes working with Terraform in a team
    13  complicated since it is a frequent source of merge conflicts. Remote state
    14  helps alleviate these issues.
    15  
    16  With remote state, Terraform stores the state in a remote store. Terraform
    17  supports storing state in [Atlas](https://atlas.hashicorp.com),
    18  [Consul](https://www.consul.io), S3, and more.
    19  
    20  You can begin using remote state from the beginning with flags to the
    21  [init](/docs/commands/init.html) command, or you can migrate an existing
    22  local state to remote state using the
    23  [remote config](/docs/commands/remote-config.html) command. You can also
    24  use the remote config to disable remote state and move back to local
    25  state.
    26  
    27  ## Delegation and Teamwork
    28  
    29  Remote state gives you more than just easier version control and
    30  safer storage. It also allows you to delegate the
    31  [outputs](/docs/configuration/outputs.html) to other teams. This allows
    32  your infrastructure to be more easily broken down into components that
    33  multiple teams can access.
    34  
    35  Put another way, remote state also allows teams to share infrastructure
    36  resources in a read-only way.
    37  
    38  For example, a core infrastructure team can handle building the core
    39  machines, networking, etc. and can expose some information to other
    40  teams to run their own infrastructure. As a more specific example with AWS:
    41  you can expose things such as VPC IDs, subnets, NAT instance IDs, etc. through
    42  remote state and have other Terraform states consume that.
    43  
    44  An example is shown below:
    45  
    46  ```
    47  resource "terraform_remote_state" "vpc" {
    48      backend = "atlas"
    49      config {
    50          name = "hashicorp/vpc-prod"
    51      }
    52  }
    53  
    54  resource "aws_instance" "foo" {
    55      # ...
    56      subnet_id = "${terraform_remote_state.vpc.output.subnet_id}"
    57  }
    58  ```
    59  
    60  This makes teamwork and componentization of infrastructure frictionless
    61  within your infrastructure.
    62  
    63  ## Locking and Teamwork
    64  
    65  Remote state currently **does not** lock regions of your infrastructure
    66  to allow parallel modification using Terraform. Therefore, you must still
    67  collaborate with teammates to safely run Terraform.
    68  
    69  [Atlas by HashiCorp](https://atlas.hashicorp.com) is a commercial offering
    70  that does safely allow parallel Terraform runs and handles infrastructure
    71  locking for you.
    72  
    73  In the future, we'd like to extend the remote state system to allow some
    74  minimal locking functionality, but it is a difficult problem without a
    75  central system that we currently aren't focused on solving.
    76