github.com/muratcelep/terraform@v1.1.0-beta2-not-internal-4/website/docs/language/settings/backends/index.html.md (about)

     1  ---
     2  layout: "language"
     3  page_title: "Backend Overview - Configuration Language"
     4  description: "A backend defines where and how Terraform performs operations, such as where it stores state files. Learn about recommended backends and how backends work."
     5  ---
     6  
     7  # Backends
     8  
     9  Each Terraform configuration can specify a backend, which defines where
    10  and how operations are performed, where [state](/docs/language/state/index.html)
    11  snapshots are stored, etc.
    12  
    13  The rest of this page introduces the concept of backends; the other pages in
    14  this section document how to configure and use backends.
    15  
    16  - [Backend Configuration](/docs/language/settings/backends/configuration.html) documents the form
    17    of a `backend` block, which selects and configures a backend for a
    18    Terraform configuration.
    19  - This section also includes a page for each of Terraform's built-in backends,
    20    documenting its behavior and available settings. See the navigation sidebar
    21    for a complete list.
    22  
    23  ## Recommended Backends
    24  
    25  - If you are still learning how to use Terraform, we recommend using the default
    26    `local` backend, which requires no configuration.
    27  - If you and your team are using Terraform to manage meaningful infrastructure,
    28    we recommend using the `remote` backend with [Terraform Cloud](/docs/cloud/index.html)
    29    or [Terraform Enterprise](/docs/enterprise/index.html).
    30  
    31  ## Where Backends are Used
    32  
    33  Backend configuration is only used by [Terraform CLI](/docs/cli/index.html).
    34  Terraform Cloud and Terraform Enterprise always use their own state storage when
    35  performing Terraform runs, so they ignore any backend block in the
    36  configuration.
    37  
    38  But since it's common to
    39  [use Terraform CLI alongside Terraform Cloud](/docs/cloud/run/cli.html)
    40  (and since certain state operations, like [tainting](/docs/cli/commands/taint.html),
    41  can only be performed on the CLI), we recommend that Terraform Cloud users
    42  include a backend block in their configurations and configure the `remote`
    43  backend to use the relevant Terraform Cloud workspace(s).
    44  
    45  ## Where Backends Come From
    46  
    47  Terraform includes a built-in selection of backends; this selection has changed
    48  over time, but does not change very often.
    49  
    50  The built-in backends are the only backends. You cannot load additional backends
    51  as plugins.
    52  
    53  ## What Backends Do
    54  
    55  There are two areas of Terraform's behavior that are determined by the backend:
    56  
    57  - Where state is stored.
    58  - Where operations are performed.
    59  
    60  ### State
    61  
    62  Terraform uses persistent [state](/docs/language/state/index.html) data to keep track of
    63  the resources it manages. Since it needs the state in order to know which
    64  real-world infrastructure objects correspond to the resources in a
    65  configuration, everyone working with a given collection of infrastructure
    66  resources must be able to access the same state data.
    67  
    68  The `local` backend stores state as a local file on disk, but every other
    69  backend stores state in a remote service of some kind, which allows multiple
    70  people to access it. Accessing state in a remote service generally requires some
    71  kind of access credentials, since state data contains extremely sensitive
    72  information.
    73  
    74  Some backends act like plain "remote disks" for state files; others support
    75  _locking_ the state while operations are being performed, which helps prevent
    76  conflicts and inconsistencies.
    77  
    78  ### Operations
    79  
    80  "Operations" refers to performing API requests against infrastructure services
    81  in order to create, read, update, or destroy resources. Not every `terraform`
    82  subcommand performs API operations; many of them only operate on state data.
    83  
    84  Only two backends actually perform operations: `local` and `remote`.
    85  
    86  The `local` backend performs API operations directly from the machine where the
    87  `terraform` command is run. Whenever you use a backend other than `local` or
    88  `remote`, Terraform uses the `local` backend for operations; it only uses the
    89  configured backend for state storage.
    90  
    91  The `remote` backend can perform API operations remotely, using Terraform Cloud
    92  or Terraform Enterprise. When running remote operations, the local `terraform`
    93  command displays the output of the remote actions as though they were being
    94  performed locally, but only the remote system requires cloud credentials or
    95  network access to the resources being managed.
    96  
    97  Remote operations are optional for the `remote` backend; the settings for the
    98  target Terraform Cloud workspace determine whether operations run remotely or
    99  locally. If local operations are configured, Terraform uses the `remote` backend
   100  for state and the `local` backend for operations, like with the other state
   101  backends.
   102  
   103  ### Backend Types
   104  
   105  Terraform's backends are divided into two main types, according to how they
   106  handle state and operations:
   107  
   108  - **Enhanced** backends can both store state and perform operations. There are
   109    only two enhanced backends: `local` and `remote`.
   110  - **Standard** backends only store state, and rely on the `local` backend for
   111    performing operations.