github.com/adrian-bl/terraform@v0.7.0-rc2.0.20160705220747-de0a34fc3517/website/source/docs/commands/push.html.markdown (about)

     1  ---
     2  layout: "docs"
     3  page_title: "Command: push"
     4  sidebar_current: "docs-commands-push"
     5  description: |-
     6    The `terraform push` command is used to upload the Terraform configuration to HashiCorp's Atlas service for automatically managing your infrastructure in the cloud.
     7  ---
     8  
     9  # Command: push
    10  
    11  The `terraform push` command uploads your Terraform configuration to
    12  be managed by HashiCorp's [Atlas](https://atlas.hashicorp.com).
    13  By uploading your configuration to Atlas, Atlas can automatically run
    14  Terraform for you, will save all state transitions, will save plans,
    15  and will keep a history of all Terraform runs.
    16  
    17  This makes it significantly easier to use Terraform as a team: team
    18  members modify the Terraform configurations locally and continue to
    19  use normal version control. When the Terraform configurations are ready
    20  to be run, they are pushed to Atlas, and any member of your team can
    21  run Terraform with the push of a button.
    22  
    23  Atlas can also be used to set ACLs on who can run Terraform, and a
    24  future update of Atlas will allow parallel Terraform runs and automatically
    25  perform infrastructure locking so only one run is modifying the same
    26  infrastructure at a time.
    27  
    28  ## Usage
    29  
    30  Usage: `terraform push [options] [path]`
    31  
    32  The `path` argument is the same as for the
    33  [apply](/docs/commands/apply.html) command.
    34  
    35  The command-line flags are all optional. The list of available flags are:
    36  
    37  * `-atlas-address=<url>` - An alternate address to an Atlas instance.
    38    Defaults to `https://atlas.hashicorp.com`.
    39  
    40  * `-upload-modules=true` - If true (default), then the
    41    [modules](/docs/modules/index.html)
    42    being used are all locked at their current checkout and uploaded
    43    completely to Atlas. This prevents Atlas from running `terraform get`
    44    for you.
    45  
    46  * `-name=<name>` - Name of the infrastructure configuration in Atlas.
    47    The format of this is: "username/name" so that you can upload
    48    configurations not just to your account but to other accounts and
    49    organizations. This setting can also be set in the configuration
    50    in the
    51    [Atlas section](/docs/configuration/atlas.html).
    52  
    53  * `-no-color` - Disables output with coloring
    54  
    55  
    56  * `-overwrite=foo` - Marks a specific variable to be updated on Atlas.
    57    Normally, if a variable is already set in Atlas, Terraform will not
    58    send the local value (even if it is different). This forces it to
    59    send the local value to Atlas. This flag can be repeated multiple times.
    60  
    61  * `-token=<token>` - Atlas API token to use to authorize the upload.
    62    If blank or unspecified, the `ATLAS_TOKEN` environmental variable
    63    will be used.
    64  
    65  * `-var='foo=bar'` - Set the value of a variable for the Terraform configuration.
    66  
    67  * `-var-file=foo` - Set the value of variables using a variable file. This flag 
    68    can be used multiple times. 
    69   
    70  
    71  * `-vcs=true` - If true (default), then Terraform will detect if a VCS
    72    is in use, such as Git, and will only upload files that are committed to
    73    version control. If no version control system is detected, Terraform will
    74    upload all files in `path` (parameter to the command).
    75  
    76  ## Packaged Files
    77  
    78  The files that are uploaded and packaged with a `push` are all the
    79  files in the `path` given as the parameter to the command, recursively.
    80  By default (unless `-vcs=false` is specified), Terraform will automatically
    81  detect when a VCS such as Git is being used, and in that case will only
    82  upload the files that are committed. Because of this built-in intelligence,
    83  you don't have to worry about excluding folders such as ".git" or ".hg" usually.
    84  
    85  If Terraform doesn't detect a VCS, it will upload all files.
    86  
    87  The reason Terraform uploads all of these files is because Terraform
    88  cannot know what is and isn't being used for provisioning, so it uploads
    89  all the files to be safe. To exclude certain files, specify the `-exclude`
    90  flag when pushing, or specify the `exclude` parameter in the
    91  [Atlas configuration section](/docs/configuration/atlas.html).
    92  
    93  ## Terraform Variables
    94  
    95  When you `push`, Terraform will automatically set the local values of
    96  your Terraform variables on Atlas. The values are only set if they
    97  don't already exist on Atlas. If you want to force push a certain
    98  variable value to update it, use the `-overwrite` flag.
    99  
   100  All the variable values stored on Atlas are encrypted and secured
   101  using [Vault](https://www.vaultproject.io). We blogged about the
   102  [architecture of our secure storage system](https://www.hashicorp.com/blog/how-atlas-uses-vault-for-managing-secrets.html) if you want more detail.
   103  
   104  The variable values can be updated using the `-overwrite` flag or via
   105  the [Atlas website](https://atlas.hashicorp.com). An example of updating
   106  just a single variable `foo` is shown below:
   107  
   108  ```
   109  $ terraform push -var 'foo=bar' -overwrite foo
   110  ...
   111  ```
   112  
   113  Both the `-var` and `-overwrite` flag are required. The `-var` flag
   114  sets the value locally (the exact same process as commands such as apply
   115  or plan), and the `-overwrite` flag tells the push command to update Atlas.
   116  
   117  ## Remote State Requirement
   118  
   119  `terraform push` requires that
   120  [remote state](/docs/commands/remote-config.html)
   121  is enabled. The reasoning for this is simple: `terraform push` sends your
   122  configuration to be managed remotely. For it to keep the state in sync
   123  and for you to be able to easily access that state, remote state must
   124  be enabled instead of juggling local files.
   125  
   126  While `terraform push` sends your configuration to be managed by Atlas,
   127  the remote state backend _does not_ have to be Atlas. It can be anything
   128  as long as it is accessible by the public internet, since Atlas will need
   129  to be able to communicate to it.
   130  
   131  **Warning:** The credentials for accessing the remote state will be
   132  sent up to Atlas as well. Therefore, we recommend you use access keys
   133  that are restricted if possible.