command/push: add -atlas-address

This commit is contained in:
Mitchell Hashimoto 2015-03-24 17:45:19 -07:00
parent 51614b6365
commit 280635d2b0
2 changed files with 15 additions and 1 deletions

View File

@ -21,11 +21,12 @@ type PushCommand struct {
}
func (c *PushCommand) Run(args []string) int {
var atlasToken string
var atlasAddress, atlasToken string
var archiveVCS, moduleUpload bool
var name string
args = c.Meta.process(args, false)
cmdFlags := c.Meta.flagSet("push")
cmdFlags.StringVar(&atlasAddress, "atlas-address", "", "")
cmdFlags.StringVar(&c.Meta.statePath, "state", DefaultStateFilename, "path")
cmdFlags.StringVar(&atlasToken, "token", "", "")
cmdFlags.BoolVar(&moduleUpload, "upload-modules", true, "")
@ -108,6 +109,13 @@ func (c *PushCommand) Run(args []string) int {
// Initialize it to the default client, we set custom settings later
client := atlas.DefaultClient()
if atlasAddress != "" {
client, err = atlas.NewClient(atlasAddress)
if err != nil {
c.Ui.Error(fmt.Sprintf("Error initializing Atlas client: %s", err))
return 1
}
}
if atlasToken != "" {
client.Token = atlasToken
@ -185,6 +193,9 @@ Usage: terraform push [options] [DIR]
Options:
-atlas-address=<url> An alternate address to an Atlas instance. Defaults
to https://atlas.hashicorp.com
-upload-modules=true If true (default), then the modules are locked at
their current checkout and uploaded completely. This
prevents Atlas from running "terraform get".

View File

@ -34,6 +34,9 @@ The `path` argument is the same as for the
The command-line flags are all optional. The list of available flags are:
* `-atlas-address=<url>` - An alternate address to an Atlas instance.
Defaults to `https://atlas.hashicorp.com`.
* `-upload-modules=true` - If true (default), then the
[modules](/docs/modules/index.html)
being used are all locked at their current checkout and uploaded