diff --git a/vendor/github.com/hashicorp/atlas-go/archive/archive.go b/vendor/github.com/hashicorp/atlas-go/archive/archive.go index d9232b4f0..0a025b21f 100644 --- a/vendor/github.com/hashicorp/atlas-go/archive/archive.go +++ b/vendor/github.com/hashicorp/atlas-go/archive/archive.go @@ -50,6 +50,12 @@ func (o *ArchiveOpts) IsSet() bool { return len(o.Exclude) > 0 || len(o.Include) > 0 || o.VCS } +// Constants related to setting special values for Extra in ArchiveOpts. +const ( + // ExtraEntryDir just creates the Extra key as a directory entry. + ExtraEntryDir = "" +) + // CreateArchive takes the given path and ArchiveOpts and archives it. // // The archive will be fully completed and put into a temporary file. @@ -419,7 +425,29 @@ func copyConcreteEntry( } func copyExtras(w *tar.Writer, extra map[string]string) error { + var tmpDir string + defer func() { + if tmpDir != "" { + os.RemoveAll(tmpDir) + } + }() + for entry, path := range extra { + // If the path is empty, then we set it to a generic empty directory + if path == "" { + // If tmpDir is still empty, then we create an empty dir + if tmpDir == "" { + td, err := ioutil.TempDir("", "archive") + if err != nil { + return err + } + + tmpDir = td + } + + path = tmpDir + } + info, err := os.Stat(path) if err != nil { return err diff --git a/vendor/github.com/hashicorp/atlas-go/v1/client.go b/vendor/github.com/hashicorp/atlas-go/v1/client.go index 2e61e064b..a38f97eba 100644 --- a/vendor/github.com/hashicorp/atlas-go/v1/client.go +++ b/vendor/github.com/hashicorp/atlas-go/v1/client.go @@ -34,6 +34,11 @@ const ( // load trusted certs from a directory atlasCAPathEnvVar = "ATLAS_CAPATH" + // atlasTLSNoVerifyEnvVar disables TLS verification, similar to curl -k + // This defaults to false (verify) and will change to true (skip + // verification) with any non-empty value + atlasTLSNoVerifyEnvVar = "ATLAS_TLS_NOVERIFY" + // atlasTokenHeader is the header key used for authenticating with Atlas atlasTokenHeader = "X-Atlas-Token" ) @@ -70,6 +75,10 @@ type Client struct { // HTTPClient is the underlying http client with which to make requests. HTTPClient *http.Client + + // DefaultHeaders is a set of headers that will be added to every request. + // This minimally includes the atlas user-agent string. + DefaultHeader http.Header } // DefaultClient returns a client that connects to the Atlas API. @@ -108,10 +117,13 @@ func NewClient(urlString string) (*Client, error) { } client := &Client{ - URL: parsedURL, - Token: token, + URL: parsedURL, + Token: token, + DefaultHeader: make(http.Header), } + client.DefaultHeader.Set("User-Agent", userAgent) + if err := client.init(); err != nil { return nil, err } @@ -123,6 +135,9 @@ func NewClient(urlString string) (*Client, error) { func (c *Client) init() error { c.HTTPClient = cleanhttp.DefaultClient() tlsConfig := &tls.Config{} + if os.Getenv(atlasTLSNoVerifyEnvVar) != "" { + tlsConfig.InsecureSkipVerify = true + } err := rootcerts.ConfigureTLS(tlsConfig, &rootcerts.Config{ CAFile: os.Getenv(atlasCAFileEnvVar), CAPath: os.Getenv(atlasCAPathEnvVar), @@ -227,10 +242,12 @@ func (c *Client) rawRequest(verb string, u *url.URL, ro *RequestOptions) (*http. return nil, err } - // Set the User-Agent - request.Header.Set("User-Agent", userAgent) + // set our default headers first + for k, v := range c.DefaultHeader { + request.Header[k] = v + } - // Add any headers (auth will be here if set) + // Add any request headers (auth will be here if set) for k, v := range ro.Headers { request.Header.Add(k, v) } diff --git a/vendor/github.com/hashicorp/atlas-go/v1/terraform.go b/vendor/github.com/hashicorp/atlas-go/v1/terraform.go index adeba2a11..debd1d319 100644 --- a/vendor/github.com/hashicorp/atlas-go/v1/terraform.go +++ b/vendor/github.com/hashicorp/atlas-go/v1/terraform.go @@ -14,7 +14,16 @@ type TerraformConfigVersion struct { Version int Remotes []string `json:"remotes"` Metadata map[string]string `json:"metadata"` - Variables map[string]string `json:"variables"` + Variables map[string]string `json:"variables,omitempty"` + TFVars []TFVar `json:"tf_vars"` +} + +// TFVar is used to serialize a single Terraform variable sent by the +// manager as a collection of Variables in a Job payload. +type TFVar struct { + Key string `json:"key"` + Value string `json:"value"` + IsHCL bool `json:"hcl"` } // TerraformConfigLatest returns the latest Terraform configuration version. diff --git a/vendor/vendor.json b/vendor/vendor.json index 068f827c9..b572fe0dc 100644 --- a/vendor/vendor.json +++ b/vendor/vendor.json @@ -339,16 +339,18 @@ "revision": "2a60fc2ba6c19de80291203597d752e9ba58e4c0" }, { - "checksumSHA1": "PugKTD0dIXDRlyjtzeimgjT7+ZM=", + "checksumSHA1": "FUiF2WLrih0JdHsUTMMDz3DRokw=", "comment": "20141209094003-92-g95fa852", "path": "github.com/hashicorp/atlas-go/archive", - "revision": "95fa852edca41c06c4ce526af4bb7dec4eaad434" + "revision": "a32da833807becb5b150e125c859e01b707e74ca", + "revisionTime": "2016-10-12T21:43:57Z" }, { - "checksumSHA1": "OylSuPrtMLP6yvPKTx60ptqQO6I=", + "checksumSHA1": "aD7uHoVmfg2T9mpnVZ5dWe6rGtY=", "comment": "20141209094003-92-g95fa852", "path": "github.com/hashicorp/atlas-go/v1", - "revision": "95fa852edca41c06c4ce526af4bb7dec4eaad434" + "revision": "a32da833807becb5b150e125c859e01b707e74ca", + "revisionTime": "2016-10-12T21:43:57Z" }, { "checksumSHA1": "cdOCt0Yb+hdErz8NAQqayxPmRsY=",