command/push: update flag to -overwrite, update docs

This commit is contained in:
Mitchell Hashimoto 2015-06-29 13:53:05 -07:00
parent 82028a7667
commit 9d9bcc2f6e
3 changed files with 18 additions and 8 deletions

View File

@ -34,7 +34,7 @@ func (c *PushCommand) Run(args []string) int {
cmdFlags.BoolVar(&moduleUpload, "upload-modules", true, "")
cmdFlags.StringVar(&name, "name", "", "")
cmdFlags.BoolVar(&archiveVCS, "vcs", true, "")
cmdFlags.Var((*FlagStringSlice)(&set), "set", "")
cmdFlags.Var((*FlagStringSlice)(&set), "overwrite", "")
cmdFlags.Usage = func() { c.Ui.Error(c.Help()) }
if err := cmdFlags.Parse(args); err != nil {
return 1
@ -197,7 +197,7 @@ func (c *PushCommand) Run(args []string) int {
"The following variables will be set or updated within Atlas from\n" +
"their local values. All other variables are already set within Atlas.\n" +
"If you want to modify the value of a variable, use the Atlas web\n" +
"interface or set it locally and use the -set flag.\n\n")
"interface or set it locally and use the -overwrite flag.\n\n")
for _, v := range setVars {
c.Ui.Output(fmt.Sprintf(" * %s", v))
}
@ -249,7 +249,7 @@ Options:
-token=<token> Access token to use to upload. If blank or unspecified,
the ATLAS_TOKEN environmental variable will be used.
-set=foo Variable keys that should overwrite values in Atlas.
-overwrite=foo Variable keys that should overwrite values in Atlas.
Otherwise, variables already set in Atlas will overwrite
local values. This flag can be repeated.

View File

@ -225,7 +225,7 @@ func TestPush_localOverride(t *testing.T) {
args := []string{
"-var-file", path + "/terraform.tfvars",
"-vcs=false",
"-set=foo",
"-overwrite=foo",
path,
}
if code := c.Run(args); code != 0 {

View File

@ -53,7 +53,7 @@ The command-line flags are all optional. The list of available flags are:
* `-no-color` - Disables output with coloring
* `-set=foo` - Marks a specific variable to be updated within Atlas.
* `-overwrite=foo` - Marks a specific variable to be updated within Atlas.
Normally, if a variable is already set in Atlas, Terraform will not
send the local value (even if it is different). This forces it to
send the local value to Atlas. This flag can be repeated multiple times.
@ -93,14 +93,24 @@ flag when pushing, or specify the `exclude` parameter in the
When you `push`, Terraform will automatically set the local values of
your Terraform variables within Atlas. The values are only set if they
don't already exist within Atlas. If you want to force push a certain
variable value to update it, use the `-set` flag.
variable value to update it, use the `-overwrite` flag.
All the variable values stored within Atlas are encrypted and secured
using [Vault](https://vaultproject.io). We blogged about the
[architecture of our secure storage system](https://hashicorp.com/blog/how-atlas-uses-vault-for-managing-secrets.html) if you want more detail.
The variable values can be updated using the `-set` flag or via
the [Atlas website](https://atlas.hashicorp.com).
The variable values can be updated using the `-overwrite` flag or via
the [Atlas website](https://atlas.hashicorp.com). An example of updating
just a single variable `foo` is shown below:
```
$ terraform push -var 'foo=bar' -overwrite foo
...
```
Both the `-var` and `-overwrite` flag are required. The `-var` flag
sets the value locally (the exact same process as commands such as apply
or plan), and the `-overwrite` flag tells the push command to update Atlas.
## Remote State Requirement