github.com/ns1/terraform@v0.7.10-0.20161109153551-8949419bef40/website/source/intro/getting-started/remote.html.markdown (about)

     1  ---
     2  layout: "intro"
     3  page_title: "Terraform Remote"
     4  sidebar_current: "gettingstarted-remote"
     5  description: |-
     6    We've now seen how to build, change, and destroy infrastructure from a local machine. However, you can use Atlas by HashiCorp to run Terraform remotely to version and audit the history of your infrastructure.
     7  ---
     8  
     9  # Why Use Terraform Remotely?
    10  We've now seen how to build, change, and destroy infrastructure
    11  from a local machine. This is great for testing and development,
    12  however in production environments it is more responsible to run
    13  Terraform remotely and store a master Terraform state remotely.
    14  
    15  [Atlas](https://atlas.hashicorp.com/?utm_source=oss&utm_medium=getting-started&utm_campaign=terraform),
    16  HashiCorp's solution for Terraform remote, runs an
    17  infrastructure version control. Running Terraform
    18  in Atlas allows teams to easily version, audit, and collaborate
    19  on infrastructure changes. Each proposed change generates
    20  a Terraform plan which can be reviewed and collaborated on as a team.
    21  When a proposed change is accepted, the Terraform logs are stored
    22  in Atlas, resulting in a linear history of infrastructure states to
    23  help with auditing and policy enforcement. Additional benefits to
    24  running Terraform remotely include moving access
    25  credentials off of developer machines and releasing local machines
    26  from long-running Terraform processes.
    27  
    28  # How to Use Terraform Remotely
    29  You can learn how to use Terraform remotely with our [interactive tutorial](https://atlas.hashicorp.com/tutorial/terraform/?utm_source=oss&utm_medium=getting-started&utm_campaign=terraform)
    30  or you can follow the outlined steps below.
    31  
    32  First, If you don't have an Atlas account, you can [create an account here](https://atlas.hashicorp.com/account/new?utm_source=oss&utm_medium=getting-started&utm_campaign=terraform).
    33  
    34  The Terraform CLI uses your `Atlas Token` to securely communicate with your Atlas account. To generate a token: from the main menu, select your username in the left side navigation menu to access your profile. Under `Personal`, click on the `Tokens` tab and hit `Generate`.
    35  
    36  For the purposes of this tutorial you can use this token by exporting it to your local shell session:
    37  
    38  ```
    39  $ export ATLAS_TOKEN=ATLAS_ACCESS_TOKEN
    40  ```
    41  Replace `ATLAS_ACCESS_TOKEN` with the token generated earlier
    42  
    43  Then configure [Terraform remote state storage](/docs/commands/remote.html) with the command:
    44  
    45  ```
    46  $ terraform remote config -backend-config="name=ATLAS_USERNAME/getting-started"
    47  ```
    48  
    49  Replace `ATLAS_USERNAME` with your Atlas username.
    50  
    51  Before you [push](/docs/commands/push.html) your Terraform configuration to Atlas you'll need to start a local version control system with at least one commit. Here is an example using `git`.
    52  
    53  ```
    54  $ git init
    55  $ git add example.tf
    56  $ git commit -m "init commit"
    57  ```
    58  Next, [push](/docs/commands/push.html) your Terraform configuration to Atlas with:
    59  
    60  ```
    61  $ terraform push -name="ATLAS_USERNAME/getting-started"
    62  ```
    63  
    64  This will automatically trigger a `terraform plan`, which you can
    65  review in the [Environments tab in Atlas](https://atlas.hashicorp.com/environments).
    66  If the plan looks correct, hit "Confirm & Apply" to execute the
    67  infrastructure changes.
    68  
    69  # Version Control for Infrastructure
    70  Running Terraform in Atlas creates a complete history of
    71  infrastructure changes, a sort of version control
    72  for infrastructure. Similar to application version control
    73  systems such as Git or Subversion, this makes changes to
    74  infrastructure an auditable, repeatable,
    75  and collaborative process. With so much relying on the
    76  stability of your infrastructure, version control is a
    77  responsible choice for minimizing downtime.
    78  
    79  ## Next
    80  You now know how to create, modify, destroy, version, and
    81  collaborate on infrastructure. With these building blocks,
    82  you can effectively experiment with any part of Terraform.
    83  
    84  Next, we move on to features that make Terraform configurations
    85  slightly more useful: [variables, resource dependencies, provisioning,
    86  and more](/intro/getting-started/dependencies.html).