github.com/turtlemonvh/terraform@v0.6.9-0.20151204001754-8e40b6b855e8/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.
    68  
    69  * `-vcs=true` - If true (default), then Terraform will detect if a VCS
    70    is in use, such as Git, and will only upload files that are committed to
    71    version control. If no version control system is detected, Terraform will
    72    upload all files in `path` (parameter to the command).
    73  
    74  ## Packaged Files
    75  
    76  The files that are uploaded and packaged with a `push` are all the
    77  files in the `path` given as the parameter to the command, recursively.
    78  By default (unless `-vcs=false` is specified), Terraform will automatically
    79  detect when a VCS such as Git is being used, and in that case will only
    80  upload the files that are committed. Because of this built-in intelligence,
    81  you don't have to worry about excluding folders such as ".git" or ".hg" usually.
    82  
    83  If Terraform doesn't detect a VCS, it will upload all files.
    84  
    85  The reason Terraform uploads all of these files is because Terraform
    86  cannot know what is and isn't being used for provisioning, so it uploads
    87  all the files to be safe. To exclude certain files, specify the `-exclude`
    88  flag when pushing, or specify the `exclude` parameter in the
    89  [Atlas configuration section](/docs/configuration/atlas.html).
    90  
    91  ## Terraform Variables
    92  
    93  When you `push`, Terraform will automatically set the local values of
    94  your Terraform variables on Atlas. The values are only set if they
    95  don't already exist on Atlas. If you want to force push a certain
    96  variable value to update it, use the `-overwrite` flag.
    97  
    98  All the variable values stored on Atlas are encrypted and secured
    99  using [Vault](https://vaultproject.io). We blogged about the
   100  [architecture of our secure storage system](https://hashicorp.com/blog/how-atlas-uses-vault-for-managing-secrets.html) if you want more detail.
   101  
   102  The variable values can be updated using the `-overwrite` flag or via
   103  the [Atlas website](https://atlas.hashicorp.com). An example of updating
   104  just a single variable `foo` is shown below:
   105  
   106  ```
   107  $ terraform push -var 'foo=bar' -overwrite foo
   108  ...
   109  ```
   110  
   111  Both the `-var` and `-overwrite` flag are required. The `-var` flag
   112  sets the value locally (the exact same process as commands such as apply
   113  or plan), and the `-overwrite` flag tells the push command to update Atlas.
   114  
   115  ## Remote State Requirement
   116  
   117  `terraform push` requires that
   118  [remote state](/docs/commands/remote-config.html)
   119  is enabled. The reasoning for this is simple: `terraform push` sends your
   120  configuration to be managed remotely. For it to keep the state in sync
   121  and for you to be able to easily access that state, remote state must
   122  be enabled instead of juggling local files.
   123  
   124  While `terraform push` sends your configuration to be managed by Atlas,
   125  the remote state backend _does not_ have to be Atlas. It can be anything
   126  as long as it is accessible by the public internet, since Atlas will need
   127  to be able to communicate to it.
   128  
   129  **Warning:** The credentials for accessing the remote state will be
   130  sent up to Atlas as well. Therefore, we recommend you use access keys
   131  that are restricted if possible.