diff --git a/command/push.go b/command/push.go index 64bccc767d..1a12a7559d 100644 --- a/command/push.go +++ b/command/push.go @@ -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= 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". diff --git a/website/source/docs/commands/push.html.markdown b/website/source/docs/commands/push.html.markdown index 69378600f7..1a752e657f 100644 --- a/website/source/docs/commands/push.html.markdown +++ b/website/source/docs/commands/push.html.markdown @@ -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=` - 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