github.com/pdecat/terraform@v0.11.9-beta1/website/docs/state/remote.html.md (about)

     1  ---
     2  layout: "docs"
     3  page_title: "State: Remote Storage"
     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  When working with Terraform in a team, use of a local file makes Terraform
    13  usage complicated because each user must make sure they always have the latest
    14  state data before running Terraform and make sure that nobody else runs
    15  Terraform at the same time.
    16  
    17  With _remote_ state, Terraform writes the state data to a remote data store,
    18  which can then be shared between all members of a team. Terraform supports
    19  storing state in [Terraform Enterprise](https://www.hashicorp.com/products/terraform/),
    20  [HashiCorp Consul](https://www.consul.io/), Amazon S3, and more.
    21  
    22  Remote state is a feature of [backends](/docs/backends). Configuring and
    23  using remote backends is easy and you can get started with remote state
    24  quickly. If you then want to migrate back to using local state, backends make
    25  that easy as well.
    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 without relying on any additional configuration
    37  store.
    38  
    39  For example, a core infrastructure team can handle building the core
    40  machines, networking, etc. and can expose some information to other
    41  teams to run their own infrastructure. As a more specific example with AWS:
    42  you can expose things such as VPC IDs, subnets, NAT instance IDs, etc. through
    43  remote state and have other Terraform states consume that.
    44  
    45  For example usage, see
    46  [the `terraform_remote_state` data source](/docs/providers/terraform/d/remote_state.html).
    47  
    48  While remote state is a convenient, built-in mechanism for sharing data
    49  between configurations, it is also possible to use more general stores to
    50  pass settings both to other configurations and to other consumers. For example,
    51  if your environment has [HashiCorp Consul](https://www.consul.io/) then you
    52  can have one Terraform configuration that writes to Consul using
    53  [`consul_key_prefix`](/docs/providers/consul/r/key_prefix.html) and then
    54  another that consumes those values using
    55  [the `consul_keys` data source](/docs/providers/consul/d/keys.html).
    56  
    57  ## Locking and Teamwork
    58  
    59  For fully-featured remote backends, Terraform can also use
    60  [state locking](/docs/state/locking.html) to prevent concurrent runs of
    61  Terraform against the same state.
    62  
    63  [Terraform Enterprise by HashiCorp](https://www.hashicorp.com/products/terraform/)
    64  is a commercial offering that supports an even stronger locking concept that
    65  can also detect attempts to create a new plan when an existing plan is already
    66  awaiting approval, by queuing Terraform operations in a central location.
    67  This allows teams to more easily coordinate and communicate about changes to
    68  infrastructure.