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 { func (c *PushCommand) Run(args []string) int {
var atlasToken string var atlasAddress, atlasToken string
var archiveVCS, moduleUpload bool var archiveVCS, moduleUpload bool
var name string var name string
args = c.Meta.process(args, false) args = c.Meta.process(args, false)
cmdFlags := c.Meta.flagSet("push") cmdFlags := c.Meta.flagSet("push")
cmdFlags.StringVar(&atlasAddress, "atlas-address", "", "")
cmdFlags.StringVar(&c.Meta.statePath, "state", DefaultStateFilename, "path") cmdFlags.StringVar(&c.Meta.statePath, "state", DefaultStateFilename, "path")
cmdFlags.StringVar(&atlasToken, "token", "", "") cmdFlags.StringVar(&atlasToken, "token", "", "")
cmdFlags.BoolVar(&moduleUpload, "upload-modules", true, "") 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 // Initialize it to the default client, we set custom settings later
client := atlas.DefaultClient() 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 != "" { if atlasToken != "" {
client.Token = atlasToken client.Token = atlasToken
@ -185,6 +193,9 @@ Usage: terraform push [options] [DIR]
Options: 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 -upload-modules=true If true (default), then the modules are locked at
their current checkout and uploaded completely. This their current checkout and uploaded completely. This
prevents Atlas from running "terraform get". 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: 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 * `-upload-modules=true` - If true (default), then the
[modules](/docs/modules/index.html) [modules](/docs/modules/index.html)
being used are all locked at their current checkout and uploaded being used are all locked at their current checkout and uploaded