github.com/iaas-resource-provision/iaas-rpc@v1.0.7-0.20211021023331-ed21f798c408/website/docs/language/settings/backends/index.html.md (about)

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