├── .gitignore ├── vendor └── github.com │ ├── aws │ └── aws-sdk-go │ │ ├── NOTICE.txt │ │ ├── service │ │ ├── s3 │ │ │ ├── platform_handlers.go │ │ │ ├── platform_handlers_go1.6.go │ │ │ ├── statusok_error.go │ │ │ ├── content_md5.go │ │ │ ├── bucket_location.go │ │ │ ├── sse.go │ │ │ ├── customizations.go │ │ │ └── unmarshal_error.go │ │ └── sts │ │ │ └── customizations.go │ │ ├── aws │ │ ├── version.go │ │ ├── credentials │ │ │ ├── example.ini │ │ │ ├── static_provider.go │ │ │ └── env_provider.go │ │ ├── client │ │ │ └── metadata │ │ │ │ └── client_info.go │ │ ├── errors.go │ │ ├── corehandlers │ │ │ └── param_validator.go │ │ ├── request │ │ │ ├── http_request_1_4.go │ │ │ ├── http_request.go │ │ │ └── offset_reader.go │ │ ├── awsutil │ │ │ ├── equal.go │ │ │ └── string_value.go │ │ └── signer │ │ │ └── v4 │ │ │ └── header_rules.go │ │ └── private │ │ ├── protocol │ │ ├── unmarshal.go │ │ ├── rest │ │ │ └── payload.go │ │ ├── query │ │ │ ├── build.go │ │ │ ├── unmarshal.go │ │ │ └── unmarshal_error.go │ │ └── idempotency.go │ │ └── endpoints │ │ ├── endpoints.json │ │ ├── endpoints_map.go │ │ └── endpoints.go │ ├── hashicorp │ ├── terraform │ │ ├── config │ │ │ ├── module │ │ │ │ ├── module.go │ │ │ │ ├── inode_windows.go │ │ │ │ ├── inode_freebsd.go │ │ │ │ ├── inode.go │ │ │ │ ├── tree_gob.go │ │ │ │ └── get.go │ │ │ ├── resource_mode.go │ │ │ ├── lang.go │ │ │ ├── resource_mode_string.go │ │ │ ├── config_tree.go │ │ │ └── append.go │ │ ├── terraform │ │ │ ├── ui_output.go │ │ │ ├── eval_noop.go │ │ │ ├── ui_output_callback.go │ │ │ ├── graph_interface_subgraph.go │ │ │ ├── instancetype.go │ │ │ ├── eval_resource.go │ │ │ ├── ui_output_mock.go │ │ │ ├── graph_walk_operation.go │ │ │ ├── ui_output_provisioner.go │ │ │ ├── eval_if.go │ │ │ ├── graph_config_node_type.go │ │ │ ├── instancetype_string.go │ │ │ ├── ui_input_prefix.go │ │ │ ├── eval_sequence.go │ │ │ ├── eval_error.go │ │ │ ├── eval_interpolate.go │ │ │ ├── walkoperation_string.go │ │ │ ├── path.go │ │ │ ├── transform_transitive_reduction.go │ │ │ ├── ui_input_mock.go │ │ │ ├── transform.go │ │ │ ├── graphnodeconfigtype_string.go │ │ │ ├── ui_input.go │ │ │ ├── eval_filter.go │ │ │ ├── transform_root.go │ │ │ ├── version.go │ │ │ ├── eval_check_prevent_destroy.go │ │ │ ├── transform_vertex.go │ │ │ ├── graph_walk.go │ │ │ ├── eval_refresh.go │ │ │ ├── eval_provisioner.go │ │ │ ├── eval_filter_operation.go │ │ │ ├── graph_config_node.go │ │ │ ├── resource_provisioner_mock.go │ │ │ ├── resource_provisioner.go │ │ │ ├── transform_module.go │ │ │ ├── eval_count.go │ │ │ ├── util.go │ │ │ ├── transform_proxy.go │ │ │ ├── eval_import_state.go │ │ │ ├── graph_builder_import.go │ │ │ ├── transform_expand.go │ │ │ ├── eval.go │ │ │ ├── context_import.go │ │ │ └── hook_stop.go │ │ ├── dag │ │ │ ├── edge.go │ │ │ └── set.go │ │ ├── dot │ │ │ └── graph_writer.go │ │ ├── helper │ │ │ └── hilmapstructure │ │ │ │ └── hilmapstructure.go │ │ └── flatmap │ │ │ ├── expand.go │ │ │ ├── flatten.go │ │ │ └── map.go │ ├── go-getter │ │ ├── helper │ │ │ └── url │ │ │ │ ├── url_unix.go │ │ │ │ ├── url.go │ │ │ │ └── url_windows.go │ │ ├── get_file.go │ │ ├── appveyor.yml │ │ ├── storage.go │ │ ├── client_mode.go │ │ ├── source.go │ │ ├── get_mock.go │ │ ├── decompress_bzip2.go │ │ ├── decompress.go │ │ ├── decompress_gzip.go │ │ ├── netrc.go │ │ ├── folder_storage.go │ │ ├── detect_file.go │ │ ├── detect_s3.go │ │ ├── copy_dir.go │ │ ├── detect_bitbucket.go │ │ ├── detect_github.go │ │ ├── decompress_tbz2.go │ │ ├── decompress_zip.go │ │ ├── decompress_tgz.go │ │ └── get_file_unix.go │ ├── go-uuid │ │ ├── README.md │ │ └── uuid.go │ ├── hil │ │ ├── ast │ │ │ ├── arithmetic_op.go │ │ │ ├── stack.go │ │ │ ├── literal.go │ │ │ ├── variable_access.go │ │ │ ├── arithmetic.go │ │ │ ├── call.go │ │ │ ├── type_string.go │ │ │ ├── variables_helper.go │ │ │ ├── output.go │ │ │ ├── index.go │ │ │ └── ast.go │ │ ├── eval_type.go │ │ ├── appveyor.yml │ │ ├── evaltype_string.go │ │ ├── transform_fixed.go │ │ ├── parse.go │ │ └── check_identifier.go │ ├── hcl │ │ ├── Makefile │ │ ├── hcl │ │ │ ├── parser │ │ │ │ └── error.go │ │ │ ├── token │ │ │ │ └── position.go │ │ │ └── ast │ │ │ │ └── walk.go │ │ ├── appveyor.yml │ │ ├── hcl.go │ │ ├── lex.go │ │ ├── parse.go │ │ └── json │ │ │ └── token │ │ │ └── position.go │ ├── go-version │ │ ├── version_collection.go │ │ └── README.md │ └── go-multierror │ │ ├── format.go │ │ ├── flatten.go │ │ ├── prefix.go │ │ ├── append.go │ │ └── multierror.go │ ├── jmespath │ └── go-jmespath │ │ ├── README.md │ │ ├── LICENSE │ │ ├── toktype_string.go │ │ ├── astnodetype_string.go │ │ ├── Makefile │ │ └── api.go │ ├── mitchellh │ ├── reflectwalk │ │ ├── location.go │ │ ├── README.md │ │ ├── location_string.go │ │ └── LICENSE │ ├── copystructure │ │ ├── copier_time.go │ │ ├── README.md │ │ └── LICENSE │ ├── go-homedir │ │ ├── README.md │ │ └── LICENSE │ └── mapstructure │ │ ├── LICENSE │ │ ├── error.go │ │ └── README.md │ ├── apparentlymart │ └── go-cidr │ │ ├── cidr │ │ └── wrangling.go │ │ └── LICENSE │ ├── satori │ └── go.uuid │ │ ├── LICENSE │ │ └── README.md │ └── bgentry │ └── go-netrc │ └── LICENSE ├── .circleci └── config.yml ├── LICENSE └── README.md /.gitignore: -------------------------------------------------------------------------------- 1 | *.iml 2 | *.ipr 3 | -------------------------------------------------------------------------------- /vendor/github.com/aws/aws-sdk-go/NOTICE.txt: -------------------------------------------------------------------------------- 1 | AWS SDK for Go 2 | Copyright 2015 Amazon.com, Inc. or its affiliates. All Rights Reserved. 3 | Copyright 2014-2015 Stripe, Inc. 4 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/terraform/config/module/module.go: -------------------------------------------------------------------------------- 1 | package module 2 | 3 | // Module represents the metadata for a single module. 4 | type Module struct { 5 | Name string 6 | Source string 7 | } 8 | -------------------------------------------------------------------------------- /vendor/github.com/aws/aws-sdk-go/service/s3/platform_handlers.go: -------------------------------------------------------------------------------- 1 | // +build !go1.6 2 | 3 | package s3 4 | 5 | import "github.com/aws/aws-sdk-go/aws/request" 6 | 7 | func platformRequestHandlers(r *request.Request) { 8 | } 9 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/terraform/terraform/ui_output.go: -------------------------------------------------------------------------------- 1 | package terraform 2 | 3 | // UIOutput is the interface that must be implemented to output 4 | // data to the end user. 5 | type UIOutput interface { 6 | Output(string) 7 | } 8 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/go-getter/helper/url/url_unix.go: -------------------------------------------------------------------------------- 1 | // +build !windows 2 | 3 | package url 4 | 5 | import ( 6 | "net/url" 7 | ) 8 | 9 | func parse(rawURL string) (*url.URL, error) { 10 | return url.Parse(rawURL) 11 | } 12 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/terraform/config/module/inode_windows.go: -------------------------------------------------------------------------------- 1 | // +build windows 2 | 3 | package module 4 | 5 | // no syscall.Stat_t on windows, return 0 for inodes 6 | func inode(path string) (uint64, error) { 7 | return 0, nil 8 | } 9 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/terraform/terraform/eval_noop.go: -------------------------------------------------------------------------------- 1 | package terraform 2 | 3 | // EvalNoop is an EvalNode that does nothing. 4 | type EvalNoop struct{} 5 | 6 | func (EvalNoop) Eval(EvalContext) (interface{}, error) { 7 | return nil, nil 8 | } 9 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/terraform/terraform/ui_output_callback.go: -------------------------------------------------------------------------------- 1 | package terraform 2 | 3 | type CallbackUIOutput struct { 4 | OutputFn func(string) 5 | } 6 | 7 | func (o *CallbackUIOutput) Output(v string) { 8 | o.OutputFn(v) 9 | } 10 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/go-uuid/README.md: -------------------------------------------------------------------------------- 1 | # uuid 2 | 3 | Generates UUID-format strings using purely high quality random bytes. 4 | 5 | Documentation 6 | ============= 7 | 8 | The full documentation is available on [Godoc](http://godoc.org/github.com/hashicorp/go-uuid). 9 | -------------------------------------------------------------------------------- /vendor/github.com/jmespath/go-jmespath/README.md: -------------------------------------------------------------------------------- 1 | # go-jmespath - A JMESPath implementation in Go 2 | 3 | [![Build Status](https://img.shields.io/travis/jmespath/go-jmespath.svg)](https://travis-ci.org/jmespath/go-jmespath) 4 | 5 | 6 | 7 | See http://jmespath.org for more info. 8 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/go-getter/get_file.go: -------------------------------------------------------------------------------- 1 | package getter 2 | 3 | // FileGetter is a Getter implementation that will download a module from 4 | // a file scheme. 5 | type FileGetter struct { 6 | // Copy, if set to true, will copy data instead of using a symlink 7 | Copy bool 8 | } 9 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/terraform/config/resource_mode.go: -------------------------------------------------------------------------------- 1 | package config 2 | 3 | //go:generate stringer -type=ResourceMode -output=resource_mode_string.go resource_mode.go 4 | type ResourceMode int 5 | 6 | const ( 7 | ManagedResourceMode ResourceMode = iota 8 | DataResourceMode 9 | ) 10 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/terraform/terraform/graph_interface_subgraph.go: -------------------------------------------------------------------------------- 1 | package terraform 2 | 3 | // GraphNodeSubPath says that a node is part of a graph with a 4 | // different path, and the context should be adjusted accordingly. 5 | type GraphNodeSubPath interface { 6 | Path() []string 7 | } 8 | -------------------------------------------------------------------------------- /vendor/github.com/aws/aws-sdk-go/aws/version.go: -------------------------------------------------------------------------------- 1 | // Package aws provides core functionality for making requests to AWS services. 2 | package aws 3 | 4 | // SDKName is the name of this AWS SDK 5 | const SDKName = "aws-sdk-go" 6 | 7 | // SDKVersion is the version of this SDK 8 | const SDKVersion = "1.4.10" 9 | -------------------------------------------------------------------------------- /vendor/github.com/mitchellh/reflectwalk/location.go: -------------------------------------------------------------------------------- 1 | package reflectwalk 2 | 3 | //go:generate stringer -type=Location location.go 4 | 5 | type Location uint 6 | 7 | const ( 8 | None Location = iota 9 | Map 10 | MapKey 11 | MapValue 12 | Slice 13 | SliceElem 14 | Struct 15 | StructField 16 | WalkLoc 17 | ) 18 | -------------------------------------------------------------------------------- /vendor/github.com/mitchellh/reflectwalk/README.md: -------------------------------------------------------------------------------- 1 | # reflectwalk 2 | 3 | reflectwalk is a Go library for "walking" a value in Go using reflection, 4 | in the same way a directory tree can be "walked" on the filesystem. Walking 5 | a complex structure can allow you to do manipulations on unknown structures 6 | such as those decoded from JSON. 7 | -------------------------------------------------------------------------------- /vendor/github.com/mitchellh/copystructure/copier_time.go: -------------------------------------------------------------------------------- 1 | package copystructure 2 | 3 | import ( 4 | "reflect" 5 | "time" 6 | ) 7 | 8 | func init() { 9 | Copiers[reflect.TypeOf(time.Time{})] = timeCopier 10 | } 11 | 12 | func timeCopier(v interface{}) (interface{}, error) { 13 | // Just... copy it. 14 | return v.(time.Time), nil 15 | } 16 | -------------------------------------------------------------------------------- /vendor/github.com/aws/aws-sdk-go/aws/credentials/example.ini: -------------------------------------------------------------------------------- 1 | [default] 2 | aws_access_key_id = accessKey 3 | aws_secret_access_key = secret 4 | aws_session_token = token 5 | 6 | [no_token] 7 | aws_access_key_id = accessKey 8 | aws_secret_access_key = secret 9 | 10 | [with_colon] 11 | aws_access_key_id: accessKey 12 | aws_secret_access_key: secret 13 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/hil/ast/arithmetic_op.go: -------------------------------------------------------------------------------- 1 | package ast 2 | 3 | // ArithmeticOp is the operation to use for the math. 4 | type ArithmeticOp int 5 | 6 | const ( 7 | ArithmeticOpInvalid ArithmeticOp = 0 8 | ArithmeticOpAdd ArithmeticOp = iota 9 | ArithmeticOpSub 10 | ArithmeticOpMul 11 | ArithmeticOpDiv 12 | ArithmeticOpMod 13 | ) 14 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/hil/eval_type.go: -------------------------------------------------------------------------------- 1 | package hil 2 | 3 | //go:generate stringer -type=EvalType eval_type.go 4 | 5 | // EvalType represents the type of the output returned from a HIL 6 | // evaluation. 7 | type EvalType uint32 8 | 9 | const ( 10 | TypeInvalid EvalType = 0 11 | TypeString EvalType = 1 << iota 12 | TypeList 13 | TypeMap 14 | ) 15 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/terraform/terraform/instancetype.go: -------------------------------------------------------------------------------- 1 | package terraform 2 | 3 | //go:generate stringer -type=InstanceType instancetype.go 4 | 5 | // InstanceType is an enum of the various types of instances store in the State 6 | type InstanceType int 7 | 8 | const ( 9 | TypeInvalid InstanceType = iota 10 | TypePrimary 11 | TypeTainted 12 | TypeDeposed 13 | ) 14 | -------------------------------------------------------------------------------- /vendor/github.com/aws/aws-sdk-go/aws/client/metadata/client_info.go: -------------------------------------------------------------------------------- 1 | package metadata 2 | 3 | // ClientInfo wraps immutable data from the client.Client structure. 4 | type ClientInfo struct { 5 | ServiceName string 6 | APIVersion string 7 | Endpoint string 8 | SigningName string 9 | SigningRegion string 10 | JSONVersion string 11 | TargetPrefix string 12 | } 13 | -------------------------------------------------------------------------------- /vendor/github.com/aws/aws-sdk-go/service/sts/customizations.go: -------------------------------------------------------------------------------- 1 | package sts 2 | 3 | import "github.com/aws/aws-sdk-go/aws/request" 4 | 5 | func init() { 6 | initRequest = func(r *request.Request) { 7 | switch r.Operation.Name { 8 | case opAssumeRoleWithSAML, opAssumeRoleWithWebIdentity: 9 | r.Handlers.Sign.Clear() // these operations are unsigned 10 | } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/hcl/Makefile: -------------------------------------------------------------------------------- 1 | TEST?=./... 2 | 3 | default: test 4 | 5 | fmt: generate 6 | go fmt ./... 7 | 8 | test: generate 9 | go get -t ./... 10 | go test $(TEST) $(TESTARGS) 11 | 12 | generate: 13 | go generate ./... 14 | 15 | updatedeps: 16 | go get -u golang.org/x/tools/cmd/stringer 17 | 18 | .PHONY: default generate test updatedeps 19 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/hcl/hcl/parser/error.go: -------------------------------------------------------------------------------- 1 | package parser 2 | 3 | import ( 4 | "fmt" 5 | 6 | "github.com/hashicorp/hcl/hcl/token" 7 | ) 8 | 9 | // PosError is a parse error that contains a position. 10 | type PosError struct { 11 | Pos token.Pos 12 | Err error 13 | } 14 | 15 | func (e *PosError) Error() string { 16 | return fmt.Sprintf("At %s: %s", e.Pos, e.Err) 17 | } 18 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/go-getter/appveyor.yml: -------------------------------------------------------------------------------- 1 | version: "build-{branch}-{build}" 2 | image: Visual Studio 2015 3 | clone_folder: c:\gopath\github.com\hashicorp\go-getter 4 | environment: 5 | GOPATH: c:\gopath 6 | install: 7 | - cmd: >- 8 | echo %Path% 9 | 10 | go version 11 | 12 | go env 13 | 14 | go get -d -v -t ./... 15 | build_script: 16 | - cmd: go test -v ./... 17 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/terraform/config/lang.go: -------------------------------------------------------------------------------- 1 | package config 2 | 3 | import ( 4 | "github.com/hashicorp/hil/ast" 5 | ) 6 | 7 | type noopNode struct{} 8 | 9 | func (n *noopNode) Accept(ast.Visitor) ast.Node { return n } 10 | func (n *noopNode) Pos() ast.Pos { return ast.Pos{} } 11 | func (n *noopNode) Type(ast.Scope) (ast.Type, error) { return ast.TypeString, nil } 12 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/terraform/terraform/eval_resource.go: -------------------------------------------------------------------------------- 1 | package terraform 2 | 3 | // EvalInstanceInfo is an EvalNode implementation that fills in the 4 | // InstanceInfo as much as it can. 5 | type EvalInstanceInfo struct { 6 | Info *InstanceInfo 7 | } 8 | 9 | // TODO: test 10 | func (n *EvalInstanceInfo) Eval(ctx EvalContext) (interface{}, error) { 11 | n.Info.ModulePath = ctx.Path() 12 | return nil, nil 13 | } 14 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/go-getter/helper/url/url.go: -------------------------------------------------------------------------------- 1 | package url 2 | 3 | import ( 4 | "net/url" 5 | ) 6 | 7 | // Parse parses rawURL into a URL structure. 8 | // The rawURL may be relative or absolute. 9 | // 10 | // Parse is a wrapper for the Go stdlib net/url Parse function, but returns 11 | // Windows "safe" URLs on Windows platforms. 12 | func Parse(rawURL string) (*url.URL, error) { 13 | return parse(rawURL) 14 | } 15 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/hcl/appveyor.yml: -------------------------------------------------------------------------------- 1 | version: "build-{branch}-{build}" 2 | image: Visual Studio 2015 3 | clone_folder: c:\gopath\src\github.com\hashicorp\hcl 4 | environment: 5 | GOPATH: c:\gopath 6 | init: 7 | - git config --global core.autocrlf true 8 | install: 9 | - cmd: >- 10 | echo %Path% 11 | 12 | go version 13 | 14 | go env 15 | 16 | go get -t ./... 17 | 18 | build_script: 19 | - cmd: go test -v ./... 20 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/hil/appveyor.yml: -------------------------------------------------------------------------------- 1 | version: "build-{branch}-{build}" 2 | image: Visual Studio 2015 3 | clone_folder: c:\gopath\src\github.com\hashicorp\hil 4 | environment: 5 | GOPATH: c:\gopath 6 | init: 7 | - git config --global core.autocrlf true 8 | install: 9 | - cmd: >- 10 | echo %Path% 11 | 12 | go version 13 | 14 | go env 15 | 16 | go get -d -v -t ./... 17 | build_script: 18 | - cmd: go test -v ./... 19 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/terraform/terraform/ui_output_mock.go: -------------------------------------------------------------------------------- 1 | package terraform 2 | 3 | // MockUIOutput is an implementation of UIOutput that can be used for tests. 4 | type MockUIOutput struct { 5 | OutputCalled bool 6 | OutputMessage string 7 | OutputFn func(string) 8 | } 9 | 10 | func (o *MockUIOutput) Output(v string) { 11 | o.OutputCalled = true 12 | o.OutputMessage = v 13 | if o.OutputFn != nil { 14 | o.OutputFn(v) 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/go-version/version_collection.go: -------------------------------------------------------------------------------- 1 | package version 2 | 3 | // Collection is a type that implements the sort.Interface interface 4 | // so that versions can be sorted. 5 | type Collection []*Version 6 | 7 | func (v Collection) Len() int { 8 | return len(v) 9 | } 10 | 11 | func (v Collection) Less(i, j int) bool { 12 | return v[i].LessThan(v[j]) 13 | } 14 | 15 | func (v Collection) Swap(i, j int) { 16 | v[i], v[j] = v[j], v[i] 17 | } 18 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/terraform/terraform/graph_walk_operation.go: -------------------------------------------------------------------------------- 1 | package terraform 2 | 3 | //go:generate stringer -type=walkOperation graph_walk_operation.go 4 | 5 | // walkOperation is an enum which tells the walkContext what to do. 6 | type walkOperation byte 7 | 8 | const ( 9 | walkInvalid walkOperation = iota 10 | walkInput 11 | walkApply 12 | walkPlan 13 | walkPlanDestroy 14 | walkRefresh 15 | walkValidate 16 | walkDestroy 17 | walkImport 18 | ) 19 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/terraform/terraform/ui_output_provisioner.go: -------------------------------------------------------------------------------- 1 | package terraform 2 | 3 | // ProvisionerUIOutput is an implementation of UIOutput that calls a hook 4 | // for the output so that the hooks can handle it. 5 | type ProvisionerUIOutput struct { 6 | Info *InstanceInfo 7 | Type string 8 | Hooks []Hook 9 | } 10 | 11 | func (o *ProvisionerUIOutput) Output(msg string) { 12 | for _, h := range o.Hooks { 13 | h.ProvisionOutput(o.Info, o.Type, msg) 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/terraform/config/module/inode_freebsd.go: -------------------------------------------------------------------------------- 1 | // +build freebsd 2 | 3 | package module 4 | 5 | import ( 6 | "fmt" 7 | "os" 8 | "syscall" 9 | ) 10 | 11 | // lookup the inode of a file on posix systems 12 | func inode(path string) (uint64, error) { 13 | stat, err := os.Stat(path) 14 | if err != nil { 15 | return 0, err 16 | } 17 | if st, ok := stat.Sys().(*syscall.Stat_t); ok { 18 | return uint64(st.Ino), nil 19 | } 20 | return 0, fmt.Errorf("could not determine file inode") 21 | } 22 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/terraform/config/module/inode.go: -------------------------------------------------------------------------------- 1 | // +build linux darwin openbsd solaris 2 | 3 | package module 4 | 5 | import ( 6 | "fmt" 7 | "os" 8 | "syscall" 9 | ) 10 | 11 | // lookup the inode of a file on posix systems 12 | func inode(path string) (uint64, error) { 13 | stat, err := os.Stat(path) 14 | if err != nil { 15 | return 0, err 16 | } 17 | if st, ok := stat.Sys().(*syscall.Stat_t); ok { 18 | return st.Ino, nil 19 | } 20 | return 0, fmt.Errorf("could not determine file inode") 21 | } 22 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/hil/ast/stack.go: -------------------------------------------------------------------------------- 1 | package ast 2 | 3 | // Stack is a stack of Node. 4 | type Stack struct { 5 | stack []Node 6 | } 7 | 8 | func (s *Stack) Len() int { 9 | return len(s.stack) 10 | } 11 | 12 | func (s *Stack) Push(n Node) { 13 | s.stack = append(s.stack, n) 14 | } 15 | 16 | func (s *Stack) Pop() Node { 17 | x := s.stack[len(s.stack)-1] 18 | s.stack[len(s.stack)-1] = nil 19 | s.stack = s.stack[:len(s.stack)-1] 20 | return x 21 | } 22 | 23 | func (s *Stack) Reset() { 24 | s.stack = nil 25 | } 26 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/go-getter/storage.go: -------------------------------------------------------------------------------- 1 | package getter 2 | 3 | // Storage is an interface that knows how to lookup downloaded directories 4 | // as well as download and update directories from their sources into the 5 | // proper location. 6 | type Storage interface { 7 | // Dir returns the directory on local disk where the directory source 8 | // can be loaded from. 9 | Dir(string) (string, bool, error) 10 | 11 | // Get will download and optionally update the given directory. 12 | Get(string, string, bool) error 13 | } 14 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/hcl/hcl.go: -------------------------------------------------------------------------------- 1 | // Package hcl decodes HCL into usable Go structures. 2 | // 3 | // hcl input can come in either pure HCL format or JSON format. 4 | // It can be parsed into an AST, and then decoded into a structure, 5 | // or it can be decoded directly from a string into a structure. 6 | // 7 | // If you choose to parse HCL into a raw AST, the benefit is that you 8 | // can write custom visitor implementations to implement custom 9 | // semantic checks. By default, HCL does not perform any semantic 10 | // checks. 11 | package hcl 12 | -------------------------------------------------------------------------------- /vendor/github.com/mitchellh/reflectwalk/location_string.go: -------------------------------------------------------------------------------- 1 | // generated by stringer -type=Location location.go; DO NOT EDIT 2 | 3 | package reflectwalk 4 | 5 | import "fmt" 6 | 7 | const _Location_name = "NoneMapMapKeyMapValueSliceSliceElemStructStructFieldWalkLoc" 8 | 9 | var _Location_index = [...]uint8{0, 4, 7, 13, 21, 26, 35, 41, 52, 59} 10 | 11 | func (i Location) String() string { 12 | if i+1 >= Location(len(_Location_index)) { 13 | return fmt.Sprintf("Location(%d)", i) 14 | } 15 | return _Location_name[_Location_index[i]:_Location_index[i+1]] 16 | } 17 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/terraform/terraform/eval_if.go: -------------------------------------------------------------------------------- 1 | package terraform 2 | 3 | // EvalIf is an EvalNode that is a conditional. 4 | type EvalIf struct { 5 | If func(EvalContext) (bool, error) 6 | Then EvalNode 7 | Else EvalNode 8 | } 9 | 10 | // TODO: test 11 | func (n *EvalIf) Eval(ctx EvalContext) (interface{}, error) { 12 | yes, err := n.If(ctx) 13 | if err != nil { 14 | return nil, err 15 | } 16 | 17 | if yes { 18 | return EvalRaw(n.Then, ctx) 19 | } else { 20 | if n.Else != nil { 21 | return EvalRaw(n.Else, ctx) 22 | } 23 | } 24 | 25 | return nil, nil 26 | } 27 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/terraform/terraform/graph_config_node_type.go: -------------------------------------------------------------------------------- 1 | package terraform 2 | 3 | //go:generate stringer -type=GraphNodeConfigType graph_config_node_type.go 4 | 5 | // GraphNodeConfigType is an enum for the type of thing that a graph 6 | // node represents from the configuration. 7 | type GraphNodeConfigType int 8 | 9 | const ( 10 | GraphNodeConfigTypeInvalid GraphNodeConfigType = 0 11 | GraphNodeConfigTypeResource GraphNodeConfigType = iota 12 | GraphNodeConfigTypeProvider 13 | GraphNodeConfigTypeModule 14 | GraphNodeConfigTypeOutput 15 | GraphNodeConfigTypeVariable 16 | ) 17 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/terraform/terraform/instancetype_string.go: -------------------------------------------------------------------------------- 1 | // Code generated by "stringer -type=InstanceType instancetype.go"; DO NOT EDIT 2 | 3 | package terraform 4 | 5 | import "fmt" 6 | 7 | const _InstanceType_name = "TypeInvalidTypePrimaryTypeTaintedTypeDeposed" 8 | 9 | var _InstanceType_index = [...]uint8{0, 11, 22, 33, 44} 10 | 11 | func (i InstanceType) String() string { 12 | if i < 0 || i >= InstanceType(len(_InstanceType_index)-1) { 13 | return fmt.Sprintf("InstanceType(%d)", i) 14 | } 15 | return _InstanceType_name[_InstanceType_index[i]:_InstanceType_index[i+1]] 16 | } 17 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/terraform/terraform/ui_input_prefix.go: -------------------------------------------------------------------------------- 1 | package terraform 2 | 3 | import ( 4 | "fmt" 5 | ) 6 | 7 | // PrefixUIInput is an implementation of UIInput that prefixes the ID 8 | // with a string, allowing queries to be namespaced. 9 | type PrefixUIInput struct { 10 | IdPrefix string 11 | QueryPrefix string 12 | UIInput UIInput 13 | } 14 | 15 | func (i *PrefixUIInput) Input(opts *InputOpts) (string, error) { 16 | opts.Id = fmt.Sprintf("%s.%s", i.IdPrefix, opts.Id) 17 | opts.Query = fmt.Sprintf("%s%s", i.QueryPrefix, opts.Query) 18 | return i.UIInput.Input(opts) 19 | } 20 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/terraform/config/resource_mode_string.go: -------------------------------------------------------------------------------- 1 | // Code generated by "stringer -type=ResourceMode -output=resource_mode_string.go resource_mode.go"; DO NOT EDIT 2 | 3 | package config 4 | 5 | import "fmt" 6 | 7 | const _ResourceMode_name = "ManagedResourceModeDataResourceMode" 8 | 9 | var _ResourceMode_index = [...]uint8{0, 19, 35} 10 | 11 | func (i ResourceMode) String() string { 12 | if i < 0 || i >= ResourceMode(len(_ResourceMode_index)-1) { 13 | return fmt.Sprintf("ResourceMode(%d)", i) 14 | } 15 | return _ResourceMode_name[_ResourceMode_index[i]:_ResourceMode_index[i+1]] 16 | } 17 | -------------------------------------------------------------------------------- /vendor/github.com/aws/aws-sdk-go/aws/errors.go: -------------------------------------------------------------------------------- 1 | package aws 2 | 3 | import "github.com/aws/aws-sdk-go/aws/awserr" 4 | 5 | var ( 6 | // ErrMissingRegion is an error that is returned if region configuration is 7 | // not found. 8 | // 9 | // @readonly 10 | ErrMissingRegion = awserr.New("MissingRegion", "could not find region configuration", nil) 11 | 12 | // ErrMissingEndpoint is an error that is returned if an endpoint cannot be 13 | // resolved for a service. 14 | // 15 | // @readonly 16 | ErrMissingEndpoint = awserr.New("MissingEndpoint", "'Endpoint' configuration is required for this service", nil) 17 | ) 18 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/terraform/terraform/eval_sequence.go: -------------------------------------------------------------------------------- 1 | package terraform 2 | 3 | // EvalSequence is an EvalNode that evaluates in sequence. 4 | type EvalSequence struct { 5 | Nodes []EvalNode 6 | } 7 | 8 | func (n *EvalSequence) Eval(ctx EvalContext) (interface{}, error) { 9 | for _, n := range n.Nodes { 10 | if _, err := EvalRaw(n, ctx); err != nil { 11 | return nil, err 12 | } 13 | } 14 | 15 | return nil, nil 16 | } 17 | 18 | // EvalNodeFilterable impl. 19 | func (n *EvalSequence) Filter(fn EvalNodeFilterFunc) { 20 | for i, node := range n.Nodes { 21 | n.Nodes[i] = fn(node) 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /vendor/github.com/aws/aws-sdk-go/aws/corehandlers/param_validator.go: -------------------------------------------------------------------------------- 1 | package corehandlers 2 | 3 | import "github.com/aws/aws-sdk-go/aws/request" 4 | 5 | // ValidateParametersHandler is a request handler to validate the input parameters. 6 | // Validating parameters only has meaning if done prior to the request being sent. 7 | var ValidateParametersHandler = request.NamedHandler{Name: "core.ValidateParametersHandler", Fn: func(r *request.Request) { 8 | if !r.ParamsFilled() { 9 | return 10 | } 11 | 12 | if v, ok := r.Params.(request.Validator); ok { 13 | if err := v.Validate(); err != nil { 14 | r.Error = err 15 | } 16 | } 17 | }} 18 | -------------------------------------------------------------------------------- /vendor/github.com/jmespath/go-jmespath/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright 2015 James Saryerwinnie 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | -------------------------------------------------------------------------------- /vendor/github.com/mitchellh/copystructure/README.md: -------------------------------------------------------------------------------- 1 | # copystructure 2 | 3 | copystructure is a Go library for deep copying values in Go. 4 | 5 | This allows you to copy Go values that may contain reference values 6 | such as maps, slices, or pointers, and copy their data as well instead 7 | of just their references. 8 | 9 | ## Installation 10 | 11 | Standard `go get`: 12 | 13 | ``` 14 | $ go get github.com/mitchellh/copystructure 15 | ``` 16 | 17 | ## Usage & Example 18 | 19 | For usage and examples see the [Godoc](http://godoc.org/github.com/mitchellh/copystructure). 20 | 21 | The `Copy` function has examples associated with it there. 22 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/terraform/terraform/eval_error.go: -------------------------------------------------------------------------------- 1 | package terraform 2 | 3 | // EvalReturnError is an EvalNode implementation that returns an 4 | // error if it is present. 5 | // 6 | // This is useful for scenarios where an error has been captured by 7 | // another EvalNode (like EvalApply) for special EvalTree-based error 8 | // handling, and that handling has completed, so the error should be 9 | // returned normally. 10 | type EvalReturnError struct { 11 | Error *error 12 | } 13 | 14 | func (n *EvalReturnError) Eval(ctx EvalContext) (interface{}, error) { 15 | if n.Error == nil { 16 | return nil, nil 17 | } 18 | 19 | return nil, *n.Error 20 | } 21 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/terraform/terraform/eval_interpolate.go: -------------------------------------------------------------------------------- 1 | package terraform 2 | 3 | import "github.com/hashicorp/terraform/config" 4 | 5 | // EvalInterpolate is an EvalNode implementation that takes a raw 6 | // configuration and interpolates it. 7 | type EvalInterpolate struct { 8 | Config *config.RawConfig 9 | Resource *Resource 10 | Output **ResourceConfig 11 | } 12 | 13 | func (n *EvalInterpolate) Eval(ctx EvalContext) (interface{}, error) { 14 | rc, err := ctx.Interpolate(n.Config, n.Resource) 15 | if err != nil { 16 | return nil, err 17 | } 18 | 19 | if n.Output != nil { 20 | *n.Output = rc 21 | } 22 | 23 | return nil, nil 24 | } 25 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/terraform/terraform/walkoperation_string.go: -------------------------------------------------------------------------------- 1 | // Code generated by "stringer -type=walkOperation graph_walk_operation.go"; DO NOT EDIT 2 | 3 | package terraform 4 | 5 | import "fmt" 6 | 7 | const _walkOperation_name = "walkInvalidwalkInputwalkApplywalkPlanwalkPlanDestroywalkRefreshwalkValidatewalkDestroywalkImport" 8 | 9 | var _walkOperation_index = [...]uint8{0, 11, 20, 29, 37, 52, 63, 75, 86, 96} 10 | 11 | func (i walkOperation) String() string { 12 | if i >= walkOperation(len(_walkOperation_index)-1) { 13 | return fmt.Sprintf("walkOperation(%d)", i) 14 | } 15 | return _walkOperation_name[_walkOperation_index[i]:_walkOperation_index[i+1]] 16 | } 17 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/hcl/lex.go: -------------------------------------------------------------------------------- 1 | package hcl 2 | 3 | import ( 4 | "unicode" 5 | "unicode/utf8" 6 | ) 7 | 8 | type lexModeValue byte 9 | 10 | const ( 11 | lexModeUnknown lexModeValue = iota 12 | lexModeHcl 13 | lexModeJson 14 | ) 15 | 16 | // lexMode returns whether we're going to be parsing in JSON 17 | // mode or HCL mode. 18 | func lexMode(v []byte) lexModeValue { 19 | var ( 20 | r rune 21 | w int 22 | offset int 23 | ) 24 | 25 | for { 26 | r, w = utf8.DecodeRune(v[offset:]) 27 | offset += w 28 | if unicode.IsSpace(r) { 29 | continue 30 | } 31 | if r == '{' { 32 | return lexModeJson 33 | } 34 | break 35 | } 36 | 37 | return lexModeHcl 38 | } 39 | -------------------------------------------------------------------------------- /vendor/github.com/aws/aws-sdk-go/aws/request/http_request_1_4.go: -------------------------------------------------------------------------------- 1 | // +build !go1.5 2 | 3 | package request 4 | 5 | import ( 6 | "io" 7 | "net/http" 8 | "net/url" 9 | ) 10 | 11 | func copyHTTPRequest(r *http.Request, body io.ReadCloser) *http.Request { 12 | req := &http.Request{ 13 | URL: &url.URL{}, 14 | Header: http.Header{}, 15 | Close: r.Close, 16 | Body: body, 17 | Host: r.Host, 18 | Method: r.Method, 19 | Proto: r.Proto, 20 | ContentLength: r.ContentLength, 21 | } 22 | 23 | *req.URL = *r.URL 24 | for k, v := range r.Header { 25 | for _, vv := range v { 26 | req.Header.Add(k, vv) 27 | } 28 | } 29 | 30 | return req 31 | } 32 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/go-multierror/format.go: -------------------------------------------------------------------------------- 1 | package multierror 2 | 3 | import ( 4 | "fmt" 5 | "strings" 6 | ) 7 | 8 | // ErrorFormatFunc is a function callback that is called by Error to 9 | // turn the list of errors into a string. 10 | type ErrorFormatFunc func([]error) string 11 | 12 | // ListFormatFunc is a basic formatter that outputs the number of errors 13 | // that occurred along with a bullet point list of the errors. 14 | func ListFormatFunc(es []error) string { 15 | points := make([]string, len(es)) 16 | for i, err := range es { 17 | points[i] = fmt.Sprintf("* %s", err) 18 | } 19 | 20 | return fmt.Sprintf( 21 | "%d error(s) occurred:\n\n%s", 22 | len(es), strings.Join(points, "\n")) 23 | } 24 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/go-multierror/flatten.go: -------------------------------------------------------------------------------- 1 | package multierror 2 | 3 | // Flatten flattens the given error, merging any *Errors together into 4 | // a single *Error. 5 | func Flatten(err error) error { 6 | // If it isn't an *Error, just return the error as-is 7 | if _, ok := err.(*Error); !ok { 8 | return err 9 | } 10 | 11 | // Otherwise, make the result and flatten away! 12 | flatErr := new(Error) 13 | flatten(err, flatErr) 14 | return flatErr 15 | } 16 | 17 | func flatten(err error, flatErr *Error) { 18 | switch err := err.(type) { 19 | case *Error: 20 | for _, e := range err.Errors { 21 | flatten(e, flatErr) 22 | } 23 | default: 24 | flatErr.Errors = append(flatErr.Errors, err) 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/terraform/terraform/path.go: -------------------------------------------------------------------------------- 1 | package terraform 2 | 3 | import ( 4 | "crypto/md5" 5 | "encoding/hex" 6 | ) 7 | 8 | // PathCacheKey returns a cache key for a module path. 9 | // 10 | // TODO: test 11 | func PathCacheKey(path []string) string { 12 | // There is probably a better way to do this, but this is working for now. 13 | // We just create an MD5 hash of all the MD5 hashes of all the path 14 | // elements. This gets us the property that it is unique per ordering. 15 | hash := md5.New() 16 | for _, p := range path { 17 | single := md5.Sum([]byte(p)) 18 | if _, err := hash.Write(single[:]); err != nil { 19 | panic(err) 20 | } 21 | } 22 | 23 | return hex.EncodeToString(hash.Sum(nil)) 24 | } 25 | -------------------------------------------------------------------------------- /vendor/github.com/aws/aws-sdk-go/private/protocol/unmarshal.go: -------------------------------------------------------------------------------- 1 | package protocol 2 | 3 | import ( 4 | "io" 5 | "io/ioutil" 6 | 7 | "github.com/aws/aws-sdk-go/aws/request" 8 | ) 9 | 10 | // UnmarshalDiscardBodyHandler is a named request handler to empty and close a response's body 11 | var UnmarshalDiscardBodyHandler = request.NamedHandler{Name: "awssdk.shared.UnmarshalDiscardBody", Fn: UnmarshalDiscardBody} 12 | 13 | // UnmarshalDiscardBody is a request handler to empty a response's body and closing it. 14 | func UnmarshalDiscardBody(r *request.Request) { 15 | if r.HTTPResponse == nil || r.HTTPResponse.Body == nil { 16 | return 17 | } 18 | 19 | io.Copy(ioutil.Discard, r.HTTPResponse.Body) 20 | r.HTTPResponse.Body.Close() 21 | } 22 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/terraform/terraform/transform_transitive_reduction.go: -------------------------------------------------------------------------------- 1 | package terraform 2 | 3 | // TransitiveReductionTransformer is a GraphTransformer that performs 4 | // finds the transitive reduction of the graph. For a definition of 5 | // transitive reduction, see Wikipedia. 6 | type TransitiveReductionTransformer struct{} 7 | 8 | func (t *TransitiveReductionTransformer) Transform(g *Graph) error { 9 | // If the graph isn't valid, skip the transitive reduction. 10 | // We don't error here because Terraform itself handles graph 11 | // validation in a better way, or we assume it does. 12 | if err := g.Validate(); err != nil { 13 | return nil 14 | } 15 | 16 | // Do it 17 | g.TransitiveReduction() 18 | 19 | return nil 20 | } 21 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/terraform/terraform/ui_input_mock.go: -------------------------------------------------------------------------------- 1 | package terraform 2 | 3 | // MockUIInput is an implementation of UIInput that can be used for tests. 4 | type MockUIInput struct { 5 | InputCalled bool 6 | InputOpts *InputOpts 7 | InputReturnMap map[string]string 8 | InputReturnString string 9 | InputReturnError error 10 | InputFn func(*InputOpts) (string, error) 11 | } 12 | 13 | func (i *MockUIInput) Input(opts *InputOpts) (string, error) { 14 | i.InputCalled = true 15 | i.InputOpts = opts 16 | if i.InputFn != nil { 17 | return i.InputFn(opts) 18 | } 19 | if i.InputReturnMap != nil { 20 | return i.InputReturnMap[opts.Id], i.InputReturnError 21 | } 22 | return i.InputReturnString, i.InputReturnError 23 | } 24 | -------------------------------------------------------------------------------- /vendor/github.com/mitchellh/go-homedir/README.md: -------------------------------------------------------------------------------- 1 | # go-homedir 2 | 3 | This is a Go library for detecting the user's home directory without 4 | the use of cgo, so the library can be used in cross-compilation environments. 5 | 6 | Usage is incredibly simple, just call `homedir.Dir()` to get the home directory 7 | for a user, and `homedir.Expand()` to expand the `~` in a path to the home 8 | directory. 9 | 10 | **Why not just use `os/user`?** The built-in `os/user` package requires 11 | cgo on Darwin systems. This means that any Go code that uses that package 12 | cannot cross compile. But 99% of the time the use for `os/user` is just to 13 | retrieve the home directory, which we can do for the current user without 14 | cgo. This library does that, enabling cross-compilation. 15 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/terraform/terraform/transform.go: -------------------------------------------------------------------------------- 1 | package terraform 2 | 3 | import ( 4 | "github.com/hashicorp/terraform/dag" 5 | ) 6 | 7 | // GraphTransformer is the interface that transformers implement. This 8 | // interface is only for transforms that need entire graph visibility. 9 | type GraphTransformer interface { 10 | Transform(*Graph) error 11 | } 12 | 13 | // GraphVertexTransformer is an interface that transforms a single 14 | // Vertex within with graph. This is a specialization of GraphTransformer 15 | // that makes it easy to do vertex replacement. 16 | // 17 | // The GraphTransformer that runs through the GraphVertexTransformers is 18 | // VertexTransformer. 19 | type GraphVertexTransformer interface { 20 | Transform(dag.Vertex) (dag.Vertex, error) 21 | } 22 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/hil/ast/literal.go: -------------------------------------------------------------------------------- 1 | package ast 2 | 3 | import ( 4 | "fmt" 5 | ) 6 | 7 | // LiteralNode represents a single literal value, such as "foo" or 8 | // 42 or 3.14159. Based on the Type, the Value can be safely cast. 9 | type LiteralNode struct { 10 | Value interface{} 11 | Typex Type 12 | Posx Pos 13 | } 14 | 15 | func (n *LiteralNode) Accept(v Visitor) Node { 16 | return v(n) 17 | } 18 | 19 | func (n *LiteralNode) Pos() Pos { 20 | return n.Posx 21 | } 22 | 23 | func (n *LiteralNode) GoString() string { 24 | return fmt.Sprintf("*%#v", *n) 25 | } 26 | 27 | func (n *LiteralNode) String() string { 28 | return fmt.Sprintf("Literal(%s, %v)", n.Typex, n.Value) 29 | } 30 | 31 | func (n *LiteralNode) Type(Scope) (Type, error) { 32 | return n.Typex, nil 33 | } 34 | -------------------------------------------------------------------------------- /vendor/github.com/jmespath/go-jmespath/toktype_string.go: -------------------------------------------------------------------------------- 1 | // generated by stringer -type=tokType; DO NOT EDIT 2 | 3 | package jmespath 4 | 5 | import "fmt" 6 | 7 | const _tokType_name = "tUnknowntStartDottFiltertFlattentLparentRparentLbrackettRbrackettLbracetRbracetOrtPipetNumbertUnquotedIdentifiertQuotedIdentifiertCommatColontLTtLTEtGTtGTEtEQtNEtJSONLiteraltStringLiteraltCurrenttExpreftAndtNottEOF" 8 | 9 | var _tokType_index = [...]uint8{0, 8, 13, 17, 24, 32, 39, 46, 55, 64, 71, 78, 81, 86, 93, 112, 129, 135, 141, 144, 148, 151, 155, 158, 161, 173, 187, 195, 202, 206, 210, 214} 10 | 11 | func (i tokType) String() string { 12 | if i < 0 || i >= tokType(len(_tokType_index)-1) { 13 | return fmt.Sprintf("tokType(%d)", i) 14 | } 15 | return _tokType_name[_tokType_index[i]:_tokType_index[i+1]] 16 | } 17 | -------------------------------------------------------------------------------- /vendor/github.com/aws/aws-sdk-go/aws/request/http_request.go: -------------------------------------------------------------------------------- 1 | // +build go1.5 2 | 3 | package request 4 | 5 | import ( 6 | "io" 7 | "net/http" 8 | "net/url" 9 | ) 10 | 11 | func copyHTTPRequest(r *http.Request, body io.ReadCloser) *http.Request { 12 | req := &http.Request{ 13 | URL: &url.URL{}, 14 | Header: http.Header{}, 15 | Close: r.Close, 16 | Body: body, 17 | Host: r.Host, 18 | Method: r.Method, 19 | Proto: r.Proto, 20 | ContentLength: r.ContentLength, 21 | // Cancel will be deprecated in 1.7 and will be replaced with Context 22 | Cancel: r.Cancel, 23 | } 24 | 25 | *req.URL = *r.URL 26 | for k, v := range r.Header { 27 | for _, vv := range v { 28 | req.Header.Add(k, vv) 29 | } 30 | } 31 | 32 | return req 33 | } 34 | -------------------------------------------------------------------------------- /vendor/github.com/aws/aws-sdk-go/service/s3/platform_handlers_go1.6.go: -------------------------------------------------------------------------------- 1 | // +build go1.6 2 | 3 | package s3 4 | 5 | import ( 6 | "github.com/aws/aws-sdk-go/aws" 7 | "github.com/aws/aws-sdk-go/aws/request" 8 | ) 9 | 10 | func platformRequestHandlers(r *request.Request) { 11 | if r.Operation.HTTPMethod == "PUT" { 12 | // 100-Continue should only be used on put requests. 13 | r.Handlers.Sign.PushBack(add100Continue) 14 | } 15 | } 16 | 17 | func add100Continue(r *request.Request) { 18 | if aws.BoolValue(r.Config.S3Disable100Continue) { 19 | return 20 | } 21 | if r.HTTPRequest.ContentLength < 1024*1024*2 { 22 | // Ignore requests smaller than 2MB. This helps prevent delaying 23 | // requests unnecessarily. 24 | return 25 | } 26 | 27 | r.HTTPRequest.Header.Set("Expect", "100-Continue") 28 | } 29 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/terraform/terraform/graphnodeconfigtype_string.go: -------------------------------------------------------------------------------- 1 | // Code generated by "stringer -type=GraphNodeConfigType graph_config_node_type.go"; DO NOT EDIT 2 | 3 | package terraform 4 | 5 | import "fmt" 6 | 7 | const _GraphNodeConfigType_name = "GraphNodeConfigTypeInvalidGraphNodeConfigTypeResourceGraphNodeConfigTypeProviderGraphNodeConfigTypeModuleGraphNodeConfigTypeOutputGraphNodeConfigTypeVariable" 8 | 9 | var _GraphNodeConfigType_index = [...]uint8{0, 26, 53, 80, 105, 130, 157} 10 | 11 | func (i GraphNodeConfigType) String() string { 12 | if i < 0 || i >= GraphNodeConfigType(len(_GraphNodeConfigType_index)-1) { 13 | return fmt.Sprintf("GraphNodeConfigType(%d)", i) 14 | } 15 | return _GraphNodeConfigType_name[_GraphNodeConfigType_index[i]:_GraphNodeConfigType_index[i+1]] 16 | } 17 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/hil/ast/variable_access.go: -------------------------------------------------------------------------------- 1 | package ast 2 | 3 | import ( 4 | "fmt" 5 | ) 6 | 7 | // VariableAccess represents a variable access. 8 | type VariableAccess struct { 9 | Name string 10 | Posx Pos 11 | } 12 | 13 | func (n *VariableAccess) Accept(v Visitor) Node { 14 | return v(n) 15 | } 16 | 17 | func (n *VariableAccess) Pos() Pos { 18 | return n.Posx 19 | } 20 | 21 | func (n *VariableAccess) GoString() string { 22 | return fmt.Sprintf("*%#v", *n) 23 | } 24 | 25 | func (n *VariableAccess) String() string { 26 | return fmt.Sprintf("Variable(%s)", n.Name) 27 | } 28 | 29 | func (n *VariableAccess) Type(s Scope) (Type, error) { 30 | v, ok := s.LookupVar(n.Name) 31 | if !ok { 32 | return TypeInvalid, fmt.Errorf("unknown variable: %s", n.Name) 33 | } 34 | 35 | return v.Type, nil 36 | } 37 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/hil/evaltype_string.go: -------------------------------------------------------------------------------- 1 | // Code generated by "stringer -type=EvalType eval_type.go"; DO NOT EDIT 2 | 3 | package hil 4 | 5 | import "fmt" 6 | 7 | const ( 8 | _EvalType_name_0 = "TypeInvalid" 9 | _EvalType_name_1 = "TypeString" 10 | _EvalType_name_2 = "TypeList" 11 | _EvalType_name_3 = "TypeMap" 12 | ) 13 | 14 | var ( 15 | _EvalType_index_0 = [...]uint8{0, 11} 16 | _EvalType_index_1 = [...]uint8{0, 10} 17 | _EvalType_index_2 = [...]uint8{0, 8} 18 | _EvalType_index_3 = [...]uint8{0, 7} 19 | ) 20 | 21 | func (i EvalType) String() string { 22 | switch { 23 | case i == 0: 24 | return _EvalType_name_0 25 | case i == 2: 26 | return _EvalType_name_1 27 | case i == 4: 28 | return _EvalType_name_2 29 | case i == 8: 30 | return _EvalType_name_3 31 | default: 32 | return fmt.Sprintf("EvalType(%d)", i) 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/terraform/dag/edge.go: -------------------------------------------------------------------------------- 1 | package dag 2 | 3 | import ( 4 | "fmt" 5 | ) 6 | 7 | // Edge represents an edge in the graph, with a source and target vertex. 8 | type Edge interface { 9 | Source() Vertex 10 | Target() Vertex 11 | 12 | Hashable 13 | } 14 | 15 | // BasicEdge returns an Edge implementation that simply tracks the source 16 | // and target given as-is. 17 | func BasicEdge(source, target Vertex) Edge { 18 | return &basicEdge{S: source, T: target} 19 | } 20 | 21 | // basicEdge is a basic implementation of Edge that has the source and 22 | // target vertex. 23 | type basicEdge struct { 24 | S, T Vertex 25 | } 26 | 27 | func (e *basicEdge) Hashcode() interface{} { 28 | return fmt.Sprintf("%p-%p", e.S, e.T) 29 | } 30 | 31 | func (e *basicEdge) Source() Vertex { 32 | return e.S 33 | } 34 | 35 | func (e *basicEdge) Target() Vertex { 36 | return e.T 37 | } 38 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/hil/transform_fixed.go: -------------------------------------------------------------------------------- 1 | package hil 2 | 3 | import ( 4 | "github.com/hashicorp/hil/ast" 5 | ) 6 | 7 | // FixedValueTransform transforms an AST to return a fixed value for 8 | // all interpolations. i.e. you can make "hi ${anything}" always 9 | // turn into "hi foo". 10 | // 11 | // The primary use case for this is for config validations where you can 12 | // verify that interpolations result in a certain type of string. 13 | func FixedValueTransform(root ast.Node, Value *ast.LiteralNode) ast.Node { 14 | // We visit the nodes in top-down order 15 | result := root 16 | switch n := result.(type) { 17 | case *ast.Output: 18 | for i, v := range n.Exprs { 19 | n.Exprs[i] = FixedValueTransform(v, Value) 20 | } 21 | case *ast.LiteralNode: 22 | // We keep it as-is 23 | default: 24 | // Anything else we replace 25 | result = Value 26 | } 27 | 28 | return result 29 | } 30 | -------------------------------------------------------------------------------- /vendor/github.com/jmespath/go-jmespath/astnodetype_string.go: -------------------------------------------------------------------------------- 1 | // generated by stringer -type astNodeType; DO NOT EDIT 2 | 3 | package jmespath 4 | 5 | import "fmt" 6 | 7 | const _astNodeType_name = "ASTEmptyASTComparatorASTCurrentNodeASTExpRefASTFunctionExpressionASTFieldASTFilterProjectionASTFlattenASTIdentityASTIndexASTIndexExpressionASTKeyValPairASTLiteralASTMultiSelectHashASTMultiSelectListASTOrExpressionASTAndExpressionASTNotExpressionASTPipeASTProjectionASTSubexpressionASTSliceASTValueProjection" 8 | 9 | var _astNodeType_index = [...]uint16{0, 8, 21, 35, 44, 65, 73, 92, 102, 113, 121, 139, 152, 162, 180, 198, 213, 229, 245, 252, 265, 281, 289, 307} 10 | 11 | func (i astNodeType) String() string { 12 | if i < 0 || i >= astNodeType(len(_astNodeType_index)-1) { 13 | return fmt.Sprintf("astNodeType(%d)", i) 14 | } 15 | return _astNodeType_name[_astNodeType_index[i]:_astNodeType_index[i+1]] 16 | } 17 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/go-getter/client_mode.go: -------------------------------------------------------------------------------- 1 | package getter 2 | 3 | // ClientMode is the mode that the client operates in. 4 | type ClientMode uint 5 | 6 | const ( 7 | ClientModeInvalid ClientMode = iota 8 | 9 | // ClientModeAny downloads anything it can. In this mode, dst must 10 | // be a directory. If src is a file, it is saved into the directory 11 | // with the basename of the URL. If src is a directory or archive, 12 | // it is unpacked directly into dst. 13 | ClientModeAny 14 | 15 | // ClientModeFile downloads a single file. In this mode, dst must 16 | // be a file path (doesn't have to exist). src must point to a single 17 | // file. It is saved as dst. 18 | ClientModeFile 19 | 20 | // ClientModeDir downloads a directory. In this mode, dst must be 21 | // a directory path (doesn't have to exist). src must point to an 22 | // archive or directory (such as in s3). 23 | ClientModeDir 24 | ) 25 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/hil/ast/arithmetic.go: -------------------------------------------------------------------------------- 1 | package ast 2 | 3 | import ( 4 | "bytes" 5 | "fmt" 6 | ) 7 | 8 | // Arithmetic represents a node where the result is arithmetic of 9 | // two or more operands in the order given. 10 | type Arithmetic struct { 11 | Op ArithmeticOp 12 | Exprs []Node 13 | Posx Pos 14 | } 15 | 16 | func (n *Arithmetic) Accept(v Visitor) Node { 17 | for i, expr := range n.Exprs { 18 | n.Exprs[i] = expr.Accept(v) 19 | } 20 | 21 | return v(n) 22 | } 23 | 24 | func (n *Arithmetic) Pos() Pos { 25 | return n.Posx 26 | } 27 | 28 | func (n *Arithmetic) GoString() string { 29 | return fmt.Sprintf("*%#v", *n) 30 | } 31 | 32 | func (n *Arithmetic) String() string { 33 | var b bytes.Buffer 34 | for _, expr := range n.Exprs { 35 | b.WriteString(fmt.Sprintf("%s", expr)) 36 | } 37 | 38 | return b.String() 39 | } 40 | 41 | func (n *Arithmetic) Type(Scope) (Type, error) { 42 | return TypeInt, nil 43 | } 44 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/terraform/terraform/ui_input.go: -------------------------------------------------------------------------------- 1 | package terraform 2 | 3 | // UIInput is the interface that must be implemented to ask for input 4 | // from this user. This should forward the request to wherever the user 5 | // inputs things to ask for values. 6 | type UIInput interface { 7 | Input(*InputOpts) (string, error) 8 | } 9 | 10 | // InputOpts are options for asking for input. 11 | type InputOpts struct { 12 | // Id is a unique ID for the question being asked that might be 13 | // used for logging or to look up a prior answered question. 14 | Id string 15 | 16 | // Query is a human-friendly question for inputting this value. 17 | Query string 18 | 19 | // Description is a description about what this option is. Be wary 20 | // that this will probably be in a terminal so split lines as you see 21 | // necessary. 22 | Description string 23 | 24 | // Default will be the value returned if no data is entered. 25 | Default string 26 | } 27 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/go-getter/source.go: -------------------------------------------------------------------------------- 1 | package getter 2 | 3 | import ( 4 | "strings" 5 | ) 6 | 7 | // SourceDirSubdir takes a source and returns a tuple of the URL without 8 | // the subdir and the URL with the subdir. 9 | func SourceDirSubdir(src string) (string, string) { 10 | // Calcaulate an offset to avoid accidentally marking the scheme 11 | // as the dir. 12 | var offset int 13 | if idx := strings.Index(src, "://"); idx > -1 { 14 | offset = idx + 3 15 | } 16 | 17 | // First see if we even have an explicit subdir 18 | idx := strings.Index(src[offset:], "//") 19 | if idx == -1 { 20 | return src, "" 21 | } 22 | 23 | idx += offset 24 | subdir := src[idx+2:] 25 | src = src[:idx] 26 | 27 | // Next, check if we have query parameters and push them onto the 28 | // URL. 29 | if idx = strings.Index(subdir, "?"); idx > -1 { 30 | query := subdir[idx:] 31 | subdir = subdir[:idx] 32 | src += query 33 | } 34 | 35 | return src, subdir 36 | } 37 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/go-multierror/prefix.go: -------------------------------------------------------------------------------- 1 | package multierror 2 | 3 | import ( 4 | "fmt" 5 | 6 | "github.com/hashicorp/errwrap" 7 | ) 8 | 9 | // Prefix is a helper function that will prefix some text 10 | // to the given error. If the error is a multierror.Error, then 11 | // it will be prefixed to each wrapped error. 12 | // 13 | // This is useful to use when appending multiple multierrors 14 | // together in order to give better scoping. 15 | func Prefix(err error, prefix string) error { 16 | if err == nil { 17 | return nil 18 | } 19 | 20 | format := fmt.Sprintf("%s {{err}}", prefix) 21 | switch err := err.(type) { 22 | case *Error: 23 | // Typed nils can reach here, so initialize if we are nil 24 | if err == nil { 25 | err = new(Error) 26 | } 27 | 28 | // Wrap each of the errors 29 | for i, e := range err.Errors { 30 | err.Errors[i] = errwrap.Wrapf(format, e) 31 | } 32 | 33 | return err 34 | default: 35 | return errwrap.Wrapf(format, err) 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/hil/ast/call.go: -------------------------------------------------------------------------------- 1 | package ast 2 | 3 | import ( 4 | "fmt" 5 | "strings" 6 | ) 7 | 8 | // Call represents a function call. 9 | type Call struct { 10 | Func string 11 | Args []Node 12 | Posx Pos 13 | } 14 | 15 | func (n *Call) Accept(v Visitor) Node { 16 | for i, a := range n.Args { 17 | n.Args[i] = a.Accept(v) 18 | } 19 | 20 | return v(n) 21 | } 22 | 23 | func (n *Call) Pos() Pos { 24 | return n.Posx 25 | } 26 | 27 | func (n *Call) String() string { 28 | args := make([]string, len(n.Args)) 29 | for i, arg := range n.Args { 30 | args[i] = fmt.Sprintf("%s", arg) 31 | } 32 | 33 | return fmt.Sprintf("Call(%s, %s)", n.Func, strings.Join(args, ", ")) 34 | } 35 | 36 | func (n *Call) Type(s Scope) (Type, error) { 37 | f, ok := s.LookupFunc(n.Func) 38 | if !ok { 39 | return TypeInvalid, fmt.Errorf("unknown function: %s", n.Func) 40 | } 41 | 42 | return f.ReturnType, nil 43 | } 44 | 45 | func (n *Call) GoString() string { 46 | return fmt.Sprintf("*%#v", *n) 47 | } 48 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/terraform/terraform/eval_filter.go: -------------------------------------------------------------------------------- 1 | package terraform 2 | 3 | // EvalNodeFilterFunc is the callback used to replace a node with 4 | // another to node. To not do the replacement, just return the input node. 5 | type EvalNodeFilterFunc func(EvalNode) EvalNode 6 | 7 | // EvalNodeFilterable is an interface that can be implemented by 8 | // EvalNodes to allow filtering of sub-elements. Note that this isn't 9 | // a common thing to implement and you probably don't need it. 10 | type EvalNodeFilterable interface { 11 | EvalNode 12 | Filter(EvalNodeFilterFunc) 13 | } 14 | 15 | // EvalFilter runs the filter on the given node and returns the 16 | // final filtered value. This should be called rather than checking 17 | // the EvalNode directly since this will properly handle EvalNodeFilterables. 18 | func EvalFilter(node EvalNode, fn EvalNodeFilterFunc) EvalNode { 19 | if f, ok := node.(EvalNodeFilterable); ok { 20 | f.Filter(fn) 21 | return node 22 | } 23 | 24 | return fn(node) 25 | } 26 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/terraform/terraform/transform_root.go: -------------------------------------------------------------------------------- 1 | package terraform 2 | 3 | import "github.com/hashicorp/terraform/dag" 4 | 5 | const rootNodeName = "root" 6 | 7 | // RootTransformer is a GraphTransformer that adds a root to the graph. 8 | type RootTransformer struct{} 9 | 10 | func (t *RootTransformer) Transform(g *Graph) error { 11 | // If we already have a good root, we're done 12 | if _, err := g.Root(); err == nil { 13 | return nil 14 | } 15 | 16 | // Add a root 17 | var root graphNodeRoot 18 | g.Add(root) 19 | 20 | // Connect the root to all the edges that need it 21 | for _, v := range g.Vertices() { 22 | if v == root { 23 | continue 24 | } 25 | 26 | if g.UpEdges(v).Len() == 0 { 27 | g.Connect(dag.BasicEdge(root, v)) 28 | } 29 | } 30 | 31 | return nil 32 | } 33 | 34 | type graphNodeRoot struct{} 35 | 36 | func (n graphNodeRoot) Name() string { 37 | return rootNodeName 38 | } 39 | 40 | func (n graphNodeRoot) Flatten(p []string) (dag.Vertex, error) { 41 | return n, nil 42 | } 43 | -------------------------------------------------------------------------------- /vendor/github.com/aws/aws-sdk-go/service/s3/statusok_error.go: -------------------------------------------------------------------------------- 1 | package s3 2 | 3 | import ( 4 | "bytes" 5 | "io/ioutil" 6 | "net/http" 7 | 8 | "github.com/aws/aws-sdk-go/aws" 9 | "github.com/aws/aws-sdk-go/aws/awserr" 10 | "github.com/aws/aws-sdk-go/aws/request" 11 | ) 12 | 13 | func copyMultipartStatusOKUnmarhsalError(r *request.Request) { 14 | b, err := ioutil.ReadAll(r.HTTPResponse.Body) 15 | if err != nil { 16 | r.Error = awserr.New("SerializationError", "unable to read response body", err) 17 | return 18 | } 19 | body := bytes.NewReader(b) 20 | r.HTTPResponse.Body = aws.ReadSeekCloser(body) 21 | defer r.HTTPResponse.Body.(aws.ReaderSeekerCloser).Seek(0, 0) 22 | 23 | if body.Len() == 0 { 24 | // If there is no body don't attempt to parse the body. 25 | return 26 | } 27 | 28 | unmarshalError(r) 29 | if err, ok := r.Error.(awserr.Error); ok && err != nil { 30 | if err.Code() == "SerializationError" { 31 | r.Error = nil 32 | return 33 | } 34 | r.HTTPResponse.StatusCode = http.StatusServiceUnavailable 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/hil/parse.go: -------------------------------------------------------------------------------- 1 | package hil 2 | 3 | import ( 4 | "sync" 5 | 6 | "github.com/hashicorp/hil/ast" 7 | ) 8 | 9 | var parserLock sync.Mutex 10 | var parserResult ast.Node 11 | var parserErr error 12 | 13 | // Parse parses the given program and returns an executable AST tree. 14 | func Parse(v string) (ast.Node, error) { 15 | // Unfortunately due to the way that goyacc generated parsers are 16 | // formatted, we can only do a single parse at a time without a lot 17 | // of extra work. In the future we can remove this limitation. 18 | parserLock.Lock() 19 | defer parserLock.Unlock() 20 | 21 | // Reset our globals 22 | parserErr = nil 23 | parserResult = nil 24 | 25 | // Create the lexer 26 | lex := &parserLex{Input: v} 27 | 28 | // Parse! 29 | parserParse(lex) 30 | 31 | // If we have a lex error, return that 32 | if lex.Err != nil { 33 | return nil, lex.Err 34 | } 35 | 36 | // If we have a parser error, return that 37 | if parserErr != nil { 38 | return nil, parserErr 39 | } 40 | 41 | return parserResult, nil 42 | } 43 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/go-getter/get_mock.go: -------------------------------------------------------------------------------- 1 | package getter 2 | 3 | import ( 4 | "net/url" 5 | ) 6 | 7 | // MockGetter is an implementation of Getter that can be used for tests. 8 | type MockGetter struct { 9 | // Proxy, if set, will be called after recording the calls below. 10 | // If it isn't set, then the *Err values will be returned. 11 | Proxy Getter 12 | 13 | GetCalled bool 14 | GetDst string 15 | GetURL *url.URL 16 | GetErr error 17 | 18 | GetFileCalled bool 19 | GetFileDst string 20 | GetFileURL *url.URL 21 | GetFileErr error 22 | } 23 | 24 | func (g *MockGetter) Get(dst string, u *url.URL) error { 25 | g.GetCalled = true 26 | g.GetDst = dst 27 | g.GetURL = u 28 | 29 | if g.Proxy != nil { 30 | return g.Proxy.Get(dst, u) 31 | } 32 | 33 | return g.GetErr 34 | } 35 | 36 | func (g *MockGetter) GetFile(dst string, u *url.URL) error { 37 | g.GetFileCalled = true 38 | g.GetFileDst = dst 39 | g.GetFileURL = u 40 | 41 | if g.Proxy != nil { 42 | return g.Proxy.GetFile(dst, u) 43 | } 44 | return g.GetFileErr 45 | } 46 | -------------------------------------------------------------------------------- /vendor/github.com/aws/aws-sdk-go/aws/awsutil/equal.go: -------------------------------------------------------------------------------- 1 | package awsutil 2 | 3 | import ( 4 | "reflect" 5 | ) 6 | 7 | // DeepEqual returns if the two values are deeply equal like reflect.DeepEqual. 8 | // In addition to this, this method will also dereference the input values if 9 | // possible so the DeepEqual performed will not fail if one parameter is a 10 | // pointer and the other is not. 11 | // 12 | // DeepEqual will not perform indirection of nested values of the input parameters. 13 | func DeepEqual(a, b interface{}) bool { 14 | ra := reflect.Indirect(reflect.ValueOf(a)) 15 | rb := reflect.Indirect(reflect.ValueOf(b)) 16 | 17 | if raValid, rbValid := ra.IsValid(), rb.IsValid(); !raValid && !rbValid { 18 | // If the elements are both nil, and of the same type the are equal 19 | // If they are of different types they are not equal 20 | return reflect.TypeOf(a) == reflect.TypeOf(b) 21 | } else if raValid != rbValid { 22 | // Both values must be valid to be equal 23 | return false 24 | } 25 | 26 | return reflect.DeepEqual(ra.Interface(), rb.Interface()) 27 | } 28 | -------------------------------------------------------------------------------- /vendor/github.com/apparentlymart/go-cidr/cidr/wrangling.go: -------------------------------------------------------------------------------- 1 | package cidr 2 | 3 | import ( 4 | "fmt" 5 | "math/big" 6 | "net" 7 | ) 8 | 9 | func ipToInt(ip net.IP) (*big.Int, int) { 10 | val := &big.Int{} 11 | val.SetBytes([]byte(ip)) 12 | if len(ip) == net.IPv4len { 13 | return val, 32 14 | } else if len(ip) == net.IPv6len { 15 | return val, 128 16 | } else { 17 | panic(fmt.Errorf("Unsupported address length %d", len(ip))) 18 | } 19 | } 20 | 21 | func intToIP(ipInt *big.Int, bits int) net.IP { 22 | ipBytes := ipInt.Bytes() 23 | ret := make([]byte, bits/8) 24 | // Pack our IP bytes into the end of the return array, 25 | // since big.Int.Bytes() removes front zero padding. 26 | for i := 1; i <= len(ipBytes); i++ { 27 | ret[len(ret)-i] = ipBytes[len(ipBytes)-i] 28 | } 29 | return net.IP(ret) 30 | } 31 | 32 | func insertNumIntoIP(ip net.IP, num int, prefixLen int) net.IP { 33 | ipInt, totalBits := ipToInt(ip) 34 | bigNum := big.NewInt(int64(num)) 35 | bigNum.Lsh(bigNum, uint(totalBits-prefixLen)) 36 | ipInt.Or(ipInt, bigNum) 37 | return intToIP(ipInt, totalBits) 38 | } 39 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/hcl/parse.go: -------------------------------------------------------------------------------- 1 | package hcl 2 | 3 | import ( 4 | "fmt" 5 | 6 | "github.com/hashicorp/hcl/hcl/ast" 7 | hclParser "github.com/hashicorp/hcl/hcl/parser" 8 | jsonParser "github.com/hashicorp/hcl/json/parser" 9 | ) 10 | 11 | // ParseBytes accepts as input byte slice and returns ast tree. 12 | // 13 | // Input can be either JSON or HCL 14 | func ParseBytes(in []byte) (*ast.File, error) { 15 | return parse(in) 16 | } 17 | 18 | // ParseString accepts input as a string and returns ast tree. 19 | func ParseString(input string) (*ast.File, error) { 20 | return parse([]byte(input)) 21 | } 22 | 23 | func parse(in []byte) (*ast.File, error) { 24 | switch lexMode(in) { 25 | case lexModeHcl: 26 | return hclParser.Parse(in) 27 | case lexModeJson: 28 | return jsonParser.Parse(in) 29 | } 30 | 31 | return nil, fmt.Errorf("unknown config format") 32 | } 33 | 34 | // Parse parses the given input and returns the root object. 35 | // 36 | // The input format can be either HCL or JSON. 37 | func Parse(input string) (*ast.File, error) { 38 | return parse([]byte(input)) 39 | } 40 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/go-getter/decompress_bzip2.go: -------------------------------------------------------------------------------- 1 | package getter 2 | 3 | import ( 4 | "compress/bzip2" 5 | "fmt" 6 | "io" 7 | "os" 8 | "path/filepath" 9 | ) 10 | 11 | // Bzip2Decompressor is an implementation of Decompressor that can 12 | // decompress bz2 files. 13 | type Bzip2Decompressor struct{} 14 | 15 | func (d *Bzip2Decompressor) Decompress(dst, src string, dir bool) error { 16 | // Directory isn't supported at all 17 | if dir { 18 | return fmt.Errorf("bzip2-compressed files can only unarchive to a single file") 19 | } 20 | 21 | // If we're going into a directory we should make that first 22 | if err := os.MkdirAll(filepath.Dir(dst), 0755); err != nil { 23 | return err 24 | } 25 | 26 | // File first 27 | f, err := os.Open(src) 28 | if err != nil { 29 | return err 30 | } 31 | defer f.Close() 32 | 33 | // Bzip2 compression is second 34 | bzipR := bzip2.NewReader(f) 35 | 36 | // Copy it out 37 | dstF, err := os.Create(dst) 38 | if err != nil { 39 | return err 40 | } 41 | defer dstF.Close() 42 | 43 | _, err = io.Copy(dstF, bzipR) 44 | return err 45 | } 46 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/go-getter/decompress.go: -------------------------------------------------------------------------------- 1 | package getter 2 | 3 | // Decompressor defines the interface that must be implemented to add 4 | // support for decompressing a type. 5 | type Decompressor interface { 6 | // Decompress should decompress src to dst. dir specifies whether dst 7 | // is a directory or single file. src is guaranteed to be a single file 8 | // that exists. dst is not guaranteed to exist already. 9 | Decompress(dst, src string, dir bool) error 10 | } 11 | 12 | // Decompressors is the mapping of extension to the Decompressor implementation 13 | // that will decompress that extension/type. 14 | var Decompressors map[string]Decompressor 15 | 16 | func init() { 17 | tbzDecompressor := new(TarBzip2Decompressor) 18 | tgzDecompressor := new(TarGzipDecompressor) 19 | 20 | Decompressors = map[string]Decompressor{ 21 | "bz2": new(Bzip2Decompressor), 22 | "gz": new(GzipDecompressor), 23 | "tar.bz2": tbzDecompressor, 24 | "tar.gz": tgzDecompressor, 25 | "tbz2": tbzDecompressor, 26 | "tgz": tgzDecompressor, 27 | "zip": new(ZipDecompressor), 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/terraform/dot/graph_writer.go: -------------------------------------------------------------------------------- 1 | package dot 2 | 3 | import ( 4 | "bytes" 5 | "fmt" 6 | ) 7 | 8 | // graphWriter wraps a bytes.Buffer and tracks indent level levels. 9 | type graphWriter struct { 10 | bytes.Buffer 11 | indent int 12 | indentStr string 13 | } 14 | 15 | // Returns an initialized graphWriter at indent level 0. 16 | func newGraphWriter() *graphWriter { 17 | w := &graphWriter{ 18 | indent: 0, 19 | } 20 | w.init() 21 | return w 22 | } 23 | 24 | // Prints to the buffer at the current indent level. 25 | func (w *graphWriter) Printf(s string, args ...interface{}) { 26 | w.WriteString(w.indentStr + fmt.Sprintf(s, args...)) 27 | } 28 | 29 | // Increase the indent level. 30 | func (w *graphWriter) Indent() { 31 | w.indent++ 32 | w.init() 33 | } 34 | 35 | // Decrease the indent level. 36 | func (w *graphWriter) Unindent() { 37 | w.indent-- 38 | w.init() 39 | } 40 | 41 | func (w *graphWriter) init() { 42 | indentBuf := new(bytes.Buffer) 43 | for i := 0; i < w.indent; i++ { 44 | indentBuf.WriteString("\t") 45 | } 46 | w.indentStr = indentBuf.String() 47 | } 48 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/go-multierror/append.go: -------------------------------------------------------------------------------- 1 | package multierror 2 | 3 | // Append is a helper function that will append more errors 4 | // onto an Error in order to create a larger multi-error. 5 | // 6 | // If err is not a multierror.Error, then it will be turned into 7 | // one. If any of the errs are multierr.Error, they will be flattened 8 | // one level into err. 9 | func Append(err error, errs ...error) *Error { 10 | switch err := err.(type) { 11 | case *Error: 12 | // Typed nils can reach here, so initialize if we are nil 13 | if err == nil { 14 | err = new(Error) 15 | } 16 | 17 | // Go through each error and flatten 18 | for _, e := range errs { 19 | switch e := e.(type) { 20 | case *Error: 21 | err.Errors = append(err.Errors, e.Errors...) 22 | default: 23 | err.Errors = append(err.Errors, e) 24 | } 25 | } 26 | 27 | return err 28 | default: 29 | newErrs := make([]error, 0, len(errs)+1) 30 | if err != nil { 31 | newErrs = append(newErrs, err) 32 | } 33 | newErrs = append(newErrs, errs...) 34 | 35 | return Append(&Error{}, newErrs...) 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/terraform/terraform/version.go: -------------------------------------------------------------------------------- 1 | package terraform 2 | 3 | import ( 4 | "fmt" 5 | 6 | "github.com/hashicorp/go-version" 7 | ) 8 | 9 | // The main version number that is being run at the moment. 10 | const Version = "0.7.4" 11 | 12 | // A pre-release marker for the version. If this is "" (empty string) 13 | // then it means that it is a final release. Otherwise, this is a pre-release 14 | // such as "dev" (in development), "beta", "rc1", etc. 15 | const VersionPrerelease = "" 16 | 17 | // SemVersion is an instance of version.Version. This has the secondary 18 | // benefit of verifying during tests and init time that our version is a 19 | // proper semantic version, which should always be the case. 20 | var SemVersion = version.Must(version.NewVersion(Version)) 21 | 22 | // VersionHeader is the header name used to send the current terraform version 23 | // in http requests. 24 | const VersionHeader = "Terraform-Version" 25 | 26 | func VersionString() string { 27 | if VersionPrerelease != "" { 28 | return fmt.Sprintf("%s-%s", Version, VersionPrerelease) 29 | } 30 | return Version 31 | } 32 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/hil/ast/type_string.go: -------------------------------------------------------------------------------- 1 | // Code generated by "stringer -type=Type"; DO NOT EDIT 2 | 3 | package ast 4 | 5 | import "fmt" 6 | 7 | const ( 8 | _Type_name_0 = "TypeInvalid" 9 | _Type_name_1 = "TypeAny" 10 | _Type_name_2 = "TypeString" 11 | _Type_name_3 = "TypeInt" 12 | _Type_name_4 = "TypeFloat" 13 | _Type_name_5 = "TypeList" 14 | _Type_name_6 = "TypeMap" 15 | ) 16 | 17 | var ( 18 | _Type_index_0 = [...]uint8{0, 11} 19 | _Type_index_1 = [...]uint8{0, 7} 20 | _Type_index_2 = [...]uint8{0, 10} 21 | _Type_index_3 = [...]uint8{0, 7} 22 | _Type_index_4 = [...]uint8{0, 9} 23 | _Type_index_5 = [...]uint8{0, 8} 24 | _Type_index_6 = [...]uint8{0, 7} 25 | ) 26 | 27 | func (i Type) String() string { 28 | switch { 29 | case i == 0: 30 | return _Type_name_0 31 | case i == 2: 32 | return _Type_name_1 33 | case i == 4: 34 | return _Type_name_2 35 | case i == 8: 36 | return _Type_name_3 37 | case i == 16: 38 | return _Type_name_4 39 | case i == 32: 40 | return _Type_name_5 41 | case i == 64: 42 | return _Type_name_6 43 | default: 44 | return fmt.Sprintf("Type(%d)", i) 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /.circleci/config.yml: -------------------------------------------------------------------------------- 1 | version: 2.1 2 | 3 | orbs: 4 | go: palantir/go@0.0.11 5 | 6 | jobs: 7 | verify: 8 | parameters: 9 | executor: 10 | description: | 11 | The executor used for this job. 12 | type: executor 13 | executor: << parameters.executor >> 14 | steps: 15 | - go/setup: 16 | restore-mod-cache: false 17 | - run: go version 18 | - run: go build . 19 | 20 | workflows: 21 | version: 2 22 | verify: 23 | jobs: 24 | - verify: 25 | name: verify-go-1.12 26 | executor: 27 | name: go/golang 28 | owner-repo: palantir/tfjson 29 | version: 1.12.2 30 | module: false 31 | - verify: 32 | name: verify-go-1.11 33 | executor: 34 | name: go/golang 35 | owner-repo: palantir/tfjson 36 | version: 1.11.8 37 | module: false 38 | - verify: 39 | name: verify-go-1.10 40 | executor: 41 | name: go/golang 42 | owner-repo: palantir/tfjson 43 | version: 1.10.8 44 | module: false 45 | -------------------------------------------------------------------------------- /vendor/github.com/aws/aws-sdk-go/service/s3/content_md5.go: -------------------------------------------------------------------------------- 1 | package s3 2 | 3 | import ( 4 | "crypto/md5" 5 | "encoding/base64" 6 | "io" 7 | 8 | "github.com/aws/aws-sdk-go/aws/awserr" 9 | "github.com/aws/aws-sdk-go/aws/request" 10 | ) 11 | 12 | // contentMD5 computes and sets the HTTP Content-MD5 header for requests that 13 | // require it. 14 | func contentMD5(r *request.Request) { 15 | h := md5.New() 16 | 17 | // hash the body. seek back to the first position after reading to reset 18 | // the body for transmission. copy errors may be assumed to be from the 19 | // body. 20 | _, err := io.Copy(h, r.Body) 21 | if err != nil { 22 | r.Error = awserr.New("ContentMD5", "failed to read body", err) 23 | return 24 | } 25 | _, err = r.Body.Seek(0, 0) 26 | if err != nil { 27 | r.Error = awserr.New("ContentMD5", "failed to seek body", err) 28 | return 29 | } 30 | 31 | // encode the md5 checksum in base64 and set the request header. 32 | sum := h.Sum(nil) 33 | sum64 := make([]byte, base64.StdEncoding.EncodedLen(len(sum))) 34 | base64.StdEncoding.Encode(sum64, sum) 35 | r.HTTPRequest.Header.Set("Content-MD5", string(sum64)) 36 | } 37 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2016 Palantir Technologies 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /vendor/github.com/apparentlymart/go-cidr/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2015 Martin Atkins 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to deal 5 | in the Software without restriction, including without limitation the rights 6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is 8 | furnished to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in 11 | all copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 19 | THE SOFTWARE. 20 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/go-getter/decompress_gzip.go: -------------------------------------------------------------------------------- 1 | package getter 2 | 3 | import ( 4 | "compress/gzip" 5 | "fmt" 6 | "io" 7 | "os" 8 | "path/filepath" 9 | ) 10 | 11 | // GzipDecompressor is an implementation of Decompressor that can 12 | // decompress bz2 files. 13 | type GzipDecompressor struct{} 14 | 15 | func (d *GzipDecompressor) Decompress(dst, src string, dir bool) error { 16 | // Directory isn't supported at all 17 | if dir { 18 | return fmt.Errorf("gzip-compressed files can only unarchive to a single file") 19 | } 20 | 21 | // If we're going into a directory we should make that first 22 | if err := os.MkdirAll(filepath.Dir(dst), 0755); err != nil { 23 | return err 24 | } 25 | 26 | // File first 27 | f, err := os.Open(src) 28 | if err != nil { 29 | return err 30 | } 31 | defer f.Close() 32 | 33 | // gzip compression is second 34 | gzipR, err := gzip.NewReader(f) 35 | if err != nil { 36 | return err 37 | } 38 | defer gzipR.Close() 39 | 40 | // Copy it out 41 | dstF, err := os.Create(dst) 42 | if err != nil { 43 | return err 44 | } 45 | defer dstF.Close() 46 | 47 | _, err = io.Copy(dstF, gzipR) 48 | return err 49 | } 50 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/terraform/terraform/eval_check_prevent_destroy.go: -------------------------------------------------------------------------------- 1 | package terraform 2 | 3 | import ( 4 | "fmt" 5 | 6 | "github.com/hashicorp/terraform/config" 7 | ) 8 | 9 | // EvalPreventDestroy is an EvalNode implementation that returns an 10 | // error if a resource has PreventDestroy configured and the diff 11 | // would destroy the resource. 12 | type EvalCheckPreventDestroy struct { 13 | Resource *config.Resource 14 | Diff **InstanceDiff 15 | } 16 | 17 | func (n *EvalCheckPreventDestroy) Eval(ctx EvalContext) (interface{}, error) { 18 | if n.Diff == nil || *n.Diff == nil || n.Resource == nil { 19 | return nil, nil 20 | } 21 | 22 | diff := *n.Diff 23 | preventDestroy := n.Resource.Lifecycle.PreventDestroy 24 | 25 | if diff.GetDestroy() && preventDestroy { 26 | return nil, fmt.Errorf(preventDestroyErrStr, n.Resource.Id()) 27 | } 28 | 29 | return nil, nil 30 | } 31 | 32 | const preventDestroyErrStr = `%s: the plan would destroy this resource, but it currently has lifecycle.prevent_destroy set to true. To avoid this error and continue with the plan, either disable lifecycle.prevent_destroy or adjust the scope of the plan using the -target flag.` 33 | -------------------------------------------------------------------------------- /vendor/github.com/satori/go.uuid/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (C) 2013-2015 by Maxim Bublis 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining 4 | a copy of this software and associated documentation files (the 5 | "Software"), to deal in the Software without restriction, including 6 | without limitation the rights to use, copy, modify, merge, publish, 7 | distribute, sublicense, and/or sell copies of the Software, and to 8 | permit persons to whom the Software is furnished to do so, subject to 9 | the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be 12 | included in all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 15 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 16 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 17 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 18 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 19 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 20 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | -------------------------------------------------------------------------------- /vendor/github.com/mitchellh/go-homedir/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2013 Mitchell Hashimoto 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. 22 | -------------------------------------------------------------------------------- /vendor/github.com/mitchellh/reflectwalk/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2013 Mitchell Hashimoto 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. 22 | -------------------------------------------------------------------------------- /vendor/github.com/mitchellh/copystructure/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2014 Mitchell Hashimoto 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. 22 | -------------------------------------------------------------------------------- /vendor/github.com/mitchellh/mapstructure/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2013 Mitchell Hashimoto 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. 22 | -------------------------------------------------------------------------------- /vendor/github.com/jmespath/go-jmespath/Makefile: -------------------------------------------------------------------------------- 1 | 2 | CMD = jpgo 3 | 4 | help: 5 | @echo "Please use \`make ' where is one of" 6 | @echo " test to run all the tests" 7 | @echo " build to build the library and jp executable" 8 | @echo " generate to run codegen" 9 | 10 | 11 | generate: 12 | go generate ./... 13 | 14 | build: 15 | rm -f $(CMD) 16 | go build ./... 17 | rm -f cmd/$(CMD)/$(CMD) && cd cmd/$(CMD)/ && go build ./... 18 | mv cmd/$(CMD)/$(CMD) . 19 | 20 | test: 21 | go test -v ./... 22 | 23 | check: 24 | go vet ./... 25 | @echo "golint ./..." 26 | @lint=`golint ./...`; \ 27 | lint=`echo "$$lint" | grep -v "astnodetype_string.go" | grep -v "toktype_string.go"`; \ 28 | echo "$$lint"; \ 29 | if [ "$$lint" != "" ]; then exit 1; fi 30 | 31 | htmlc: 32 | go test -coverprofile="/tmp/jpcov" && go tool cover -html="/tmp/jpcov" && unlink /tmp/jpcov 33 | 34 | buildfuzz: 35 | go-fuzz-build github.com/jmespath/go-jmespath/fuzz 36 | 37 | fuzz: buildfuzz 38 | go-fuzz -bin=./jmespath-fuzz.zip -workdir=fuzz/corpus 39 | 40 | bench: 41 | go test -bench . -cpuprofile cpu.out 42 | 43 | pprof-cpu: 44 | go tool pprof ./go-jmespath.test ./cpu.out 45 | -------------------------------------------------------------------------------- /vendor/github.com/aws/aws-sdk-go/aws/request/offset_reader.go: -------------------------------------------------------------------------------- 1 | package request 2 | 3 | import ( 4 | "io" 5 | "sync" 6 | ) 7 | 8 | // offsetReader is a thread-safe io.ReadCloser to prevent racing 9 | // with retrying requests 10 | type offsetReader struct { 11 | buf io.ReadSeeker 12 | lock sync.RWMutex 13 | closed bool 14 | } 15 | 16 | func newOffsetReader(buf io.ReadSeeker, offset int64) *offsetReader { 17 | reader := &offsetReader{} 18 | buf.Seek(offset, 0) 19 | 20 | reader.buf = buf 21 | return reader 22 | } 23 | 24 | // Close is a thread-safe close. Uses the write lock. 25 | func (o *offsetReader) Close() error { 26 | o.lock.Lock() 27 | defer o.lock.Unlock() 28 | o.closed = true 29 | return nil 30 | } 31 | 32 | // Read is a thread-safe read using a read lock. 33 | func (o *offsetReader) Read(p []byte) (int, error) { 34 | o.lock.RLock() 35 | defer o.lock.RUnlock() 36 | 37 | if o.closed { 38 | return 0, io.EOF 39 | } 40 | 41 | return o.buf.Read(p) 42 | } 43 | 44 | // CloseAndCopy will return a new offsetReader with a copy of the old buffer 45 | // and close the old buffer. 46 | func (o *offsetReader) CloseAndCopy(offset int64) *offsetReader { 47 | o.Close() 48 | return newOffsetReader(o.buf, offset) 49 | } 50 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/go-getter/helper/url/url_windows.go: -------------------------------------------------------------------------------- 1 | package url 2 | 3 | import ( 4 | "fmt" 5 | "net/url" 6 | "path/filepath" 7 | "strings" 8 | ) 9 | 10 | func parse(rawURL string) (*url.URL, error) { 11 | // Make sure we're using "/" since URLs are "/"-based. 12 | rawURL = filepath.ToSlash(rawURL) 13 | 14 | u, err := url.Parse(rawURL) 15 | if err != nil { 16 | return nil, err 17 | } 18 | 19 | if len(rawURL) > 1 && rawURL[1] == ':' { 20 | // Assume we're dealing with a drive letter file path where the drive 21 | // letter has been parsed into the URL Scheme, and the rest of the path 22 | // has been parsed into the URL Path without the leading ':' character. 23 | u.Path = fmt.Sprintf("%s:%s", string(rawURL[0]), u.Path) 24 | u.Scheme = "" 25 | } 26 | 27 | if len(u.Host) > 1 && u.Host[1] == ':' && strings.HasPrefix(rawURL, "file://") { 28 | // Assume we're dealing with a drive letter file path where the drive 29 | // letter has been parsed into the URL Host. 30 | u.Path = fmt.Sprintf("%s%s", u.Host, u.Path) 31 | u.Host = "" 32 | } 33 | 34 | // Remove leading slash for absolute file paths. 35 | if len(u.Path) > 2 && u.Path[0] == '/' && u.Path[2] == ':' { 36 | u.Path = u.Path[1:] 37 | } 38 | 39 | return u, err 40 | } 41 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/terraform/config/config_tree.go: -------------------------------------------------------------------------------- 1 | package config 2 | 3 | // configTree represents a tree of configurations where the root is the 4 | // first file and its children are the configurations it has imported. 5 | type configTree struct { 6 | Path string 7 | Config *Config 8 | Children []*configTree 9 | } 10 | 11 | // Flatten flattens the entire tree down to a single merged Config 12 | // structure. 13 | func (t *configTree) Flatten() (*Config, error) { 14 | // No children is easy: we're already merged! 15 | if len(t.Children) == 0 { 16 | return t.Config, nil 17 | } 18 | 19 | // Depth-first, merge all the children first. 20 | childConfigs := make([]*Config, len(t.Children)) 21 | for i, ct := range t.Children { 22 | c, err := ct.Flatten() 23 | if err != nil { 24 | return nil, err 25 | } 26 | 27 | childConfigs[i] = c 28 | } 29 | 30 | // Merge all the children in order 31 | config := childConfigs[0] 32 | childConfigs = childConfigs[1:] 33 | for _, config2 := range childConfigs { 34 | var err error 35 | config, err = Merge(config, config2) 36 | if err != nil { 37 | return nil, err 38 | } 39 | } 40 | 41 | // Merge the final merged child config with our own 42 | return Merge(config, t.Config) 43 | } 44 | -------------------------------------------------------------------------------- /vendor/github.com/bgentry/go-netrc/LICENSE: -------------------------------------------------------------------------------- 1 | Original version Copyright © 2010 Fazlul Shahriar . Newer 2 | portions Copyright © 2014 Blake Gentry . 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining a copy 5 | of this software and associated documentation files (the "Software"), to deal 6 | in the Software without restriction, including without limitation the rights 7 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | copies of the Software, and to permit persons to whom the Software is 9 | furnished to do so, subject to the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be included in 12 | all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | THE SOFTWARE. 21 | -------------------------------------------------------------------------------- /vendor/github.com/mitchellh/mapstructure/error.go: -------------------------------------------------------------------------------- 1 | package mapstructure 2 | 3 | import ( 4 | "errors" 5 | "fmt" 6 | "sort" 7 | "strings" 8 | ) 9 | 10 | // Error implements the error interface and can represents multiple 11 | // errors that occur in the course of a single decode. 12 | type Error struct { 13 | Errors []string 14 | } 15 | 16 | func (e *Error) Error() string { 17 | points := make([]string, len(e.Errors)) 18 | for i, err := range e.Errors { 19 | points[i] = fmt.Sprintf("* %s", err) 20 | } 21 | 22 | sort.Strings(points) 23 | return fmt.Sprintf( 24 | "%d error(s) decoding:\n\n%s", 25 | len(e.Errors), strings.Join(points, "\n")) 26 | } 27 | 28 | // WrappedErrors implements the errwrap.Wrapper interface to make this 29 | // return value more useful with the errwrap and go-multierror libraries. 30 | func (e *Error) WrappedErrors() []error { 31 | if e == nil { 32 | return nil 33 | } 34 | 35 | result := make([]error, len(e.Errors)) 36 | for i, e := range e.Errors { 37 | result[i] = errors.New(e) 38 | } 39 | 40 | return result 41 | } 42 | 43 | func appendErrors(errors []string, err error) []string { 44 | switch e := err.(type) { 45 | case *Error: 46 | return append(errors, e.Errors...) 47 | default: 48 | return append(errors, e.Error()) 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/terraform/terraform/transform_vertex.go: -------------------------------------------------------------------------------- 1 | package terraform 2 | 3 | import ( 4 | "fmt" 5 | 6 | "github.com/hashicorp/terraform/dag" 7 | ) 8 | 9 | // VertexTransformer is a GraphTransformer that transforms vertices 10 | // using the GraphVertexTransformers. The Transforms are run in sequential 11 | // order. If a transform replaces a vertex then the next transform will see 12 | // the new vertex. 13 | type VertexTransformer struct { 14 | Transforms []GraphVertexTransformer 15 | } 16 | 17 | func (t *VertexTransformer) Transform(g *Graph) error { 18 | for _, v := range g.Vertices() { 19 | for _, vt := range t.Transforms { 20 | newV, err := vt.Transform(v) 21 | if err != nil { 22 | return err 23 | } 24 | 25 | // If the vertex didn't change, then don't do anything more 26 | if newV == v { 27 | continue 28 | } 29 | 30 | // Vertex changed, replace it within the graph 31 | if ok := g.Replace(v, newV); !ok { 32 | // This should never happen, big problem 33 | return fmt.Errorf( 34 | "Failed to replace %s with %s!\n\nSource: %#v\n\nTarget: %#v", 35 | dag.VertexName(v), dag.VertexName(newV), v, newV) 36 | } 37 | 38 | // Replace v so that future transforms use the proper vertex 39 | v = newV 40 | } 41 | } 42 | 43 | return nil 44 | } 45 | -------------------------------------------------------------------------------- /vendor/github.com/aws/aws-sdk-go/service/s3/bucket_location.go: -------------------------------------------------------------------------------- 1 | package s3 2 | 3 | import ( 4 | "io/ioutil" 5 | "regexp" 6 | 7 | "github.com/aws/aws-sdk-go/aws" 8 | "github.com/aws/aws-sdk-go/aws/awserr" 9 | "github.com/aws/aws-sdk-go/aws/awsutil" 10 | "github.com/aws/aws-sdk-go/aws/request" 11 | ) 12 | 13 | var reBucketLocation = regexp.MustCompile(`>([^<>]+)<\/Location`) 14 | 15 | func buildGetBucketLocation(r *request.Request) { 16 | if r.DataFilled() { 17 | out := r.Data.(*GetBucketLocationOutput) 18 | b, err := ioutil.ReadAll(r.HTTPResponse.Body) 19 | if err != nil { 20 | r.Error = awserr.New("SerializationError", "failed reading response body", err) 21 | return 22 | } 23 | 24 | match := reBucketLocation.FindSubmatch(b) 25 | if len(match) > 1 { 26 | loc := string(match[1]) 27 | out.LocationConstraint = &loc 28 | } 29 | } 30 | } 31 | 32 | func populateLocationConstraint(r *request.Request) { 33 | if r.ParamsFilled() && aws.StringValue(r.Config.Region) != "us-east-1" { 34 | in := r.Params.(*CreateBucketInput) 35 | if in.CreateBucketConfiguration == nil { 36 | r.Params = awsutil.CopyOf(r.Params) 37 | in = r.Params.(*CreateBucketInput) 38 | in.CreateBucketConfiguration = &CreateBucketConfiguration{ 39 | LocationConstraint: r.Config.Region, 40 | } 41 | } 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/terraform/terraform/graph_walk.go: -------------------------------------------------------------------------------- 1 | package terraform 2 | 3 | import ( 4 | "github.com/hashicorp/terraform/dag" 5 | ) 6 | 7 | // GraphWalker is an interface that can be implemented that when used 8 | // with Graph.Walk will invoke the given callbacks under certain events. 9 | type GraphWalker interface { 10 | EnterPath([]string) EvalContext 11 | ExitPath([]string) 12 | EnterVertex(dag.Vertex) 13 | ExitVertex(dag.Vertex, error) 14 | EnterEvalTree(dag.Vertex, EvalNode) EvalNode 15 | ExitEvalTree(dag.Vertex, interface{}, error) error 16 | } 17 | 18 | // NullGraphWalker is a GraphWalker implementation that does nothing. 19 | // This can be embedded within other GraphWalker implementations for easily 20 | // implementing all the required functions. 21 | type NullGraphWalker struct{} 22 | 23 | func (NullGraphWalker) EnterPath([]string) EvalContext { return nil } 24 | func (NullGraphWalker) ExitPath([]string) {} 25 | func (NullGraphWalker) EnterVertex(dag.Vertex) {} 26 | func (NullGraphWalker) ExitVertex(dag.Vertex, error) {} 27 | func (NullGraphWalker) EnterEvalTree(v dag.Vertex, n EvalNode) EvalNode { return n } 28 | func (NullGraphWalker) ExitEvalTree(dag.Vertex, interface{}, error) error { 29 | return nil 30 | } 31 | -------------------------------------------------------------------------------- /vendor/github.com/aws/aws-sdk-go/private/protocol/rest/payload.go: -------------------------------------------------------------------------------- 1 | package rest 2 | 3 | import "reflect" 4 | 5 | // PayloadMember returns the payload field member of i if there is one, or nil. 6 | func PayloadMember(i interface{}) interface{} { 7 | if i == nil { 8 | return nil 9 | } 10 | 11 | v := reflect.ValueOf(i).Elem() 12 | if !v.IsValid() { 13 | return nil 14 | } 15 | if field, ok := v.Type().FieldByName("_"); ok { 16 | if payloadName := field.Tag.Get("payload"); payloadName != "" { 17 | field, _ := v.Type().FieldByName(payloadName) 18 | if field.Tag.Get("type") != "structure" { 19 | return nil 20 | } 21 | 22 | payload := v.FieldByName(payloadName) 23 | if payload.IsValid() || (payload.Kind() == reflect.Ptr && !payload.IsNil()) { 24 | return payload.Interface() 25 | } 26 | } 27 | } 28 | return nil 29 | } 30 | 31 | // PayloadType returns the type of a payload field member of i if there is one, or "". 32 | func PayloadType(i interface{}) string { 33 | v := reflect.Indirect(reflect.ValueOf(i)) 34 | if !v.IsValid() { 35 | return "" 36 | } 37 | if field, ok := v.Type().FieldByName("_"); ok { 38 | if payloadName := field.Tag.Get("payload"); payloadName != "" { 39 | if member, ok := v.Type().FieldByName(payloadName); ok { 40 | return member.Tag.Get("type") 41 | } 42 | } 43 | } 44 | return "" 45 | } 46 | -------------------------------------------------------------------------------- /vendor/github.com/aws/aws-sdk-go/service/s3/sse.go: -------------------------------------------------------------------------------- 1 | package s3 2 | 3 | import ( 4 | "crypto/md5" 5 | "encoding/base64" 6 | 7 | "github.com/aws/aws-sdk-go/aws/awserr" 8 | "github.com/aws/aws-sdk-go/aws/awsutil" 9 | "github.com/aws/aws-sdk-go/aws/request" 10 | ) 11 | 12 | var errSSERequiresSSL = awserr.New("ConfigError", "cannot send SSE keys over HTTP.", nil) 13 | 14 | func validateSSERequiresSSL(r *request.Request) { 15 | if r.HTTPRequest.URL.Scheme != "https" { 16 | p, _ := awsutil.ValuesAtPath(r.Params, "SSECustomerKey||CopySourceSSECustomerKey") 17 | if len(p) > 0 { 18 | r.Error = errSSERequiresSSL 19 | } 20 | } 21 | } 22 | 23 | func computeSSEKeys(r *request.Request) { 24 | headers := []string{ 25 | "x-amz-server-side-encryption-customer-key", 26 | "x-amz-copy-source-server-side-encryption-customer-key", 27 | } 28 | 29 | for _, h := range headers { 30 | md5h := h + "-md5" 31 | if key := r.HTTPRequest.Header.Get(h); key != "" { 32 | // Base64-encode the value 33 | b64v := base64.StdEncoding.EncodeToString([]byte(key)) 34 | r.HTTPRequest.Header.Set(h, b64v) 35 | 36 | // Add MD5 if it wasn't computed 37 | if r.HTTPRequest.Header.Get(md5h) == "" { 38 | sum := md5.Sum([]byte(key)) 39 | b64sum := base64.StdEncoding.EncodeToString(sum[:]) 40 | r.HTTPRequest.Header.Set(md5h, b64sum) 41 | } 42 | } 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/terraform/terraform/eval_refresh.go: -------------------------------------------------------------------------------- 1 | package terraform 2 | 3 | import ( 4 | "fmt" 5 | "log" 6 | ) 7 | 8 | // EvalRefresh is an EvalNode implementation that does a refresh for 9 | // a resource. 10 | type EvalRefresh struct { 11 | Provider *ResourceProvider 12 | State **InstanceState 13 | Info *InstanceInfo 14 | Output **InstanceState 15 | } 16 | 17 | // TODO: test 18 | func (n *EvalRefresh) Eval(ctx EvalContext) (interface{}, error) { 19 | provider := *n.Provider 20 | state := *n.State 21 | 22 | // If we have no state, we don't do any refreshing 23 | if state == nil { 24 | log.Printf("[DEBUG] refresh: %s: no state, not refreshing", n.Info.Id) 25 | return nil, nil 26 | } 27 | 28 | // Call pre-refresh hook 29 | err := ctx.Hook(func(h Hook) (HookAction, error) { 30 | return h.PreRefresh(n.Info, state) 31 | }) 32 | if err != nil { 33 | return nil, err 34 | } 35 | 36 | // Refresh! 37 | state, err = provider.Refresh(n.Info, state) 38 | if err != nil { 39 | return nil, fmt.Errorf("%s: %s", n.Info.Id, err.Error()) 40 | } 41 | 42 | // Call post-refresh hook 43 | err = ctx.Hook(func(h Hook) (HookAction, error) { 44 | return h.PostRefresh(n.Info, state) 45 | }) 46 | if err != nil { 47 | return nil, err 48 | } 49 | 50 | if n.Output != nil { 51 | *n.Output = state 52 | } 53 | 54 | return nil, nil 55 | } 56 | -------------------------------------------------------------------------------- /vendor/github.com/aws/aws-sdk-go/private/protocol/query/build.go: -------------------------------------------------------------------------------- 1 | // Package query provides serialization of AWS query requests, and responses. 2 | package query 3 | 4 | //go:generate go run ../../../models/protocol_tests/generate.go ../../../models/protocol_tests/input/query.json build_test.go 5 | 6 | import ( 7 | "net/url" 8 | 9 | "github.com/aws/aws-sdk-go/aws/awserr" 10 | "github.com/aws/aws-sdk-go/aws/request" 11 | "github.com/aws/aws-sdk-go/private/protocol/query/queryutil" 12 | ) 13 | 14 | // BuildHandler is a named request handler for building query protocol requests 15 | var BuildHandler = request.NamedHandler{Name: "awssdk.query.Build", Fn: Build} 16 | 17 | // Build builds a request for an AWS Query service. 18 | func Build(r *request.Request) { 19 | body := url.Values{ 20 | "Action": {r.Operation.Name}, 21 | "Version": {r.ClientInfo.APIVersion}, 22 | } 23 | if err := queryutil.Parse(body, r.Params, false); err != nil { 24 | r.Error = awserr.New("SerializationError", "failed encoding Query request", err) 25 | return 26 | } 27 | 28 | if r.ExpireTime == 0 { 29 | r.HTTPRequest.Method = "POST" 30 | r.HTTPRequest.Header.Set("Content-Type", "application/x-www-form-urlencoded; charset=utf-8") 31 | r.SetBufferBody([]byte(body.Encode())) 32 | } else { // This is a pre-signed request 33 | r.HTTPRequest.Method = "GET" 34 | r.HTTPRequest.URL.RawQuery = body.Encode() 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/terraform/config/module/tree_gob.go: -------------------------------------------------------------------------------- 1 | package module 2 | 3 | import ( 4 | "bytes" 5 | "encoding/gob" 6 | 7 | "github.com/hashicorp/terraform/config" 8 | ) 9 | 10 | func (t *Tree) GobDecode(bs []byte) error { 11 | t.lock.Lock() 12 | defer t.lock.Unlock() 13 | 14 | // Decode the gob data 15 | var data treeGob 16 | dec := gob.NewDecoder(bytes.NewReader(bs)) 17 | if err := dec.Decode(&data); err != nil { 18 | return err 19 | } 20 | 21 | // Set the fields 22 | t.name = data.Name 23 | t.config = data.Config 24 | t.children = data.Children 25 | t.path = data.Path 26 | 27 | return nil 28 | } 29 | 30 | func (t *Tree) GobEncode() ([]byte, error) { 31 | data := &treeGob{ 32 | Config: t.config, 33 | Children: t.children, 34 | Name: t.name, 35 | Path: t.path, 36 | } 37 | 38 | var buf bytes.Buffer 39 | enc := gob.NewEncoder(&buf) 40 | if err := enc.Encode(data); err != nil { 41 | return nil, err 42 | } 43 | 44 | return buf.Bytes(), nil 45 | } 46 | 47 | // treeGob is used as a structure to Gob encode a tree. 48 | // 49 | // This structure is private so it can't be referenced but the fields are 50 | // public, allowing Gob to properly encode this. When we decode this, we are 51 | // able to turn it into a Tree. 52 | type treeGob struct { 53 | Config *config.Config 54 | Children map[string]*Tree 55 | Name string 56 | Path []string 57 | } 58 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/go-uuid/uuid.go: -------------------------------------------------------------------------------- 1 | package uuid 2 | 3 | import ( 4 | "crypto/rand" 5 | "encoding/hex" 6 | "fmt" 7 | ) 8 | 9 | // GenerateUUID is used to generate a random UUID 10 | func GenerateUUID() (string, error) { 11 | buf := make([]byte, 16) 12 | if _, err := rand.Read(buf); err != nil { 13 | return "", fmt.Errorf("failed to read random bytes: %v", err) 14 | } 15 | 16 | return FormatUUID(buf) 17 | } 18 | 19 | func FormatUUID(buf []byte) (string, error) { 20 | if len(buf) != 16 { 21 | return "", fmt.Errorf("wrong length byte slice (%d)", len(buf)) 22 | } 23 | 24 | return fmt.Sprintf("%08x-%04x-%04x-%04x-%12x", 25 | buf[0:4], 26 | buf[4:6], 27 | buf[6:8], 28 | buf[8:10], 29 | buf[10:16]), nil 30 | } 31 | 32 | func ParseUUID(uuid string) ([]byte, error) { 33 | if len(uuid) != 36 { 34 | return nil, fmt.Errorf("uuid string is wrong length") 35 | } 36 | 37 | hyph := []byte("-") 38 | 39 | if uuid[8] != hyph[0] || 40 | uuid[13] != hyph[0] || 41 | uuid[18] != hyph[0] || 42 | uuid[23] != hyph[0] { 43 | return nil, fmt.Errorf("uuid is improperly formatted") 44 | } 45 | 46 | hexStr := uuid[0:8] + uuid[9:13] + uuid[14:18] + uuid[19:23] + uuid[24:36] 47 | 48 | ret, err := hex.DecodeString(hexStr) 49 | if err != nil { 50 | return nil, err 51 | } 52 | if len(ret) != 16 { 53 | return nil, fmt.Errorf("decoded hex is the wrong length") 54 | } 55 | 56 | return ret, nil 57 | } 58 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/terraform/terraform/eval_provisioner.go: -------------------------------------------------------------------------------- 1 | package terraform 2 | 3 | import ( 4 | "fmt" 5 | ) 6 | 7 | // EvalInitProvisioner is an EvalNode implementation that initializes a provisioner 8 | // and returns nothing. The provisioner can be retrieved again with the 9 | // EvalGetProvisioner node. 10 | type EvalInitProvisioner struct { 11 | Name string 12 | } 13 | 14 | func (n *EvalInitProvisioner) Eval(ctx EvalContext) (interface{}, error) { 15 | return ctx.InitProvisioner(n.Name) 16 | } 17 | 18 | // EvalCloseProvisioner is an EvalNode implementation that closes provisioner 19 | // connections that aren't needed anymore. 20 | type EvalCloseProvisioner struct { 21 | Name string 22 | } 23 | 24 | func (n *EvalCloseProvisioner) Eval(ctx EvalContext) (interface{}, error) { 25 | ctx.CloseProvisioner(n.Name) 26 | return nil, nil 27 | } 28 | 29 | // EvalGetProvisioner is an EvalNode implementation that retrieves an already 30 | // initialized provisioner instance for the given name. 31 | type EvalGetProvisioner struct { 32 | Name string 33 | Output *ResourceProvisioner 34 | } 35 | 36 | func (n *EvalGetProvisioner) Eval(ctx EvalContext) (interface{}, error) { 37 | result := ctx.Provisioner(n.Name) 38 | if result == nil { 39 | return nil, fmt.Errorf("provisioner %s not initialized", n.Name) 40 | } 41 | 42 | if n.Output != nil { 43 | *n.Output = result 44 | } 45 | 46 | return result, nil 47 | } 48 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/terraform/terraform/eval_filter_operation.go: -------------------------------------------------------------------------------- 1 | package terraform 2 | 3 | // EvalNodeOpFilterable is an interface that EvalNodes can implement 4 | // to be filterable by the operation that is being run on Terraform. 5 | type EvalNodeOpFilterable interface { 6 | IncludeInOp(walkOperation) bool 7 | } 8 | 9 | // EvalNodeFilterOp returns a filter function that filters nodes that 10 | // include themselves in specific operations. 11 | func EvalNodeFilterOp(op walkOperation) EvalNodeFilterFunc { 12 | return func(n EvalNode) EvalNode { 13 | include := true 14 | if of, ok := n.(EvalNodeOpFilterable); ok { 15 | include = of.IncludeInOp(op) 16 | } 17 | if include { 18 | return n 19 | } 20 | 21 | return EvalNoop{} 22 | } 23 | } 24 | 25 | // EvalOpFilter is an EvalNode implementation that is a proxy to 26 | // another node but filters based on the operation. 27 | type EvalOpFilter struct { 28 | // Ops is the list of operations to include this node in. 29 | Ops []walkOperation 30 | 31 | // Node is the node to execute 32 | Node EvalNode 33 | } 34 | 35 | // TODO: test 36 | func (n *EvalOpFilter) Eval(ctx EvalContext) (interface{}, error) { 37 | return EvalRaw(n.Node, ctx) 38 | } 39 | 40 | // EvalNodeOpFilterable impl. 41 | func (n *EvalOpFilter) IncludeInOp(op walkOperation) bool { 42 | for _, v := range n.Ops { 43 | if v == op { 44 | return true 45 | } 46 | } 47 | 48 | return false 49 | } 50 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/hcl/hcl/token/position.go: -------------------------------------------------------------------------------- 1 | package token 2 | 3 | import "fmt" 4 | 5 | // Pos describes an arbitrary source position 6 | // including the file, line, and column location. 7 | // A Position is valid if the line number is > 0. 8 | type Pos struct { 9 | Filename string // filename, if any 10 | Offset int // offset, starting at 0 11 | Line int // line number, starting at 1 12 | Column int // column number, starting at 1 (character count) 13 | } 14 | 15 | // IsValid returns true if the position is valid. 16 | func (p *Pos) IsValid() bool { return p.Line > 0 } 17 | 18 | // String returns a string in one of several forms: 19 | // 20 | // file:line:column valid position with file name 21 | // line:column valid position without file name 22 | // file invalid position with file name 23 | // - invalid position without file name 24 | func (p Pos) String() string { 25 | s := p.Filename 26 | if p.IsValid() { 27 | if s != "" { 28 | s += ":" 29 | } 30 | s += fmt.Sprintf("%d:%d", p.Line, p.Column) 31 | } 32 | if s == "" { 33 | s = "-" 34 | } 35 | return s 36 | } 37 | 38 | // Before reports whether the position p is before u. 39 | func (p Pos) Before(u Pos) bool { 40 | return u.Offset > p.Offset || u.Line > p.Line 41 | } 42 | 43 | // After reports whether the position p is after u. 44 | func (p Pos) After(u Pos) bool { 45 | return u.Offset < p.Offset || u.Line < p.Line 46 | } 47 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/hcl/json/token/position.go: -------------------------------------------------------------------------------- 1 | package token 2 | 3 | import "fmt" 4 | 5 | // Pos describes an arbitrary source position 6 | // including the file, line, and column location. 7 | // A Position is valid if the line number is > 0. 8 | type Pos struct { 9 | Filename string // filename, if any 10 | Offset int // offset, starting at 0 11 | Line int // line number, starting at 1 12 | Column int // column number, starting at 1 (character count) 13 | } 14 | 15 | // IsValid returns true if the position is valid. 16 | func (p *Pos) IsValid() bool { return p.Line > 0 } 17 | 18 | // String returns a string in one of several forms: 19 | // 20 | // file:line:column valid position with file name 21 | // line:column valid position without file name 22 | // file invalid position with file name 23 | // - invalid position without file name 24 | func (p Pos) String() string { 25 | s := p.Filename 26 | if p.IsValid() { 27 | if s != "" { 28 | s += ":" 29 | } 30 | s += fmt.Sprintf("%d:%d", p.Line, p.Column) 31 | } 32 | if s == "" { 33 | s = "-" 34 | } 35 | return s 36 | } 37 | 38 | // Before reports whether the position p is before u. 39 | func (p Pos) Before(u Pos) bool { 40 | return u.Offset > p.Offset || u.Line > p.Line 41 | } 42 | 43 | // After reports whether the position p is after u. 44 | func (p Pos) After(u Pos) bool { 45 | return u.Offset < p.Offset || u.Line < p.Line 46 | } 47 | -------------------------------------------------------------------------------- /vendor/github.com/aws/aws-sdk-go/private/protocol/query/unmarshal.go: -------------------------------------------------------------------------------- 1 | package query 2 | 3 | //go:generate go run ../../../models/protocol_tests/generate.go ../../../models/protocol_tests/output/query.json unmarshal_test.go 4 | 5 | import ( 6 | "encoding/xml" 7 | 8 | "github.com/aws/aws-sdk-go/aws/awserr" 9 | "github.com/aws/aws-sdk-go/aws/request" 10 | "github.com/aws/aws-sdk-go/private/protocol/xml/xmlutil" 11 | ) 12 | 13 | // UnmarshalHandler is a named request handler for unmarshaling query protocol requests 14 | var UnmarshalHandler = request.NamedHandler{Name: "awssdk.query.Unmarshal", Fn: Unmarshal} 15 | 16 | // UnmarshalMetaHandler is a named request handler for unmarshaling query protocol request metadata 17 | var UnmarshalMetaHandler = request.NamedHandler{Name: "awssdk.query.UnmarshalMeta", Fn: UnmarshalMeta} 18 | 19 | // Unmarshal unmarshals a response for an AWS Query service. 20 | func Unmarshal(r *request.Request) { 21 | defer r.HTTPResponse.Body.Close() 22 | if r.DataFilled() { 23 | decoder := xml.NewDecoder(r.HTTPResponse.Body) 24 | err := xmlutil.UnmarshalXML(r.Data, decoder, r.Operation.Name+"Result") 25 | if err != nil { 26 | r.Error = awserr.New("SerializationError", "failed decoding Query response", err) 27 | return 28 | } 29 | } 30 | } 31 | 32 | // UnmarshalMeta unmarshals header response values for an AWS Query service. 33 | func UnmarshalMeta(r *request.Request) { 34 | r.RequestID = r.HTTPResponse.Header.Get("X-Amzn-Requestid") 35 | } 36 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/go-multierror/multierror.go: -------------------------------------------------------------------------------- 1 | package multierror 2 | 3 | import ( 4 | "fmt" 5 | ) 6 | 7 | // Error is an error type to track multiple errors. This is used to 8 | // accumulate errors in cases and return them as a single "error". 9 | type Error struct { 10 | Errors []error 11 | ErrorFormat ErrorFormatFunc 12 | } 13 | 14 | func (e *Error) Error() string { 15 | fn := e.ErrorFormat 16 | if fn == nil { 17 | fn = ListFormatFunc 18 | } 19 | 20 | return fn(e.Errors) 21 | } 22 | 23 | // ErrorOrNil returns an error interface if this Error represents 24 | // a list of errors, or returns nil if the list of errors is empty. This 25 | // function is useful at the end of accumulation to make sure that the value 26 | // returned represents the existence of errors. 27 | func (e *Error) ErrorOrNil() error { 28 | if e == nil { 29 | return nil 30 | } 31 | if len(e.Errors) == 0 { 32 | return nil 33 | } 34 | 35 | return e 36 | } 37 | 38 | func (e *Error) GoString() string { 39 | return fmt.Sprintf("*%#v", *e) 40 | } 41 | 42 | // WrappedErrors returns the list of errors that this Error is wrapping. 43 | // It is an implementatin of the errwrap.Wrapper interface so that 44 | // multierror.Error can be used with that library. 45 | // 46 | // This method is not safe to be called concurrently and is no different 47 | // than accessing the Errors field directly. It is implementd only to 48 | // satisfy the errwrap.Wrapper interface. 49 | func (e *Error) WrappedErrors() []error { 50 | return e.Errors 51 | } 52 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/terraform/terraform/graph_config_node.go: -------------------------------------------------------------------------------- 1 | package terraform 2 | 3 | import ( 4 | "github.com/hashicorp/terraform/dag" 5 | ) 6 | 7 | // graphNodeConfig is an interface that all graph nodes for the 8 | // configuration graph need to implement in order to build the variable 9 | // dependencies properly. 10 | type graphNodeConfig interface { 11 | dag.NamedVertex 12 | 13 | // All graph nodes should be dependent on other things, and able to 14 | // be depended on. 15 | GraphNodeDependable 16 | GraphNodeDependent 17 | 18 | // ConfigType returns the type of thing in the configuration that 19 | // this node represents, such as a resource, module, etc. 20 | ConfigType() GraphNodeConfigType 21 | } 22 | 23 | // GraphNodeAddressable is an interface that all graph nodes for the 24 | // configuration graph need to implement in order to be be addressed / targeted 25 | // properly. 26 | type GraphNodeAddressable interface { 27 | graphNodeConfig 28 | 29 | ResourceAddress() *ResourceAddress 30 | } 31 | 32 | // GraphNodeTargetable is an interface for graph nodes to implement when they 33 | // need to be told about incoming targets. This is useful for nodes that need 34 | // to respect targets as they dynamically expand. Note that the list of targets 35 | // provided will contain every target provided, and each implementing graph 36 | // node must filter this list to targets considered relevant. 37 | type GraphNodeTargetable interface { 38 | GraphNodeAddressable 39 | 40 | SetTargets([]ResourceAddress) 41 | } 42 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/hcl/hcl/ast/walk.go: -------------------------------------------------------------------------------- 1 | package ast 2 | 3 | import "fmt" 4 | 5 | // WalkFunc describes a function to be called for each node during a Walk. The 6 | // returned node can be used to rewrite the AST. Walking stops the returned 7 | // bool is false. 8 | type WalkFunc func(Node) (Node, bool) 9 | 10 | // Walk traverses an AST in depth-first order: It starts by calling fn(node); 11 | // node must not be nil. If fn returns true, Walk invokes fn recursively for 12 | // each of the non-nil children of node, followed by a call of fn(nil). The 13 | // returned node of fn can be used to rewrite the passed node to fn. 14 | func Walk(node Node, fn WalkFunc) Node { 15 | rewritten, ok := fn(node) 16 | if !ok { 17 | return rewritten 18 | } 19 | 20 | switch n := node.(type) { 21 | case *File: 22 | n.Node = Walk(n.Node, fn) 23 | case *ObjectList: 24 | for i, item := range n.Items { 25 | n.Items[i] = Walk(item, fn).(*ObjectItem) 26 | } 27 | case *ObjectKey: 28 | // nothing to do 29 | case *ObjectItem: 30 | for i, k := range n.Keys { 31 | n.Keys[i] = Walk(k, fn).(*ObjectKey) 32 | } 33 | 34 | if n.Val != nil { 35 | n.Val = Walk(n.Val, fn) 36 | } 37 | case *LiteralType: 38 | // nothing to do 39 | case *ListType: 40 | for i, l := range n.List { 41 | n.List[i] = Walk(l, fn) 42 | } 43 | case *ObjectType: 44 | n.List = Walk(n.List, fn).(*ObjectList) 45 | default: 46 | // should we panic here? 47 | fmt.Printf("unknown type: %T\n", n) 48 | } 49 | 50 | fn(nil) 51 | return rewritten 52 | } 53 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/hil/ast/variables_helper.go: -------------------------------------------------------------------------------- 1 | package ast 2 | 3 | import "fmt" 4 | 5 | func VariableListElementTypesAreHomogenous(variableName string, list []Variable) (Type, error) { 6 | listTypes := make(map[Type]struct{}) 7 | for _, v := range list { 8 | if _, ok := listTypes[v.Type]; ok { 9 | continue 10 | } 11 | listTypes[v.Type] = struct{}{} 12 | } 13 | 14 | if len(listTypes) != 1 && len(list) != 0 { 15 | return TypeInvalid, fmt.Errorf("list %q does not have homogenous types. found %s", variableName, reportTypes(listTypes)) 16 | } 17 | 18 | if len(list) > 0 { 19 | return list[0].Type, nil 20 | } 21 | 22 | return TypeInvalid, fmt.Errorf("list %q does not have any elements so cannot determine type.", variableName) 23 | } 24 | 25 | func VariableMapValueTypesAreHomogenous(variableName string, vmap map[string]Variable) (Type, error) { 26 | valueTypes := make(map[Type]struct{}) 27 | for _, v := range vmap { 28 | if _, ok := valueTypes[v.Type]; ok { 29 | continue 30 | } 31 | valueTypes[v.Type] = struct{}{} 32 | } 33 | 34 | if len(valueTypes) != 1 && len(vmap) != 0 { 35 | return TypeInvalid, fmt.Errorf("map %q does not have homogenous value types. found %s", variableName, reportTypes(valueTypes)) 36 | } 37 | 38 | // For loop here is an easy way to get a single key, we return immediately. 39 | for _, v := range vmap { 40 | return v.Type, nil 41 | } 42 | 43 | // This means the map is empty 44 | return TypeInvalid, fmt.Errorf("map %q does not have any elements so cannot determine type.", variableName) 45 | } 46 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/terraform/terraform/resource_provisioner_mock.go: -------------------------------------------------------------------------------- 1 | package terraform 2 | 3 | import "sync" 4 | 5 | // MockResourceProvisioner implements ResourceProvisioner but mocks out all the 6 | // calls for testing purposes. 7 | type MockResourceProvisioner struct { 8 | sync.Mutex 9 | // Anything you want, in case you need to store extra data with the mock. 10 | Meta interface{} 11 | 12 | ApplyCalled bool 13 | ApplyOutput UIOutput 14 | ApplyState *InstanceState 15 | ApplyConfig *ResourceConfig 16 | ApplyFn func(*InstanceState, *ResourceConfig) error 17 | ApplyReturnError error 18 | 19 | ValidateCalled bool 20 | ValidateConfig *ResourceConfig 21 | ValidateFn func(c *ResourceConfig) ([]string, []error) 22 | ValidateReturnWarns []string 23 | ValidateReturnErrors []error 24 | } 25 | 26 | func (p *MockResourceProvisioner) Validate(c *ResourceConfig) ([]string, []error) { 27 | p.Lock() 28 | defer p.Unlock() 29 | 30 | p.ValidateCalled = true 31 | p.ValidateConfig = c 32 | if p.ValidateFn != nil { 33 | return p.ValidateFn(c) 34 | } 35 | return p.ValidateReturnWarns, p.ValidateReturnErrors 36 | } 37 | 38 | func (p *MockResourceProvisioner) Apply( 39 | output UIOutput, 40 | state *InstanceState, 41 | c *ResourceConfig) error { 42 | p.Lock() 43 | defer p.Unlock() 44 | 45 | p.ApplyCalled = true 46 | p.ApplyOutput = output 47 | p.ApplyState = state 48 | p.ApplyConfig = c 49 | if p.ApplyFn != nil { 50 | return p.ApplyFn(state, c) 51 | } 52 | return p.ApplyReturnError 53 | } 54 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/terraform/helper/hilmapstructure/hilmapstructure.go: -------------------------------------------------------------------------------- 1 | package hilmapstructure 2 | 3 | import ( 4 | "fmt" 5 | "reflect" 6 | 7 | "github.com/mitchellh/mapstructure" 8 | ) 9 | 10 | var hilMapstructureDecodeHookEmptySlice []interface{} 11 | var hilMapstructureDecodeHookStringSlice []string 12 | var hilMapstructureDecodeHookEmptyMap map[string]interface{} 13 | 14 | // WeakDecode behaves in the same way as mapstructure.WeakDecode but has a 15 | // DecodeHook which defeats the backward compatibility mode of mapstructure 16 | // which WeakDecodes []interface{}{} into an empty map[string]interface{}. This 17 | // allows us to use WeakDecode (desirable), but not fail on empty lists. 18 | func WeakDecode(m interface{}, rawVal interface{}) error { 19 | config := &mapstructure.DecoderConfig{ 20 | DecodeHook: func(source reflect.Type, target reflect.Type, val interface{}) (interface{}, error) { 21 | sliceType := reflect.TypeOf(hilMapstructureDecodeHookEmptySlice) 22 | stringSliceType := reflect.TypeOf(hilMapstructureDecodeHookStringSlice) 23 | mapType := reflect.TypeOf(hilMapstructureDecodeHookEmptyMap) 24 | 25 | if (source == sliceType || source == stringSliceType) && target == mapType { 26 | return nil, fmt.Errorf("Cannot convert a []interface{} into a map[string]interface{}") 27 | } 28 | 29 | return val, nil 30 | }, 31 | WeaklyTypedInput: true, 32 | Result: rawVal, 33 | } 34 | 35 | decoder, err := mapstructure.NewDecoder(config) 36 | if err != nil { 37 | return err 38 | } 39 | 40 | return decoder.Decode(m) 41 | } 42 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/terraform/terraform/resource_provisioner.go: -------------------------------------------------------------------------------- 1 | package terraform 2 | 3 | // ResourceProvisioner is an interface that must be implemented by any 4 | // resource provisioner: the thing that initializes resources in 5 | // a Terraform configuration. 6 | type ResourceProvisioner interface { 7 | // Validate is called once at the beginning with the raw 8 | // configuration (no interpolation done) and can return a list of warnings 9 | // and/or errors. 10 | // 11 | // This is called once per resource. 12 | // 13 | // This should not assume any of the values in the resource configuration 14 | // are valid since it is possible they have to be interpolated still. 15 | // The primary use case of this call is to check that the required keys 16 | // are set and that the general structure is correct. 17 | Validate(*ResourceConfig) ([]string, []error) 18 | 19 | // Apply runs the provisioner on a specific resource and returns the new 20 | // resource state along with an error. Instead of a diff, the ResourceConfig 21 | // is provided since provisioners only run after a resource has been 22 | // newly created. 23 | Apply(UIOutput, *InstanceState, *ResourceConfig) error 24 | } 25 | 26 | // ResourceProvisionerCloser is an interface that provisioners that can close 27 | // connections that aren't needed anymore must implement. 28 | type ResourceProvisionerCloser interface { 29 | Close() error 30 | } 31 | 32 | // ResourceProvisionerFactory is a function type that creates a new instance 33 | // of a resource provisioner. 34 | type ResourceProvisionerFactory func() (ResourceProvisioner, error) 35 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/terraform/terraform/transform_module.go: -------------------------------------------------------------------------------- 1 | package terraform 2 | 3 | import ( 4 | "fmt" 5 | 6 | "github.com/hashicorp/terraform/dag" 7 | ) 8 | 9 | // ModuleDestroyTransformer is a GraphTransformer that adds a node 10 | // to the graph that will just mark the full module for destroy in 11 | // the destroy scenario. 12 | type ModuleDestroyTransformer struct{} 13 | 14 | func (t *ModuleDestroyTransformer) Transform(g *Graph) error { 15 | // Create the node 16 | n := &graphNodeModuleDestroy{Path: g.Path} 17 | 18 | // Add it to the graph. We don't need any edges because 19 | // it can happen whenever. 20 | g.Add(n) 21 | 22 | return nil 23 | } 24 | 25 | type graphNodeModuleDestroy struct { 26 | Path []string 27 | } 28 | 29 | func (n *graphNodeModuleDestroy) Name() string { 30 | return "plan-destroy" 31 | } 32 | 33 | // GraphNodeEvalable impl. 34 | func (n *graphNodeModuleDestroy) EvalTree() EvalNode { 35 | return &EvalOpFilter{ 36 | Ops: []walkOperation{walkPlanDestroy}, 37 | Node: &EvalDiffDestroyModule{Path: n.Path}, 38 | } 39 | } 40 | 41 | // GraphNodeFlattenable impl. 42 | func (n *graphNodeModuleDestroy) Flatten(p []string) (dag.Vertex, error) { 43 | return &graphNodeModuleDestroyFlat{ 44 | graphNodeModuleDestroy: n, 45 | PathValue: p, 46 | }, nil 47 | } 48 | 49 | type graphNodeModuleDestroyFlat struct { 50 | *graphNodeModuleDestroy 51 | 52 | PathValue []string 53 | } 54 | 55 | func (n *graphNodeModuleDestroyFlat) Name() string { 56 | return fmt.Sprintf( 57 | "%s.%s", modulePrefixStr(n.PathValue), n.graphNodeModuleDestroy.Name()) 58 | } 59 | 60 | func (n *graphNodeModuleDestroyFlat) Path() []string { 61 | return n.PathValue 62 | } 63 | -------------------------------------------------------------------------------- /vendor/github.com/jmespath/go-jmespath/api.go: -------------------------------------------------------------------------------- 1 | package jmespath 2 | 3 | import "strconv" 4 | 5 | // JmesPath is the epresentation of a compiled JMES path query. A JmesPath is 6 | // safe for concurrent use by multiple goroutines. 7 | type JMESPath struct { 8 | ast ASTNode 9 | intr *treeInterpreter 10 | } 11 | 12 | // Compile parses a JMESPath expression and returns, if successful, a JMESPath 13 | // object that can be used to match against data. 14 | func Compile(expression string) (*JMESPath, error) { 15 | parser := NewParser() 16 | ast, err := parser.Parse(expression) 17 | if err != nil { 18 | return nil, err 19 | } 20 | jmespath := &JMESPath{ast: ast, intr: newInterpreter()} 21 | return jmespath, nil 22 | } 23 | 24 | // MustCompile is like Compile but panics if the expression cannot be parsed. 25 | // It simplifies safe initialization of global variables holding compiled 26 | // JMESPaths. 27 | func MustCompile(expression string) *JMESPath { 28 | jmespath, err := Compile(expression) 29 | if err != nil { 30 | panic(`jmespath: Compile(` + strconv.Quote(expression) + `): ` + err.Error()) 31 | } 32 | return jmespath 33 | } 34 | 35 | // Search evaluates a JMESPath expression against input data and returns the result. 36 | func (jp *JMESPath) Search(data interface{}) (interface{}, error) { 37 | return jp.intr.Execute(jp.ast, data) 38 | } 39 | 40 | // Search evaluates a JMESPath expression against input data and returns the result. 41 | func Search(expression string, data interface{}) (interface{}, error) { 42 | intr := newInterpreter() 43 | parser := NewParser() 44 | ast, err := parser.Parse(expression) 45 | if err != nil { 46 | return nil, err 47 | } 48 | return intr.Execute(ast, data) 49 | } 50 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/terraform/terraform/eval_count.go: -------------------------------------------------------------------------------- 1 | package terraform 2 | 3 | import ( 4 | "github.com/hashicorp/terraform/config" 5 | ) 6 | 7 | // EvalCountFixZeroOneBoundary is an EvalNode that fixes up the state 8 | // when there is a resource count with zero/one boundary, i.e. fixing 9 | // a resource named "aws_instance.foo" to "aws_instance.foo.0" and vice-versa. 10 | type EvalCountFixZeroOneBoundary struct { 11 | Resource *config.Resource 12 | } 13 | 14 | // TODO: test 15 | func (n *EvalCountFixZeroOneBoundary) Eval(ctx EvalContext) (interface{}, error) { 16 | // Get the count, important for knowing whether we're supposed to 17 | // be adding the zero, or trimming it. 18 | count, err := n.Resource.Count() 19 | if err != nil { 20 | return nil, err 21 | } 22 | 23 | // Figure what to look for and what to replace it with 24 | hunt := n.Resource.Id() 25 | replace := hunt + ".0" 26 | if count < 2 { 27 | hunt, replace = replace, hunt 28 | } 29 | 30 | state, lock := ctx.State() 31 | 32 | // Get a lock so we can access this instance and potentially make 33 | // changes to it. 34 | lock.Lock() 35 | defer lock.Unlock() 36 | 37 | // Look for the module state. If we don't have one, then it doesn't matter. 38 | mod := state.ModuleByPath(ctx.Path()) 39 | if mod == nil { 40 | return nil, nil 41 | } 42 | 43 | // Look for the resource state. If we don't have one, then it is okay. 44 | rs, ok := mod.Resources[hunt] 45 | if !ok { 46 | return nil, nil 47 | } 48 | 49 | // If the replacement key exists, we just keep both 50 | if _, ok := mod.Resources[replace]; ok { 51 | return nil, nil 52 | } 53 | 54 | mod.Resources[replace] = rs 55 | delete(mod.Resources, hunt) 56 | 57 | return nil, nil 58 | } 59 | -------------------------------------------------------------------------------- /vendor/github.com/aws/aws-sdk-go/service/s3/customizations.go: -------------------------------------------------------------------------------- 1 | package s3 2 | 3 | import ( 4 | "github.com/aws/aws-sdk-go/aws/client" 5 | "github.com/aws/aws-sdk-go/aws/request" 6 | ) 7 | 8 | func init() { 9 | initClient = defaultInitClientFn 10 | initRequest = defaultInitRequestFn 11 | } 12 | 13 | func defaultInitClientFn(c *client.Client) { 14 | // Support building custom endpoints based on config 15 | c.Handlers.Build.PushFront(updateEndpointForS3Config) 16 | 17 | // Require SSL when using SSE keys 18 | c.Handlers.Validate.PushBack(validateSSERequiresSSL) 19 | c.Handlers.Build.PushBack(computeSSEKeys) 20 | 21 | // S3 uses custom error unmarshaling logic 22 | c.Handlers.UnmarshalError.Clear() 23 | c.Handlers.UnmarshalError.PushBack(unmarshalError) 24 | } 25 | 26 | func defaultInitRequestFn(r *request.Request) { 27 | // Add reuest handlers for specific platforms. 28 | // e.g. 100-continue support for PUT requests using Go 1.6 29 | platformRequestHandlers(r) 30 | 31 | switch r.Operation.Name { 32 | case opPutBucketCors, opPutBucketLifecycle, opPutBucketPolicy, 33 | opPutBucketTagging, opDeleteObjects, opPutBucketLifecycleConfiguration, 34 | opPutBucketReplication: 35 | // These S3 operations require Content-MD5 to be set 36 | r.Handlers.Build.PushBack(contentMD5) 37 | case opGetBucketLocation: 38 | // GetBucketLocation has custom parsing logic 39 | r.Handlers.Unmarshal.PushFront(buildGetBucketLocation) 40 | case opCreateBucket: 41 | // Auto-populate LocationConstraint with current region 42 | r.Handlers.Validate.PushFront(populateLocationConstraint) 43 | case opCopyObject, opUploadPartCopy, opCompleteMultipartUpload: 44 | r.Handlers.Unmarshal.PushFront(copyMultipartStatusOKUnmarhsalError) 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/go-getter/netrc.go: -------------------------------------------------------------------------------- 1 | package getter 2 | 3 | import ( 4 | "fmt" 5 | "net/url" 6 | "os" 7 | "runtime" 8 | 9 | "github.com/bgentry/go-netrc/netrc" 10 | "github.com/mitchellh/go-homedir" 11 | ) 12 | 13 | // addAuthFromNetrc adds auth information to the URL from the user's 14 | // netrc file if it can be found. This will only add the auth info 15 | // if the URL doesn't already have auth info specified and the 16 | // the username is blank. 17 | func addAuthFromNetrc(u *url.URL) error { 18 | // If the URL already has auth information, do nothing 19 | if u.User != nil && u.User.Username() != "" { 20 | return nil 21 | } 22 | 23 | // Get the netrc file path 24 | path := os.Getenv("NETRC") 25 | if path == "" { 26 | filename := ".netrc" 27 | if runtime.GOOS == "windows" { 28 | filename = "_netrc" 29 | } 30 | 31 | var err error 32 | path, err = homedir.Expand("~/" + filename) 33 | if err != nil { 34 | return err 35 | } 36 | } 37 | 38 | // If the file is not a file, then do nothing 39 | if fi, err := os.Stat(path); err != nil { 40 | // File doesn't exist, do nothing 41 | if os.IsNotExist(err) { 42 | return nil 43 | } 44 | 45 | // Some other error! 46 | return err 47 | } else if fi.IsDir() { 48 | // File is directory, ignore 49 | return nil 50 | } 51 | 52 | // Load up the netrc file 53 | net, err := netrc.ParseFile(path) 54 | if err != nil { 55 | return fmt.Errorf("Error parsing netrc file at %q: %s", path, err) 56 | } 57 | 58 | machine := net.FindMachine(u.Host) 59 | if machine == nil { 60 | // Machine not found, no problem 61 | return nil 62 | } 63 | 64 | // Set the user info 65 | u.User = url.UserPassword(machine.Login, machine.Password) 66 | return nil 67 | } 68 | -------------------------------------------------------------------------------- /vendor/github.com/mitchellh/mapstructure/README.md: -------------------------------------------------------------------------------- 1 | # mapstructure 2 | 3 | mapstructure is a Go library for decoding generic map values to structures 4 | and vice versa, while providing helpful error handling. 5 | 6 | This library is most useful when decoding values from some data stream (JSON, 7 | Gob, etc.) where you don't _quite_ know the structure of the underlying data 8 | until you read a part of it. You can therefore read a `map[string]interface{}` 9 | and use this library to decode it into the proper underlying native Go 10 | structure. 11 | 12 | ## Installation 13 | 14 | Standard `go get`: 15 | 16 | ``` 17 | $ go get github.com/mitchellh/mapstructure 18 | ``` 19 | 20 | ## Usage & Example 21 | 22 | For usage and examples see the [Godoc](http://godoc.org/github.com/mitchellh/mapstructure). 23 | 24 | The `Decode` function has examples associated with it there. 25 | 26 | ## But Why?! 27 | 28 | Go offers fantastic standard libraries for decoding formats such as JSON. 29 | The standard method is to have a struct pre-created, and populate that struct 30 | from the bytes of the encoded format. This is great, but the problem is if 31 | you have configuration or an encoding that changes slightly depending on 32 | specific fields. For example, consider this JSON: 33 | 34 | ```json 35 | { 36 | "type": "person", 37 | "name": "Mitchell" 38 | } 39 | ``` 40 | 41 | Perhaps we can't populate a specific structure without first reading 42 | the "type" field from the JSON. We could always do two passes over the 43 | decoding of the JSON (reading the "type" first, and the rest later). 44 | However, it is much simpler to just decode this into a `map[string]interface{}` 45 | structure, read the "type" key, then use something like this library 46 | to decode it into the proper structure. 47 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/go-getter/folder_storage.go: -------------------------------------------------------------------------------- 1 | package getter 2 | 3 | import ( 4 | "crypto/md5" 5 | "encoding/hex" 6 | "fmt" 7 | "os" 8 | "path/filepath" 9 | ) 10 | 11 | // FolderStorage is an implementation of the Storage interface that manages 12 | // modules on the disk. 13 | type FolderStorage struct { 14 | // StorageDir is the directory where the modules will be stored. 15 | StorageDir string 16 | } 17 | 18 | // Dir implements Storage.Dir 19 | func (s *FolderStorage) Dir(key string) (d string, e bool, err error) { 20 | d = s.dir(key) 21 | _, err = os.Stat(d) 22 | if err == nil { 23 | // Directory exists 24 | e = true 25 | return 26 | } 27 | if os.IsNotExist(err) { 28 | // Directory doesn't exist 29 | d = "" 30 | e = false 31 | err = nil 32 | return 33 | } 34 | 35 | // An error 36 | d = "" 37 | e = false 38 | return 39 | } 40 | 41 | // Get implements Storage.Get 42 | func (s *FolderStorage) Get(key string, source string, update bool) error { 43 | dir := s.dir(key) 44 | if !update { 45 | if _, err := os.Stat(dir); err == nil { 46 | // If the directory already exists, then we're done since 47 | // we're not updating. 48 | return nil 49 | } else if !os.IsNotExist(err) { 50 | // If the error we got wasn't a file-not-exist error, then 51 | // something went wrong and we should report it. 52 | return fmt.Errorf("Error reading module directory: %s", err) 53 | } 54 | } 55 | 56 | // Get the source. This always forces an update. 57 | return Get(dir, source) 58 | } 59 | 60 | // dir returns the directory name internally that we'll use to map to 61 | // internally. 62 | func (s *FolderStorage) dir(key string) string { 63 | sum := md5.Sum([]byte(key)) 64 | return filepath.Join(s.StorageDir, hex.EncodeToString(sum[:])) 65 | } 66 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/terraform/terraform/util.go: -------------------------------------------------------------------------------- 1 | package terraform 2 | 3 | import ( 4 | "strings" 5 | ) 6 | 7 | // Semaphore is a wrapper around a channel to provide 8 | // utility methods to clarify that we are treating the 9 | // channel as a semaphore 10 | type Semaphore chan struct{} 11 | 12 | // NewSemaphore creates a semaphore that allows up 13 | // to a given limit of simultaneous acquisitions 14 | func NewSemaphore(n int) Semaphore { 15 | if n == 0 { 16 | panic("semaphore with limit 0") 17 | } 18 | ch := make(chan struct{}, n) 19 | return Semaphore(ch) 20 | } 21 | 22 | // Acquire is used to acquire an available slot. 23 | // Blocks until available. 24 | func (s Semaphore) Acquire() { 25 | s <- struct{}{} 26 | } 27 | 28 | // TryAcquire is used to do a non-blocking acquire. 29 | // Returns a bool indicating success 30 | func (s Semaphore) TryAcquire() bool { 31 | select { 32 | case s <- struct{}{}: 33 | return true 34 | default: 35 | return false 36 | } 37 | } 38 | 39 | // Release is used to return a slot. Acquire must 40 | // be called as a pre-condition. 41 | func (s Semaphore) Release() { 42 | select { 43 | case <-s: 44 | default: 45 | panic("release without an acquire") 46 | } 47 | } 48 | 49 | // resourceProvider returns the provider name for the given type. 50 | func resourceProvider(t, alias string) string { 51 | if alias != "" { 52 | return alias 53 | } 54 | 55 | idx := strings.IndexRune(t, '_') 56 | if idx == -1 { 57 | return "" 58 | } 59 | 60 | return t[:idx] 61 | } 62 | 63 | // strSliceContains checks if a given string is contained in a slice 64 | // When anybody asks why Go needs generics, here you go. 65 | func strSliceContains(haystack []string, needle string) bool { 66 | for _, s := range haystack { 67 | if s == needle { 68 | return true 69 | } 70 | } 71 | return false 72 | } 73 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/terraform/terraform/transform_proxy.go: -------------------------------------------------------------------------------- 1 | package terraform 2 | 3 | import ( 4 | "github.com/hashicorp/terraform/dag" 5 | ) 6 | 7 | // GraphNodeProxy must be implemented by nodes that are proxies. 8 | // 9 | // A node that is a proxy says that anything that depends on this 10 | // node (the proxy), should also copy all the things that the proxy 11 | // itself depends on. Example: 12 | // 13 | // A => proxy => C 14 | // 15 | // Should transform into (two edges): 16 | // 17 | // A => proxy => C 18 | // A => C 19 | // 20 | // The purpose for this is because some transforms only look at direct 21 | // edge connections and the proxy generally isn't meaningful in those 22 | // situations, so we should complete all the edges. 23 | type GraphNodeProxy interface { 24 | Proxy() bool 25 | } 26 | 27 | // ProxyTransformer is a transformer that goes through the graph, finds 28 | // vertices that are marked as proxies, and connects through their 29 | // dependents. See above for what a proxy is. 30 | type ProxyTransformer struct{} 31 | 32 | func (t *ProxyTransformer) Transform(g *Graph) error { 33 | for _, v := range g.Vertices() { 34 | pn, ok := v.(GraphNodeProxy) 35 | if !ok { 36 | continue 37 | } 38 | 39 | // If we don't want to be proxies, don't do it 40 | if !pn.Proxy() { 41 | continue 42 | } 43 | 44 | // Connect all the things that depend on this to things that 45 | // we depend on as the proxy. See docs for GraphNodeProxy for 46 | // a visual explanation. 47 | for _, s := range g.UpEdges(v).List() { 48 | for _, t := range g.DownEdges(v).List() { 49 | g.Connect(GraphProxyEdge{ 50 | Edge: dag.BasicEdge(s, t), 51 | }) 52 | } 53 | } 54 | } 55 | 56 | return nil 57 | } 58 | 59 | // GraphProxyEdge is the edge that is used for proxied edges. 60 | type GraphProxyEdge struct { 61 | dag.Edge 62 | } 63 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/terraform/flatmap/expand.go: -------------------------------------------------------------------------------- 1 | package flatmap 2 | 3 | import ( 4 | "fmt" 5 | "strconv" 6 | "strings" 7 | ) 8 | 9 | // Expand takes a map and a key (prefix) and expands that value into 10 | // a more complex structure. This is the reverse of the Flatten operation. 11 | func Expand(m map[string]string, key string) interface{} { 12 | // If the key is exactly a key in the map, just return it 13 | if v, ok := m[key]; ok { 14 | if v == "true" { 15 | return true 16 | } else if v == "false" { 17 | return false 18 | } 19 | 20 | return v 21 | } 22 | 23 | // Check if the key is an array, and if so, expand the array 24 | if _, ok := m[key+".#"]; ok { 25 | return expandArray(m, key) 26 | } 27 | 28 | // Check if this is a prefix in the map 29 | prefix := key + "." 30 | for k, _ := range m { 31 | if strings.HasPrefix(k, prefix) { 32 | return expandMap(m, prefix) 33 | } 34 | } 35 | 36 | return nil 37 | } 38 | 39 | func expandArray(m map[string]string, prefix string) []interface{} { 40 | num, err := strconv.ParseInt(m[prefix+".#"], 0, 0) 41 | if err != nil { 42 | panic(err) 43 | } 44 | 45 | result := make([]interface{}, num) 46 | for i := 0; i < int(num); i++ { 47 | result[i] = Expand(m, fmt.Sprintf("%s.%d", prefix, i)) 48 | } 49 | 50 | return result 51 | } 52 | 53 | func expandMap(m map[string]string, prefix string) map[string]interface{} { 54 | result := make(map[string]interface{}) 55 | for k, _ := range m { 56 | if !strings.HasPrefix(k, prefix) { 57 | continue 58 | } 59 | 60 | key := k[len(prefix):] 61 | idx := strings.Index(key, ".") 62 | if idx != -1 { 63 | key = key[:idx] 64 | } 65 | if _, ok := result[key]; ok { 66 | continue 67 | } 68 | 69 | // It contains a period, so it is a more complex structure 70 | result[key] = Expand(m, k[:len(prefix)+len(key)]) 71 | } 72 | 73 | return result 74 | } 75 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/go-getter/detect_file.go: -------------------------------------------------------------------------------- 1 | package getter 2 | 3 | import ( 4 | "fmt" 5 | "os" 6 | "path/filepath" 7 | "runtime" 8 | ) 9 | 10 | // FileDetector implements Detector to detect file paths. 11 | type FileDetector struct{} 12 | 13 | func (d *FileDetector) Detect(src, pwd string) (string, bool, error) { 14 | if len(src) == 0 { 15 | return "", false, nil 16 | } 17 | 18 | if !filepath.IsAbs(src) { 19 | if pwd == "" { 20 | return "", true, fmt.Errorf( 21 | "relative paths require a module with a pwd") 22 | } 23 | 24 | // Stat the pwd to determine if its a symbolic link. If it is, 25 | // then the pwd becomes the original directory. Otherwise, 26 | // `filepath.Join` below does some weird stuff. 27 | // 28 | // We just ignore if the pwd doesn't exist. That error will be 29 | // caught later when we try to use the URL. 30 | if fi, err := os.Lstat(pwd); !os.IsNotExist(err) { 31 | if err != nil { 32 | return "", true, err 33 | } 34 | if fi.Mode()&os.ModeSymlink != 0 { 35 | pwd, err = os.Readlink(pwd) 36 | if err != nil { 37 | return "", true, err 38 | } 39 | 40 | // The symlink itself might be a relative path, so we have to 41 | // resolve this to have a correctly rooted URL. 42 | pwd, err = filepath.Abs(pwd) 43 | if err != nil { 44 | return "", true, err 45 | } 46 | } 47 | } 48 | 49 | src = filepath.Join(pwd, src) 50 | } 51 | 52 | return fmtFileURL(src), true, nil 53 | } 54 | 55 | func fmtFileURL(path string) string { 56 | if runtime.GOOS == "windows" { 57 | // Make sure we're using "/" on Windows. URLs are "/"-based. 58 | path = filepath.ToSlash(path) 59 | return fmt.Sprintf("file://%s", path) 60 | } 61 | 62 | // Make sure that we don't start with "/" since we add that below. 63 | if path[0] == '/' { 64 | path = path[1:] 65 | } 66 | return fmt.Sprintf("file:///%s", path) 67 | } 68 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/go-getter/detect_s3.go: -------------------------------------------------------------------------------- 1 | package getter 2 | 3 | import ( 4 | "fmt" 5 | "net/url" 6 | "strings" 7 | ) 8 | 9 | // S3Detector implements Detector to detect S3 URLs and turn 10 | // them into URLs that the S3 getter can understand. 11 | type S3Detector struct{} 12 | 13 | func (d *S3Detector) Detect(src, _ string) (string, bool, error) { 14 | if len(src) == 0 { 15 | return "", false, nil 16 | } 17 | 18 | if strings.Contains(src, ".amazonaws.com/") { 19 | return d.detectHTTP(src) 20 | } 21 | 22 | return "", false, nil 23 | } 24 | 25 | func (d *S3Detector) detectHTTP(src string) (string, bool, error) { 26 | parts := strings.Split(src, "/") 27 | if len(parts) < 2 { 28 | return "", false, fmt.Errorf( 29 | "URL is not a valid S3 URL") 30 | } 31 | 32 | hostParts := strings.Split(parts[0], ".") 33 | if len(hostParts) == 3 { 34 | return d.detectPathStyle(hostParts[0], parts[1:]) 35 | } else if len(hostParts) == 4 { 36 | return d.detectVhostStyle(hostParts[1], hostParts[0], parts[1:]) 37 | } else { 38 | return "", false, fmt.Errorf( 39 | "URL is not a valid S3 URL") 40 | } 41 | } 42 | 43 | func (d *S3Detector) detectPathStyle(region string, parts []string) (string, bool, error) { 44 | urlStr := fmt.Sprintf("https://%s.amazonaws.com/%s", region, strings.Join(parts, "/")) 45 | url, err := url.Parse(urlStr) 46 | if err != nil { 47 | return "", false, fmt.Errorf("error parsing S3 URL: %s", err) 48 | } 49 | 50 | return "s3::" + url.String(), true, nil 51 | } 52 | 53 | func (d *S3Detector) detectVhostStyle(region, bucket string, parts []string) (string, bool, error) { 54 | urlStr := fmt.Sprintf("https://%s.amazonaws.com/%s/%s", region, bucket, strings.Join(parts, "/")) 55 | url, err := url.Parse(urlStr) 56 | if err != nil { 57 | return "", false, fmt.Errorf("error parsing S3 URL: %s", err) 58 | } 59 | 60 | return "s3::" + url.String(), true, nil 61 | } 62 | -------------------------------------------------------------------------------- /vendor/github.com/aws/aws-sdk-go/service/s3/unmarshal_error.go: -------------------------------------------------------------------------------- 1 | package s3 2 | 3 | import ( 4 | "encoding/xml" 5 | "fmt" 6 | "io" 7 | "io/ioutil" 8 | "net/http" 9 | "strings" 10 | 11 | "github.com/aws/aws-sdk-go/aws" 12 | "github.com/aws/aws-sdk-go/aws/awserr" 13 | "github.com/aws/aws-sdk-go/aws/request" 14 | ) 15 | 16 | type xmlErrorResponse struct { 17 | XMLName xml.Name `xml:"Error"` 18 | Code string `xml:"Code"` 19 | Message string `xml:"Message"` 20 | } 21 | 22 | func unmarshalError(r *request.Request) { 23 | defer r.HTTPResponse.Body.Close() 24 | defer io.Copy(ioutil.Discard, r.HTTPResponse.Body) 25 | 26 | // Bucket exists in a different region, and request needs 27 | // to be made to the correct region. 28 | if r.HTTPResponse.StatusCode == http.StatusMovedPermanently { 29 | r.Error = awserr.NewRequestFailure( 30 | awserr.New("BucketRegionError", 31 | fmt.Sprintf("incorrect region, the bucket is not in '%s' region", 32 | aws.StringValue(r.Config.Region)), 33 | nil), 34 | r.HTTPResponse.StatusCode, 35 | r.RequestID, 36 | ) 37 | return 38 | } 39 | 40 | var errCode, errMsg string 41 | 42 | // Attempt to parse error from body if it is known 43 | resp := &xmlErrorResponse{} 44 | err := xml.NewDecoder(r.HTTPResponse.Body).Decode(resp) 45 | if err != nil && err != io.EOF { 46 | errCode = "SerializationError" 47 | errMsg = "failed to decode S3 XML error response" 48 | } else { 49 | errCode = resp.Code 50 | errMsg = resp.Message 51 | } 52 | 53 | // Fallback to status code converted to message if still no error code 54 | if len(errCode) == 0 { 55 | statusText := http.StatusText(r.HTTPResponse.StatusCode) 56 | errCode = strings.Replace(statusText, " ", "", -1) 57 | errMsg = statusText 58 | } 59 | 60 | r.Error = awserr.NewRequestFailure( 61 | awserr.New(errCode, errMsg, nil), 62 | r.HTTPResponse.StatusCode, 63 | r.RequestID, 64 | ) 65 | } 66 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/go-getter/copy_dir.go: -------------------------------------------------------------------------------- 1 | package getter 2 | 3 | import ( 4 | "io" 5 | "os" 6 | "path/filepath" 7 | "strings" 8 | ) 9 | 10 | // copyDir copies the src directory contents into dst. Both directories 11 | // should already exist. 12 | // 13 | // If ignoreDot is set to true, then dot-prefixed files/folders are ignored. 14 | func copyDir(dst string, src string, ignoreDot bool) error { 15 | src, err := filepath.EvalSymlinks(src) 16 | if err != nil { 17 | return err 18 | } 19 | 20 | walkFn := func(path string, info os.FileInfo, err error) error { 21 | if err != nil { 22 | return err 23 | } 24 | if path == src { 25 | return nil 26 | } 27 | 28 | if ignoreDot && strings.HasPrefix(filepath.Base(path), ".") { 29 | // Skip any dot files 30 | if info.IsDir() { 31 | return filepath.SkipDir 32 | } else { 33 | return nil 34 | } 35 | } 36 | 37 | // The "path" has the src prefixed to it. We need to join our 38 | // destination with the path without the src on it. 39 | dstPath := filepath.Join(dst, path[len(src):]) 40 | 41 | // If we have a directory, make that subdirectory, then continue 42 | // the walk. 43 | if info.IsDir() { 44 | if path == filepath.Join(src, dst) { 45 | // dst is in src; don't walk it. 46 | return nil 47 | } 48 | 49 | if err := os.MkdirAll(dstPath, 0755); err != nil { 50 | return err 51 | } 52 | 53 | return nil 54 | } 55 | 56 | // If we have a file, copy the contents. 57 | srcF, err := os.Open(path) 58 | if err != nil { 59 | return err 60 | } 61 | defer srcF.Close() 62 | 63 | dstF, err := os.Create(dstPath) 64 | if err != nil { 65 | return err 66 | } 67 | defer dstF.Close() 68 | 69 | if _, err := io.Copy(dstF, srcF); err != nil { 70 | return err 71 | } 72 | 73 | // Chmod it 74 | return os.Chmod(dstPath, info.Mode()) 75 | } 76 | 77 | return filepath.Walk(src, walkFn) 78 | } 79 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/go-getter/detect_bitbucket.go: -------------------------------------------------------------------------------- 1 | package getter 2 | 3 | import ( 4 | "encoding/json" 5 | "fmt" 6 | "net/http" 7 | "net/url" 8 | "strings" 9 | ) 10 | 11 | // BitBucketDetector implements Detector to detect BitBucket URLs and turn 12 | // them into URLs that the Git or Hg Getter can understand. 13 | type BitBucketDetector struct{} 14 | 15 | func (d *BitBucketDetector) Detect(src, _ string) (string, bool, error) { 16 | if len(src) == 0 { 17 | return "", false, nil 18 | } 19 | 20 | if strings.HasPrefix(src, "bitbucket.org/") { 21 | return d.detectHTTP(src) 22 | } 23 | 24 | return "", false, nil 25 | } 26 | 27 | func (d *BitBucketDetector) detectHTTP(src string) (string, bool, error) { 28 | u, err := url.Parse("https://" + src) 29 | if err != nil { 30 | return "", true, fmt.Errorf("error parsing BitBucket URL: %s", err) 31 | } 32 | 33 | // We need to get info on this BitBucket repository to determine whether 34 | // it is Git or Hg. 35 | var info struct { 36 | SCM string `json:"scm"` 37 | } 38 | infoUrl := "https://api.bitbucket.org/1.0/repositories" + u.Path 39 | resp, err := http.Get(infoUrl) 40 | if err != nil { 41 | return "", true, fmt.Errorf("error looking up BitBucket URL: %s", err) 42 | } 43 | if resp.StatusCode == 403 { 44 | // A private repo 45 | return "", true, fmt.Errorf( 46 | "shorthand BitBucket URL can't be used for private repos, " + 47 | "please use a full URL") 48 | } 49 | dec := json.NewDecoder(resp.Body) 50 | if err := dec.Decode(&info); err != nil { 51 | return "", true, fmt.Errorf("error looking up BitBucket URL: %s", err) 52 | } 53 | 54 | switch info.SCM { 55 | case "git": 56 | if !strings.HasSuffix(u.Path, ".git") { 57 | u.Path += ".git" 58 | } 59 | 60 | return "git::" + u.String(), true, nil 61 | case "hg": 62 | return "hg::" + u.String(), true, nil 63 | default: 64 | return "", true, fmt.Errorf("unknown BitBucket SCM type: %s", info.SCM) 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/go-getter/detect_github.go: -------------------------------------------------------------------------------- 1 | package getter 2 | 3 | import ( 4 | "fmt" 5 | "net/url" 6 | "strings" 7 | ) 8 | 9 | // GitHubDetector implements Detector to detect GitHub URLs and turn 10 | // them into URLs that the Git Getter can understand. 11 | type GitHubDetector struct{} 12 | 13 | func (d *GitHubDetector) Detect(src, _ string) (string, bool, error) { 14 | if len(src) == 0 { 15 | return "", false, nil 16 | } 17 | 18 | if strings.HasPrefix(src, "github.com/") { 19 | return d.detectHTTP(src) 20 | } else if strings.HasPrefix(src, "git@github.com:") { 21 | return d.detectSSH(src) 22 | } 23 | 24 | return "", false, nil 25 | } 26 | 27 | func (d *GitHubDetector) detectHTTP(src string) (string, bool, error) { 28 | parts := strings.Split(src, "/") 29 | if len(parts) < 3 { 30 | return "", false, fmt.Errorf( 31 | "GitHub URLs should be github.com/username/repo") 32 | } 33 | 34 | urlStr := fmt.Sprintf("https://%s", strings.Join(parts[:3], "/")) 35 | url, err := url.Parse(urlStr) 36 | if err != nil { 37 | return "", true, fmt.Errorf("error parsing GitHub URL: %s", err) 38 | } 39 | 40 | if !strings.HasSuffix(url.Path, ".git") { 41 | url.Path += ".git" 42 | } 43 | 44 | if len(parts) > 3 { 45 | url.Path += "//" + strings.Join(parts[3:], "/") 46 | } 47 | 48 | return "git::" + url.String(), true, nil 49 | } 50 | 51 | func (d *GitHubDetector) detectSSH(src string) (string, bool, error) { 52 | idx := strings.Index(src, ":") 53 | qidx := strings.Index(src, "?") 54 | if qidx == -1 { 55 | qidx = len(src) 56 | } 57 | 58 | var u url.URL 59 | u.Scheme = "ssh" 60 | u.User = url.User("git") 61 | u.Host = "github.com" 62 | u.Path = src[idx+1 : qidx] 63 | if qidx < len(src) { 64 | q, err := url.ParseQuery(src[qidx+1:]) 65 | if err != nil { 66 | return "", true, fmt.Errorf("error parsing GitHub SSH URL: %s", err) 67 | } 68 | 69 | u.RawQuery = q.Encode() 70 | } 71 | 72 | return "git::" + u.String(), true, nil 73 | } 74 | -------------------------------------------------------------------------------- /vendor/github.com/aws/aws-sdk-go/aws/credentials/static_provider.go: -------------------------------------------------------------------------------- 1 | package credentials 2 | 3 | import ( 4 | "github.com/aws/aws-sdk-go/aws/awserr" 5 | ) 6 | 7 | // StaticProviderName provides a name of Static provider 8 | const StaticProviderName = "StaticProvider" 9 | 10 | var ( 11 | // ErrStaticCredentialsEmpty is emitted when static credentials are empty. 12 | // 13 | // @readonly 14 | ErrStaticCredentialsEmpty = awserr.New("EmptyStaticCreds", "static credentials are empty", nil) 15 | ) 16 | 17 | // A StaticProvider is a set of credentials which are set programmatically, 18 | // and will never expire. 19 | type StaticProvider struct { 20 | Value 21 | } 22 | 23 | // NewStaticCredentials returns a pointer to a new Credentials object 24 | // wrapping a static credentials value provider. 25 | func NewStaticCredentials(id, secret, token string) *Credentials { 26 | return NewCredentials(&StaticProvider{Value: Value{ 27 | AccessKeyID: id, 28 | SecretAccessKey: secret, 29 | SessionToken: token, 30 | }}) 31 | } 32 | 33 | // NewStaticCredentialsFromCreds returns a pointer to a new Credentials object 34 | // wrapping the static credentials value provide. Same as NewStaticCredentials 35 | // but takes the creds Value instead of individual fields 36 | func NewStaticCredentialsFromCreds(creds Value) *Credentials { 37 | return NewCredentials(&StaticProvider{Value: creds}) 38 | } 39 | 40 | // Retrieve returns the credentials or error if the credentials are invalid. 41 | func (s *StaticProvider) Retrieve() (Value, error) { 42 | if s.AccessKeyID == "" || s.SecretAccessKey == "" { 43 | return Value{ProviderName: StaticProviderName}, ErrStaticCredentialsEmpty 44 | } 45 | 46 | if len(s.Value.ProviderName) == 0 { 47 | s.Value.ProviderName = StaticProviderName 48 | } 49 | return s.Value, nil 50 | } 51 | 52 | // IsExpired returns if the credentials are expired. 53 | // 54 | // For StaticProvider, the credentials never expired. 55 | func (s *StaticProvider) IsExpired() bool { 56 | return false 57 | } 58 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/terraform/dag/set.go: -------------------------------------------------------------------------------- 1 | package dag 2 | 3 | import ( 4 | "sync" 5 | ) 6 | 7 | // Set is a set data structure. 8 | type Set struct { 9 | m map[interface{}]interface{} 10 | once sync.Once 11 | } 12 | 13 | // Hashable is the interface used by set to get the hash code of a value. 14 | // If this isn't given, then the value of the item being added to the set 15 | // itself is used as the comparison value. 16 | type Hashable interface { 17 | Hashcode() interface{} 18 | } 19 | 20 | // hashcode returns the hashcode used for set elements. 21 | func hashcode(v interface{}) interface{} { 22 | if h, ok := v.(Hashable); ok { 23 | return h.Hashcode() 24 | } 25 | 26 | return v 27 | } 28 | 29 | // Add adds an item to the set 30 | func (s *Set) Add(v interface{}) { 31 | s.once.Do(s.init) 32 | s.m[hashcode(v)] = v 33 | } 34 | 35 | // Delete removes an item from the set. 36 | func (s *Set) Delete(v interface{}) { 37 | s.once.Do(s.init) 38 | delete(s.m, hashcode(v)) 39 | } 40 | 41 | // Include returns true/false of whether a value is in the set. 42 | func (s *Set) Include(v interface{}) bool { 43 | s.once.Do(s.init) 44 | _, ok := s.m[hashcode(v)] 45 | return ok 46 | } 47 | 48 | // Intersection computes the set intersection with other. 49 | func (s *Set) Intersection(other *Set) *Set { 50 | result := new(Set) 51 | if other != nil { 52 | for _, v := range s.m { 53 | if other.Include(v) { 54 | result.Add(v) 55 | } 56 | } 57 | } 58 | 59 | return result 60 | } 61 | 62 | // Len is the number of items in the set. 63 | func (s *Set) Len() int { 64 | if s == nil { 65 | return 0 66 | } 67 | 68 | return len(s.m) 69 | } 70 | 71 | // List returns the list of set elements. 72 | func (s *Set) List() []interface{} { 73 | if s == nil { 74 | return nil 75 | } 76 | 77 | r := make([]interface{}, 0, len(s.m)) 78 | for _, v := range s.m { 79 | r = append(r, v) 80 | } 81 | 82 | return r 83 | } 84 | 85 | func (s *Set) init() { 86 | s.m = make(map[interface{}]interface{}) 87 | } 88 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/terraform/flatmap/flatten.go: -------------------------------------------------------------------------------- 1 | package flatmap 2 | 3 | import ( 4 | "fmt" 5 | "reflect" 6 | ) 7 | 8 | // Flatten takes a structure and turns into a flat map[string]string. 9 | // 10 | // Within the "thing" parameter, only primitive values are allowed. Structs are 11 | // not supported. Therefore, it can only be slices, maps, primitives, and 12 | // any combination of those together. 13 | // 14 | // See the tests for examples of what inputs are turned into. 15 | func Flatten(thing map[string]interface{}) Map { 16 | result := make(map[string]string) 17 | 18 | for k, raw := range thing { 19 | flatten(result, k, reflect.ValueOf(raw)) 20 | } 21 | 22 | return Map(result) 23 | } 24 | 25 | func flatten(result map[string]string, prefix string, v reflect.Value) { 26 | if v.Kind() == reflect.Interface { 27 | v = v.Elem() 28 | } 29 | 30 | switch v.Kind() { 31 | case reflect.Bool: 32 | if v.Bool() { 33 | result[prefix] = "true" 34 | } else { 35 | result[prefix] = "false" 36 | } 37 | case reflect.Int: 38 | result[prefix] = fmt.Sprintf("%d", v.Int()) 39 | case reflect.Map: 40 | flattenMap(result, prefix, v) 41 | case reflect.Slice: 42 | flattenSlice(result, prefix, v) 43 | case reflect.String: 44 | result[prefix] = v.String() 45 | default: 46 | panic(fmt.Sprintf("Unknown: %s", v)) 47 | } 48 | } 49 | 50 | func flattenMap(result map[string]string, prefix string, v reflect.Value) { 51 | for _, k := range v.MapKeys() { 52 | if k.Kind() == reflect.Interface { 53 | k = k.Elem() 54 | } 55 | 56 | if k.Kind() != reflect.String { 57 | panic(fmt.Sprintf("%s: map key is not string: %s", prefix, k)) 58 | } 59 | 60 | flatten(result, fmt.Sprintf("%s.%s", prefix, k.String()), v.MapIndex(k)) 61 | } 62 | } 63 | 64 | func flattenSlice(result map[string]string, prefix string, v reflect.Value) { 65 | prefix = prefix + "." 66 | 67 | result[prefix+"#"] = fmt.Sprintf("%d", v.Len()) 68 | for i := 0; i < v.Len(); i++ { 69 | flatten(result, fmt.Sprintf("%s%d", prefix, i), v.Index(i)) 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/terraform/terraform/eval_import_state.go: -------------------------------------------------------------------------------- 1 | package terraform 2 | 3 | import ( 4 | "fmt" 5 | ) 6 | 7 | // EvalImportState is an EvalNode implementation that performs an 8 | // ImportState operation on a provider. This will return the imported 9 | // states but won't modify any actual state. 10 | type EvalImportState struct { 11 | Provider *ResourceProvider 12 | Info *InstanceInfo 13 | Id string 14 | Output *[]*InstanceState 15 | } 16 | 17 | // TODO: test 18 | func (n *EvalImportState) Eval(ctx EvalContext) (interface{}, error) { 19 | provider := *n.Provider 20 | 21 | { 22 | // Call pre-import hook 23 | err := ctx.Hook(func(h Hook) (HookAction, error) { 24 | return h.PreImportState(n.Info, n.Id) 25 | }) 26 | if err != nil { 27 | return nil, err 28 | } 29 | } 30 | 31 | // Import! 32 | state, err := provider.ImportState(n.Info, n.Id) 33 | if err != nil { 34 | return nil, fmt.Errorf( 35 | "import %s (id: %s): %s", n.Info.HumanId(), n.Id, err) 36 | } 37 | 38 | if n.Output != nil { 39 | *n.Output = state 40 | } 41 | 42 | { 43 | // Call post-import hook 44 | err := ctx.Hook(func(h Hook) (HookAction, error) { 45 | return h.PostImportState(n.Info, state) 46 | }) 47 | if err != nil { 48 | return nil, err 49 | } 50 | } 51 | 52 | return nil, nil 53 | } 54 | 55 | // EvalImportStateVerify verifies the state after ImportState and 56 | // after the refresh to make sure it is non-nil and valid. 57 | type EvalImportStateVerify struct { 58 | Info *InstanceInfo 59 | Id string 60 | State **InstanceState 61 | } 62 | 63 | // TODO: test 64 | func (n *EvalImportStateVerify) Eval(ctx EvalContext) (interface{}, error) { 65 | state := *n.State 66 | if state.Empty() { 67 | return nil, fmt.Errorf( 68 | "import %s (id: %s): Terraform detected a resource with this ID doesn't\n"+ 69 | "exist. Please verify the ID is correct. You cannot import non-existent\n"+ 70 | "resources using Terraform import.", 71 | n.Info.HumanId(), 72 | n.Id) 73 | } 74 | 75 | return nil, nil 76 | } 77 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/terraform/terraform/graph_builder_import.go: -------------------------------------------------------------------------------- 1 | package terraform 2 | 3 | import ( 4 | "github.com/hashicorp/terraform/config/module" 5 | ) 6 | 7 | // ImportGraphBuilder implements GraphBuilder and is responsible for building 8 | // a graph for importing resources into Terraform. This is a much, much 9 | // simpler graph than a normal configuration graph. 10 | type ImportGraphBuilder struct { 11 | // ImportTargets are the list of resources to import. 12 | ImportTargets []*ImportTarget 13 | 14 | // Module is the module to add to the graph. See ImportOpts.Module. 15 | Module *module.Tree 16 | 17 | // Providers is the list of providers supported. 18 | Providers []string 19 | } 20 | 21 | // Build builds the graph according to the steps returned by Steps. 22 | func (b *ImportGraphBuilder) Build(path []string) (*Graph, error) { 23 | return (&BasicGraphBuilder{ 24 | Steps: b.Steps(), 25 | Validate: true, 26 | }).Build(path) 27 | } 28 | 29 | // Steps returns the ordered list of GraphTransformers that must be executed 30 | // to build a complete graph. 31 | func (b *ImportGraphBuilder) Steps() []GraphTransformer { 32 | // Get the module. If we don't have one, we just use an empty tree 33 | // so that the transform still works but does nothing. 34 | mod := b.Module 35 | if mod == nil { 36 | mod = module.NewEmptyTree() 37 | } 38 | 39 | steps := []GraphTransformer{ 40 | // Create all our resources from the configuration and state 41 | &ConfigTransformer{Module: mod}, 42 | 43 | // Add the import steps 44 | &ImportStateTransformer{Targets: b.ImportTargets}, 45 | 46 | // Provider-related transformations 47 | &MissingProviderTransformer{Providers: b.Providers}, 48 | &ProviderTransformer{}, 49 | &DisableProviderTransformer{}, 50 | &PruneProviderTransformer{}, 51 | 52 | // Single root 53 | &RootTransformer{}, 54 | 55 | // Insert nodes to close opened plugin connections 56 | &CloseProviderTransformer{}, 57 | 58 | // Optimize 59 | &TransitiveReductionTransformer{}, 60 | } 61 | 62 | return steps 63 | } 64 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/terraform/terraform/transform_expand.go: -------------------------------------------------------------------------------- 1 | package terraform 2 | 3 | import ( 4 | "log" 5 | 6 | "github.com/hashicorp/terraform/dag" 7 | ) 8 | 9 | // GraphNodeExapndable is an interface that nodes can implement to 10 | // signal that they can be expanded. Expanded nodes turn into 11 | // GraphNodeSubgraph nodes within the graph. 12 | type GraphNodeExpandable interface { 13 | Expand(GraphBuilder) (GraphNodeSubgraph, error) 14 | } 15 | 16 | // GraphNodeDynamicExpandable is an interface that nodes can implement 17 | // to signal that they can be expanded at eval-time (hence dynamic). 18 | // These nodes are given the eval context and are expected to return 19 | // a new subgraph. 20 | type GraphNodeDynamicExpandable interface { 21 | DynamicExpand(EvalContext) (*Graph, error) 22 | } 23 | 24 | // GraphNodeSubgraph is an interface a node can implement if it has 25 | // a larger subgraph that should be walked. 26 | type GraphNodeSubgraph interface { 27 | Subgraph() *Graph 28 | } 29 | 30 | // ExpandTransform is a transformer that does a subgraph expansion 31 | // at graph transform time (vs. at eval time). The benefit of earlier 32 | // subgraph expansion is that errors with the graph build can be detected 33 | // at an earlier stage. 34 | type ExpandTransform struct { 35 | Builder GraphBuilder 36 | } 37 | 38 | func (t *ExpandTransform) Transform(v dag.Vertex) (dag.Vertex, error) { 39 | ev, ok := v.(GraphNodeExpandable) 40 | if !ok { 41 | // This isn't an expandable vertex, so just ignore it. 42 | return v, nil 43 | } 44 | 45 | // Expand the subgraph! 46 | log.Printf("[DEBUG] vertex %s: static expanding", dag.VertexName(ev)) 47 | return ev.Expand(t.Builder) 48 | } 49 | 50 | type GraphNodeBasicSubgraph struct { 51 | NameValue string 52 | Graph *Graph 53 | } 54 | 55 | func (n *GraphNodeBasicSubgraph) Name() string { 56 | return n.NameValue 57 | } 58 | 59 | func (n *GraphNodeBasicSubgraph) Subgraph() *Graph { 60 | return n.Graph 61 | } 62 | 63 | func (n *GraphNodeBasicSubgraph) FlattenGraph() *Graph { 64 | return n.Graph 65 | } 66 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/terraform/terraform/eval.go: -------------------------------------------------------------------------------- 1 | package terraform 2 | 3 | import ( 4 | "log" 5 | "strings" 6 | ) 7 | 8 | // EvalNode is the interface that must be implemented by graph nodes to 9 | // evaluate/execute. 10 | type EvalNode interface { 11 | // Eval evaluates this node with the given context. The second parameter 12 | // are the argument values. These will match in order and 1-1 with the 13 | // results of the Args() return value. 14 | Eval(EvalContext) (interface{}, error) 15 | } 16 | 17 | // GraphNodeEvalable is the interface that graph nodes must implement 18 | // to enable valuation. 19 | type GraphNodeEvalable interface { 20 | EvalTree() EvalNode 21 | } 22 | 23 | // EvalEarlyExitError is a special error return value that can be returned 24 | // by eval nodes that does an early exit. 25 | type EvalEarlyExitError struct{} 26 | 27 | func (EvalEarlyExitError) Error() string { return "early exit" } 28 | 29 | // Eval evaluates the given EvalNode with the given context, properly 30 | // evaluating all args in the correct order. 31 | func Eval(n EvalNode, ctx EvalContext) (interface{}, error) { 32 | // Call the lower level eval which doesn't understand early exit, 33 | // and if we early exit, it isn't an error. 34 | result, err := EvalRaw(n, ctx) 35 | if err != nil { 36 | if _, ok := err.(EvalEarlyExitError); ok { 37 | return nil, nil 38 | } 39 | } 40 | 41 | return result, err 42 | } 43 | 44 | // EvalRaw is like Eval except that it returns all errors, even if they 45 | // signal something normal such as EvalEarlyExitError. 46 | func EvalRaw(n EvalNode, ctx EvalContext) (interface{}, error) { 47 | path := "unknown" 48 | if ctx != nil { 49 | path = strings.Join(ctx.Path(), ".") 50 | } 51 | 52 | log.Printf("[DEBUG] %s: eval: %T", path, n) 53 | output, err := n.Eval(ctx) 54 | if err != nil { 55 | if _, ok := err.(EvalEarlyExitError); ok { 56 | log.Printf("[DEBUG] %s: eval: %T, err: %s", path, n, err) 57 | } else { 58 | log.Printf("[ERROR] %s: eval: %T, err: %s", path, n, err) 59 | } 60 | } 61 | 62 | return output, err 63 | } 64 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/go-version/README.md: -------------------------------------------------------------------------------- 1 | # Versioning Library for Go 2 | [![Build Status](https://travis-ci.org/hashicorp/go-version.svg?branch=master)](https://travis-ci.org/hashicorp/go-version) 3 | 4 | go-version is a library for parsing versions and version constraints, 5 | and verifying versions against a set of constraints. go-version 6 | can sort a collection of versions properly, handles prerelease/beta 7 | versions, can increment versions, etc. 8 | 9 | Versions used with go-version must follow [SemVer](http://semver.org/). 10 | 11 | ## Installation and Usage 12 | 13 | Package documentation can be found on 14 | [GoDoc](http://godoc.org/github.com/hashicorp/go-version). 15 | 16 | Installation can be done with a normal `go get`: 17 | 18 | ``` 19 | $ go get github.com/hashicorp/go-version 20 | ``` 21 | 22 | #### Version Parsing and Comparison 23 | 24 | ```go 25 | v1, err := version.NewVersion("1.2") 26 | v2, err := version.NewVersion("1.5+metadata") 27 | 28 | // Comparison example. There is also GreaterThan, Equal, and just 29 | // a simple Compare that returns an int allowing easy >=, <=, etc. 30 | if v1.LessThan(v2) { 31 | fmt.Printf("%s is less than %s", v1, v2) 32 | } 33 | ``` 34 | 35 | #### Version Constraints 36 | 37 | ```go 38 | v1, err := version.NewVersion("1.2") 39 | 40 | // Constraints example. 41 | constraints, err := version.NewConstraint(">= 1.0, < 1.4") 42 | if constraints.Check(v1) { 43 | fmt.Printf("%s satisfies constraints %s", v1, constraints) 44 | } 45 | ``` 46 | 47 | #### Version Sorting 48 | 49 | ```go 50 | versionsRaw := []string{"1.1", "0.7.1", "1.4-beta", "1.4", "2"} 51 | versions := make([]*version.Version, len(versionsRaw)) 52 | for i, raw := range versionsRaw { 53 | v, _ := version.NewVersion(raw) 54 | versions[i] = v 55 | } 56 | 57 | // After this, the versions are properly sorted 58 | sort.Sort(version.Collection(versions)) 59 | ``` 60 | 61 | ## Issues and Contributing 62 | 63 | If you find an issue with this library, please report an issue. If you'd 64 | like, we welcome any contributions. Fork this library and submit a pull 65 | request. 66 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/hil/ast/output.go: -------------------------------------------------------------------------------- 1 | package ast 2 | 3 | import ( 4 | "bytes" 5 | "fmt" 6 | ) 7 | 8 | // Output represents the root node of all interpolation evaluations. If the 9 | // output only has one expression which is either a TypeList or TypeMap, the 10 | // Output can be type-asserted to []interface{} or map[string]interface{} 11 | // respectively. Otherwise the Output evaluates as a string, and concatenates 12 | // the evaluation of each expression. 13 | type Output struct { 14 | Exprs []Node 15 | Posx Pos 16 | } 17 | 18 | func (n *Output) Accept(v Visitor) Node { 19 | for i, expr := range n.Exprs { 20 | n.Exprs[i] = expr.Accept(v) 21 | } 22 | 23 | return v(n) 24 | } 25 | 26 | func (n *Output) Pos() Pos { 27 | return n.Posx 28 | } 29 | 30 | func (n *Output) GoString() string { 31 | return fmt.Sprintf("*%#v", *n) 32 | } 33 | 34 | func (n *Output) String() string { 35 | var b bytes.Buffer 36 | for _, expr := range n.Exprs { 37 | b.WriteString(fmt.Sprintf("%s", expr)) 38 | } 39 | 40 | return b.String() 41 | } 42 | 43 | func (n *Output) Type(s Scope) (Type, error) { 44 | // Special case no expressions for backward compatibility 45 | if len(n.Exprs) == 0 { 46 | return TypeString, nil 47 | } 48 | 49 | // Special case a single expression of types list or map 50 | if len(n.Exprs) == 1 { 51 | exprType, err := n.Exprs[0].Type(s) 52 | if err != nil { 53 | return TypeInvalid, err 54 | } 55 | switch exprType { 56 | case TypeList: 57 | return TypeList, nil 58 | case TypeMap: 59 | return TypeMap, nil 60 | } 61 | } 62 | 63 | // Otherwise ensure all our expressions are strings 64 | for index, expr := range n.Exprs { 65 | exprType, err := expr.Type(s) 66 | if err != nil { 67 | return TypeInvalid, err 68 | } 69 | // We only look for things we know we can't coerce with an implicit conversion func 70 | if exprType == TypeList || exprType == TypeMap { 71 | return TypeInvalid, fmt.Errorf( 72 | "multi-expression HIL outputs may only have string inputs: %d is type %s", 73 | index, exprType) 74 | } 75 | } 76 | 77 | return TypeString, nil 78 | } 79 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/hil/ast/index.go: -------------------------------------------------------------------------------- 1 | package ast 2 | 3 | import ( 4 | "fmt" 5 | "strings" 6 | ) 7 | 8 | // Index represents an indexing operation into another data structure 9 | type Index struct { 10 | Target Node 11 | Key Node 12 | Posx Pos 13 | } 14 | 15 | func (n *Index) Accept(v Visitor) Node { 16 | return v(n) 17 | } 18 | 19 | func (n *Index) Pos() Pos { 20 | return n.Posx 21 | } 22 | 23 | func (n *Index) String() string { 24 | return fmt.Sprintf("Index(%s, %s)", n.Target, n.Key) 25 | } 26 | 27 | func (n *Index) Type(s Scope) (Type, error) { 28 | variableAccess, ok := n.Target.(*VariableAccess) 29 | if !ok { 30 | return TypeInvalid, fmt.Errorf("target is not a variable") 31 | } 32 | 33 | variable, ok := s.LookupVar(variableAccess.Name) 34 | if !ok { 35 | return TypeInvalid, fmt.Errorf("unknown variable accessed: %s", variableAccess.Name) 36 | } 37 | 38 | switch variable.Type { 39 | case TypeList: 40 | return n.typeList(variable, variableAccess.Name) 41 | case TypeMap: 42 | return n.typeMap(variable, variableAccess.Name) 43 | default: 44 | return TypeInvalid, fmt.Errorf("invalid index operation into non-indexable type: %s", variable.Type) 45 | } 46 | } 47 | 48 | func (n *Index) typeList(variable Variable, variableName string) (Type, error) { 49 | // We assume type checking has already determined that this is a list 50 | list := variable.Value.([]Variable) 51 | 52 | return VariableListElementTypesAreHomogenous(variableName, list) 53 | } 54 | 55 | func (n *Index) typeMap(variable Variable, variableName string) (Type, error) { 56 | // We assume type checking has already determined that this is a map 57 | vmap := variable.Value.(map[string]Variable) 58 | 59 | return VariableMapValueTypesAreHomogenous(variableName, vmap) 60 | } 61 | 62 | func reportTypes(typesFound map[Type]struct{}) string { 63 | stringTypes := make([]string, len(typesFound)) 64 | i := 0 65 | for k, _ := range typesFound { 66 | stringTypes[0] = k.String() 67 | i++ 68 | } 69 | return strings.Join(stringTypes, ", ") 70 | } 71 | 72 | func (n *Index) GoString() string { 73 | return fmt.Sprintf("*%#v", *n) 74 | } 75 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/terraform/flatmap/map.go: -------------------------------------------------------------------------------- 1 | package flatmap 2 | 3 | import ( 4 | "strings" 5 | ) 6 | 7 | // Map is a wrapper around map[string]string that provides some helpers 8 | // above it that assume the map is in the format that flatmap expects 9 | // (the result of Flatten). 10 | // 11 | // All modifying functions such as Delete are done in-place unless 12 | // otherwise noted. 13 | type Map map[string]string 14 | 15 | // Contains returns true if the map contains the given key. 16 | func (m Map) Contains(key string) bool { 17 | for _, k := range m.Keys() { 18 | if k == key { 19 | return true 20 | } 21 | } 22 | 23 | return false 24 | } 25 | 26 | // Delete deletes a key out of the map with the given prefix. 27 | func (m Map) Delete(prefix string) { 28 | for k, _ := range m { 29 | match := k == prefix 30 | if !match { 31 | if !strings.HasPrefix(k, prefix) { 32 | continue 33 | } 34 | 35 | if k[len(prefix):len(prefix)+1] != "." { 36 | continue 37 | } 38 | } 39 | 40 | delete(m, k) 41 | } 42 | } 43 | 44 | // Keys returns all of the top-level keys in this map 45 | func (m Map) Keys() []string { 46 | ks := make(map[string]struct{}) 47 | for k, _ := range m { 48 | idx := strings.Index(k, ".") 49 | if idx == -1 { 50 | idx = len(k) 51 | } 52 | 53 | ks[k[:idx]] = struct{}{} 54 | } 55 | 56 | result := make([]string, 0, len(ks)) 57 | for k, _ := range ks { 58 | result = append(result, k) 59 | } 60 | 61 | return result 62 | } 63 | 64 | // Merge merges the contents of the other Map into this one. 65 | // 66 | // This merge is smarter than a simple map iteration because it 67 | // will fully replace arrays and other complex structures that 68 | // are present in this map with the other map's. For example, if 69 | // this map has a 3 element "foo" list, and m2 has a 2 element "foo" 70 | // list, then the result will be that m has a 2 element "foo" 71 | // list. 72 | func (m Map) Merge(m2 Map) { 73 | for _, prefix := range m2.Keys() { 74 | m.Delete(prefix) 75 | 76 | for k, v := range m2 { 77 | if strings.HasPrefix(k, prefix) { 78 | m[k] = v 79 | } 80 | } 81 | } 82 | } 83 | -------------------------------------------------------------------------------- /vendor/github.com/aws/aws-sdk-go/private/protocol/query/unmarshal_error.go: -------------------------------------------------------------------------------- 1 | package query 2 | 3 | import ( 4 | "encoding/xml" 5 | "io/ioutil" 6 | 7 | "github.com/aws/aws-sdk-go/aws/awserr" 8 | "github.com/aws/aws-sdk-go/aws/request" 9 | ) 10 | 11 | type xmlErrorResponse struct { 12 | XMLName xml.Name `xml:"ErrorResponse"` 13 | Code string `xml:"Error>Code"` 14 | Message string `xml:"Error>Message"` 15 | RequestID string `xml:"RequestId"` 16 | } 17 | 18 | type xmlServiceUnavailableResponse struct { 19 | XMLName xml.Name `xml:"ServiceUnavailableException"` 20 | } 21 | 22 | // UnmarshalErrorHandler is a name request handler to unmarshal request errors 23 | var UnmarshalErrorHandler = request.NamedHandler{Name: "awssdk.query.UnmarshalError", Fn: UnmarshalError} 24 | 25 | // UnmarshalError unmarshals an error response for an AWS Query service. 26 | func UnmarshalError(r *request.Request) { 27 | defer r.HTTPResponse.Body.Close() 28 | 29 | bodyBytes, err := ioutil.ReadAll(r.HTTPResponse.Body) 30 | if err != nil { 31 | r.Error = awserr.New("SerializationError", "failed to read from query HTTP response body", err) 32 | return 33 | } 34 | 35 | // First check for specific error 36 | resp := xmlErrorResponse{} 37 | decodeErr := xml.Unmarshal(bodyBytes, &resp) 38 | if decodeErr == nil { 39 | reqID := resp.RequestID 40 | if reqID == "" { 41 | reqID = r.RequestID 42 | } 43 | r.Error = awserr.NewRequestFailure( 44 | awserr.New(resp.Code, resp.Message, nil), 45 | r.HTTPResponse.StatusCode, 46 | reqID, 47 | ) 48 | return 49 | } 50 | 51 | // Check for unhandled error 52 | servUnavailResp := xmlServiceUnavailableResponse{} 53 | unavailErr := xml.Unmarshal(bodyBytes, &servUnavailResp) 54 | if unavailErr == nil { 55 | r.Error = awserr.NewRequestFailure( 56 | awserr.New("ServiceUnavailableException", "service is unavailable", nil), 57 | r.HTTPResponse.StatusCode, 58 | r.RequestID, 59 | ) 60 | return 61 | } 62 | 63 | // Failed to retrieve any error message from the response body 64 | r.Error = awserr.New("SerializationError", 65 | "failed to decode query XML error response", decodeErr) 66 | } 67 | -------------------------------------------------------------------------------- /vendor/github.com/satori/go.uuid/README.md: -------------------------------------------------------------------------------- 1 | # UUID package for Go language 2 | 3 | [![Build Status](https://travis-ci.org/satori/go.uuid.png?branch=master)](https://travis-ci.org/satori/go.uuid) 4 | [![GoDoc](http://godoc.org/github.com/satori/go.uuid?status.png)](http://godoc.org/github.com/satori/go.uuid) 5 | 6 | This package provides pure Go implementation of Universally Unique Identifier (UUID). Supported both creation and parsing of UUIDs. 7 | 8 | With 100% test coverage and benchmarks out of box. 9 | 10 | Supported versions: 11 | * Version 1, based on timestamp and MAC address (RFC 4122) 12 | * Version 2, based on timestamp, MAC address and POSIX UID/GID (DCE 1.1) 13 | * Version 3, based on MD5 hashing (RFC 4122) 14 | * Version 4, based on random numbers (RFC 4122) 15 | * Version 5, based on SHA-1 hashing (RFC 4122) 16 | 17 | ## Installation 18 | 19 | Use the `go` command: 20 | 21 | $ go get github.com/satori/go.uuid 22 | 23 | ## Requirements 24 | 25 | UUID package requires any stable version of Go Programming Language. 26 | 27 | It is tested against following versions of Go: 1.0-1.5 28 | 29 | ## Example 30 | 31 | ```go 32 | package main 33 | 34 | import ( 35 | "fmt" 36 | "github.com/satori/go.uuid" 37 | ) 38 | 39 | func main() { 40 | // Creating UUID Version 4 41 | u1 := uuid.NewV4() 42 | fmt.Printf("UUIDv4: %s\n", u1) 43 | 44 | // Parsing UUID from string input 45 | u2, err := uuid.FromString("6ba7b810-9dad-11d1-80b4-00c04fd430c8") 46 | if err != nil { 47 | fmt.Printf("Something gone wrong: %s", err) 48 | } 49 | fmt.Printf("Successfully parsed: %s", u2) 50 | } 51 | ``` 52 | 53 | ## Documentation 54 | 55 | [Documentation](http://godoc.org/github.com/satori/go.uuid) is hosted at GoDoc project. 56 | 57 | ## Links 58 | * [RFC 4122](http://tools.ietf.org/html/rfc4122) 59 | * [DCE 1.1: Authentication and Security Services](http://pubs.opengroup.org/onlinepubs/9696989899/chap5.htm#tagcjh_08_02_01_01) 60 | 61 | ## Copyright 62 | 63 | Copyright (C) 2013-2015 by Maxim Bublis . 64 | 65 | UUID package released under MIT License. 66 | See [LICENSE](https://github.com/satori/go.uuid/blob/master/LICENSE) for details. 67 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | tfjson 2 | ====== 3 | 4 | Utility to read in a Terraform plan file and dump it out in JSON. Standalone 5 | version of [Terraform PR #3170](https://github.com/hashicorp/terraform/pull/3170). 6 | 7 | ## Installation 8 | 9 | ``` 10 | $ go get github.com/palantir/tfjson 11 | ``` 12 | 13 | ## Usage 14 | 15 | Given the following Terraform resources: 16 | 17 | ```hcl 18 | provider "aws" { 19 | region = "us-east-1" 20 | } 21 | 22 | resource "aws_vpc" "main" { 23 | cidr_block = "10.0.0.0/16" 24 | } 25 | 26 | module "inner" { 27 | source = "./inner" 28 | } 29 | 30 | // in inner module: 31 | 32 | resource "aws_vpc" "inner" { 33 | cidr_block = "10.0.0.0/8" 34 | } 35 | ``` 36 | 37 | Running `terraform plan -out=terraform.tfplan` produces a Terraform plan file. 38 | The JSON representation produced by `tfjson` looks like: 39 | 40 | ```json 41 | $ tfjson terraform.tfplan 42 | { 43 | "aws_vpc.main": { 44 | "cidr_block": "10.0.0.0/16", 45 | "default_network_acl_id": "", 46 | "default_route_table_id": "", 47 | "default_security_group_id": "", 48 | "destroy": false, 49 | "destroy_tainted": false, 50 | "dhcp_options_id": "", 51 | "enable_classiclink": "", 52 | "enable_dns_hostnames": "", 53 | "enable_dns_support": "", 54 | "id": "", 55 | "instance_tenancy": "", 56 | "main_route_table_id": "" 57 | }, 58 | "destroy": false, 59 | "inner": { 60 | "aws_vpc.inner": { 61 | "cidr_block": "10.0.0.0/8", 62 | "default_network_acl_id": "", 63 | "default_route_table_id": "", 64 | "default_security_group_id": "", 65 | "destroy": false, 66 | "destroy_tainted": false, 67 | "dhcp_options_id": "", 68 | "enable_classiclink": "", 69 | "enable_dns_hostnames": "", 70 | "enable_dns_support": "", 71 | "id": "", 72 | "instance_tenancy": "", 73 | "main_route_table_id": "" 74 | }, 75 | "destroy": false 76 | } 77 | } 78 | ``` 79 | 80 | ## License 81 | 82 | This project is made available under the [MIT License](http://opensource.org/licenses/MIT). 83 | -------------------------------------------------------------------------------- /vendor/github.com/aws/aws-sdk-go/aws/signer/v4/header_rules.go: -------------------------------------------------------------------------------- 1 | package v4 2 | 3 | import ( 4 | "net/http" 5 | "strings" 6 | ) 7 | 8 | // validator houses a set of rule needed for validation of a 9 | // string value 10 | type rules []rule 11 | 12 | // rule interface allows for more flexible rules and just simply 13 | // checks whether or not a value adheres to that rule 14 | type rule interface { 15 | IsValid(value string) bool 16 | } 17 | 18 | // IsValid will iterate through all rules and see if any rules 19 | // apply to the value and supports nested rules 20 | func (r rules) IsValid(value string) bool { 21 | for _, rule := range r { 22 | if rule.IsValid(value) { 23 | return true 24 | } 25 | } 26 | return false 27 | } 28 | 29 | // mapRule generic rule for maps 30 | type mapRule map[string]struct{} 31 | 32 | // IsValid for the map rule satisfies whether it exists in the map 33 | func (m mapRule) IsValid(value string) bool { 34 | _, ok := m[value] 35 | return ok 36 | } 37 | 38 | // whitelist is a generic rule for whitelisting 39 | type whitelist struct { 40 | rule 41 | } 42 | 43 | // IsValid for whitelist checks if the value is within the whitelist 44 | func (w whitelist) IsValid(value string) bool { 45 | return w.rule.IsValid(value) 46 | } 47 | 48 | // blacklist is a generic rule for blacklisting 49 | type blacklist struct { 50 | rule 51 | } 52 | 53 | // IsValid for whitelist checks if the value is within the whitelist 54 | func (b blacklist) IsValid(value string) bool { 55 | return !b.rule.IsValid(value) 56 | } 57 | 58 | type patterns []string 59 | 60 | // IsValid for patterns checks each pattern and returns if a match has 61 | // been found 62 | func (p patterns) IsValid(value string) bool { 63 | for _, pattern := range p { 64 | if strings.HasPrefix(http.CanonicalHeaderKey(value), pattern) { 65 | return true 66 | } 67 | } 68 | return false 69 | } 70 | 71 | // inclusiveRules rules allow for rules to depend on one another 72 | type inclusiveRules []rule 73 | 74 | // IsValid will return true if all rules are true 75 | func (r inclusiveRules) IsValid(value string) bool { 76 | for _, rule := range r { 77 | if !rule.IsValid(value) { 78 | return false 79 | } 80 | } 81 | return true 82 | } 83 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/terraform/config/module/get.go: -------------------------------------------------------------------------------- 1 | package module 2 | 3 | import ( 4 | "io/ioutil" 5 | "os" 6 | 7 | "github.com/hashicorp/go-getter" 8 | ) 9 | 10 | // GetMode is an enum that describes how modules are loaded. 11 | // 12 | // GetModeLoad says that modules will not be downloaded or updated, they will 13 | // only be loaded from the storage. 14 | // 15 | // GetModeGet says that modules can be initially downloaded if they don't 16 | // exist, but otherwise to just load from the current version in storage. 17 | // 18 | // GetModeUpdate says that modules should be checked for updates and 19 | // downloaded prior to loading. If there are no updates, we load the version 20 | // from disk, otherwise we download first and then load. 21 | type GetMode byte 22 | 23 | const ( 24 | GetModeNone GetMode = iota 25 | GetModeGet 26 | GetModeUpdate 27 | ) 28 | 29 | // GetCopy is the same as Get except that it downloads a copy of the 30 | // module represented by source. 31 | // 32 | // This copy will omit and dot-prefixed files (such as .git/, .hg/) and 33 | // can't be updated on its own. 34 | func GetCopy(dst, src string) error { 35 | // Create the temporary directory to do the real Get to 36 | tmpDir, err := ioutil.TempDir("", "tf") 37 | if err != nil { 38 | return err 39 | } 40 | // FIXME: This isn't completely safe. Creating and removing our temp path 41 | // exposes where to race to inject files. 42 | if err := os.RemoveAll(tmpDir); err != nil { 43 | return err 44 | } 45 | defer os.RemoveAll(tmpDir) 46 | 47 | // Get to that temporary dir 48 | if err := getter.Get(tmpDir, src); err != nil { 49 | return err 50 | } 51 | 52 | // Make sure the destination exists 53 | if err := os.MkdirAll(dst, 0755); err != nil { 54 | return err 55 | } 56 | 57 | // Copy to the final location 58 | return copyDir(dst, tmpDir) 59 | } 60 | 61 | func getStorage(s getter.Storage, key string, src string, mode GetMode) (string, bool, error) { 62 | // Get the module with the level specified if we were told to. 63 | if mode > GetModeNone { 64 | if err := s.Get(key, src, mode == GetModeUpdate); err != nil { 65 | return "", false, err 66 | } 67 | } 68 | 69 | // Get the directory where the module is. 70 | return s.Dir(key) 71 | } 72 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/go-getter/decompress_tbz2.go: -------------------------------------------------------------------------------- 1 | package getter 2 | 3 | import ( 4 | "archive/tar" 5 | "compress/bzip2" 6 | "fmt" 7 | "io" 8 | "os" 9 | "path/filepath" 10 | ) 11 | 12 | // TarBzip2Decompressor is an implementation of Decompressor that can 13 | // decompress tar.bz2 files. 14 | type TarBzip2Decompressor struct{} 15 | 16 | func (d *TarBzip2Decompressor) Decompress(dst, src string, dir bool) error { 17 | // If we're going into a directory we should make that first 18 | mkdir := dst 19 | if !dir { 20 | mkdir = filepath.Dir(dst) 21 | } 22 | if err := os.MkdirAll(mkdir, 0755); err != nil { 23 | return err 24 | } 25 | 26 | // File first 27 | f, err := os.Open(src) 28 | if err != nil { 29 | return err 30 | } 31 | defer f.Close() 32 | 33 | // Bzip2 compression is second 34 | bzipR := bzip2.NewReader(f) 35 | 36 | // Once bzip decompressed we have a tar format 37 | tarR := tar.NewReader(bzipR) 38 | done := false 39 | for { 40 | hdr, err := tarR.Next() 41 | if err == io.EOF { 42 | if !done { 43 | // Empty archive 44 | return fmt.Errorf("empty archive: %s", src) 45 | } 46 | 47 | return nil 48 | } 49 | if err != nil { 50 | return err 51 | } 52 | 53 | path := dst 54 | if dir { 55 | path = filepath.Join(path, hdr.Name) 56 | } 57 | 58 | if hdr.FileInfo().IsDir() { 59 | if dir { 60 | return fmt.Errorf("expected a single file: %s", src) 61 | } 62 | 63 | // A directory, just make the directory and continue unarchiving... 64 | if err := os.MkdirAll(path, 0755); err != nil { 65 | return err 66 | } 67 | 68 | continue 69 | } 70 | 71 | // We have a file. If we already decoded, then it is an error 72 | if !dir && done { 73 | return fmt.Errorf("expected a single file, got multiple: %s", src) 74 | } 75 | 76 | // Mark that we're done so future in single file mode errors 77 | done = true 78 | 79 | // Open the file for writing 80 | dstF, err := os.Create(path) 81 | if err != nil { 82 | return err 83 | } 84 | _, err = io.Copy(dstF, tarR) 85 | dstF.Close() 86 | if err != nil { 87 | return err 88 | } 89 | 90 | // Chmod the file 91 | if err := os.Chmod(path, hdr.FileInfo().Mode()); err != nil { 92 | return err 93 | } 94 | } 95 | } 96 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/hil/check_identifier.go: -------------------------------------------------------------------------------- 1 | package hil 2 | 3 | import ( 4 | "fmt" 5 | "sync" 6 | 7 | "github.com/hashicorp/hil/ast" 8 | ) 9 | 10 | // IdentifierCheck is a SemanticCheck that checks that all identifiers 11 | // resolve properly and that the right number of arguments are passed 12 | // to functions. 13 | type IdentifierCheck struct { 14 | Scope ast.Scope 15 | 16 | err error 17 | lock sync.Mutex 18 | } 19 | 20 | func (c *IdentifierCheck) Visit(root ast.Node) error { 21 | c.lock.Lock() 22 | defer c.lock.Unlock() 23 | defer c.reset() 24 | root.Accept(c.visit) 25 | return c.err 26 | } 27 | 28 | func (c *IdentifierCheck) visit(raw ast.Node) ast.Node { 29 | if c.err != nil { 30 | return raw 31 | } 32 | 33 | switch n := raw.(type) { 34 | case *ast.Call: 35 | c.visitCall(n) 36 | case *ast.VariableAccess: 37 | c.visitVariableAccess(n) 38 | case *ast.Output: 39 | // Ignore 40 | case *ast.LiteralNode: 41 | // Ignore 42 | default: 43 | // Ignore 44 | } 45 | 46 | // We never do replacement with this visitor 47 | return raw 48 | } 49 | 50 | func (c *IdentifierCheck) visitCall(n *ast.Call) { 51 | // Look up the function in the map 52 | function, ok := c.Scope.LookupFunc(n.Func) 53 | if !ok { 54 | c.createErr(n, fmt.Sprintf("unknown function called: %s", n.Func)) 55 | return 56 | } 57 | 58 | // Break up the args into what is variadic and what is required 59 | args := n.Args 60 | if function.Variadic && len(args) > len(function.ArgTypes) { 61 | args = n.Args[:len(function.ArgTypes)] 62 | } 63 | 64 | // Verify the number of arguments 65 | if len(args) != len(function.ArgTypes) { 66 | c.createErr(n, fmt.Sprintf( 67 | "%s: expected %d arguments, got %d", 68 | n.Func, len(function.ArgTypes), len(n.Args))) 69 | return 70 | } 71 | } 72 | 73 | func (c *IdentifierCheck) visitVariableAccess(n *ast.VariableAccess) { 74 | // Look up the variable in the map 75 | if _, ok := c.Scope.LookupVar(n.Name); !ok { 76 | c.createErr(n, fmt.Sprintf( 77 | "unknown variable accessed: %s", n.Name)) 78 | return 79 | } 80 | } 81 | 82 | func (c *IdentifierCheck) createErr(n ast.Node, str string) { 83 | c.err = fmt.Errorf("%s: %s", n.Pos(), str) 84 | } 85 | 86 | func (c *IdentifierCheck) reset() { 87 | c.err = nil 88 | } 89 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/go-getter/decompress_zip.go: -------------------------------------------------------------------------------- 1 | package getter 2 | 3 | import ( 4 | "archive/zip" 5 | "fmt" 6 | "io" 7 | "os" 8 | "path/filepath" 9 | ) 10 | 11 | // ZipDecompressor is an implementation of Decompressor that can 12 | // decompress tar.gzip files. 13 | type ZipDecompressor struct{} 14 | 15 | func (d *ZipDecompressor) Decompress(dst, src string, dir bool) error { 16 | // If we're going into a directory we should make that first 17 | mkdir := dst 18 | if !dir { 19 | mkdir = filepath.Dir(dst) 20 | } 21 | if err := os.MkdirAll(mkdir, 0755); err != nil { 22 | return err 23 | } 24 | 25 | // Open the zip 26 | zipR, err := zip.OpenReader(src) 27 | if err != nil { 28 | return err 29 | } 30 | defer zipR.Close() 31 | 32 | // Check the zip integrity 33 | if len(zipR.File) == 0 { 34 | // Empty archive 35 | return fmt.Errorf("empty archive: %s", src) 36 | } 37 | if !dir && len(zipR.File) > 1 { 38 | return fmt.Errorf("expected a single file: %s", src) 39 | } 40 | 41 | // Go through and unarchive 42 | for _, f := range zipR.File { 43 | path := dst 44 | if dir { 45 | path = filepath.Join(path, f.Name) 46 | } 47 | 48 | if f.FileInfo().IsDir() { 49 | if !dir { 50 | return fmt.Errorf("expected a single file: %s", src) 51 | } 52 | 53 | // A directory, just make the directory and continue unarchiving... 54 | if err := os.MkdirAll(path, 0755); err != nil { 55 | return err 56 | } 57 | 58 | continue 59 | } 60 | 61 | // Create the enclosing directories if we must. ZIP files aren't 62 | // required to contain entries for just the directories so this 63 | // can happen. 64 | if dir { 65 | if err := os.MkdirAll(filepath.Dir(path), 0755); err != nil { 66 | return err 67 | } 68 | } 69 | 70 | // Open the file for reading 71 | srcF, err := f.Open() 72 | if err != nil { 73 | return err 74 | } 75 | 76 | // Open the file for writing 77 | dstF, err := os.Create(path) 78 | if err != nil { 79 | srcF.Close() 80 | return err 81 | } 82 | _, err = io.Copy(dstF, srcF) 83 | srcF.Close() 84 | dstF.Close() 85 | if err != nil { 86 | return err 87 | } 88 | 89 | // Chmod the file 90 | if err := os.Chmod(path, f.Mode()); err != nil { 91 | return err 92 | } 93 | } 94 | 95 | return nil 96 | } 97 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/hil/ast/ast.go: -------------------------------------------------------------------------------- 1 | package ast 2 | 3 | import ( 4 | "fmt" 5 | ) 6 | 7 | // Node is the interface that all AST nodes must implement. 8 | type Node interface { 9 | // Accept is called to dispatch to the visitors. It must return the 10 | // resulting Node (which might be different in an AST transform). 11 | Accept(Visitor) Node 12 | 13 | // Pos returns the position of this node in some source. 14 | Pos() Pos 15 | 16 | // Type returns the type of this node for the given context. 17 | Type(Scope) (Type, error) 18 | } 19 | 20 | // Pos is the starting position of an AST node 21 | type Pos struct { 22 | Column, Line int // Column/Line number, starting at 1 23 | } 24 | 25 | func (p Pos) String() string { 26 | return fmt.Sprintf("%d:%d", p.Line, p.Column) 27 | } 28 | 29 | // Visitors are just implementations of this function. 30 | // 31 | // The function must return the Node to replace this node with. "nil" is 32 | // _not_ a valid return value. If there is no replacement, the original node 33 | // should be returned. We build this replacement directly into the visitor 34 | // pattern since AST transformations are a common and useful tool and 35 | // building it into the AST itself makes it required for future Node 36 | // implementations and very easy to do. 37 | // 38 | // Note that this isn't a true implementation of the visitor pattern, which 39 | // generally requires proper type dispatch on the function. However, 40 | // implementing this basic visitor pattern style is still very useful even 41 | // if you have to type switch. 42 | type Visitor func(Node) Node 43 | 44 | //go:generate stringer -type=Type 45 | 46 | // Type is the type of any value. 47 | type Type uint32 48 | 49 | const ( 50 | TypeInvalid Type = 0 51 | TypeAny Type = 1 << iota 52 | TypeString 53 | TypeInt 54 | TypeFloat 55 | TypeList 56 | TypeMap 57 | ) 58 | 59 | func (t Type) Printable() string { 60 | switch t { 61 | case TypeInvalid: 62 | return "invalid type" 63 | case TypeAny: 64 | return "any type" 65 | case TypeString: 66 | return "type string" 67 | case TypeInt: 68 | return "type int" 69 | case TypeFloat: 70 | return "type float" 71 | case TypeList: 72 | return "type list" 73 | case TypeMap: 74 | return "type map" 75 | default: 76 | return "unknown type" 77 | } 78 | } 79 | -------------------------------------------------------------------------------- /vendor/github.com/aws/aws-sdk-go/private/endpoints/endpoints.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": 2, 3 | "endpoints": { 4 | "*/*": { 5 | "endpoint": "{service}.{region}.amazonaws.com" 6 | }, 7 | "cn-north-1/*": { 8 | "endpoint": "{service}.{region}.amazonaws.com.cn", 9 | "signatureVersion": "v4" 10 | }, 11 | "cn-north-1/ec2metadata": { 12 | "endpoint": "http://169.254.169.254/latest" 13 | }, 14 | "us-gov-west-1/iam": { 15 | "endpoint": "iam.us-gov.amazonaws.com" 16 | }, 17 | "us-gov-west-1/sts": { 18 | "endpoint": "sts.us-gov-west-1.amazonaws.com" 19 | }, 20 | "us-gov-west-1/s3": { 21 | "endpoint": "s3-{region}.amazonaws.com" 22 | }, 23 | "us-gov-west-1/ec2metadata": { 24 | "endpoint": "http://169.254.169.254/latest" 25 | }, 26 | "*/cloudfront": { 27 | "endpoint": "cloudfront.amazonaws.com", 28 | "signingRegion": "us-east-1" 29 | }, 30 | "*/cloudsearchdomain": { 31 | "endpoint": "", 32 | "signingRegion": "us-east-1" 33 | }, 34 | "*/data.iot": { 35 | "endpoint": "", 36 | "signingRegion": "us-east-1" 37 | }, 38 | "*/ec2metadata": { 39 | "endpoint": "http://169.254.169.254/latest" 40 | }, 41 | "*/iam": { 42 | "endpoint": "iam.amazonaws.com", 43 | "signingRegion": "us-east-1" 44 | }, 45 | "*/importexport": { 46 | "endpoint": "importexport.amazonaws.com", 47 | "signingRegion": "us-east-1" 48 | }, 49 | "*/route53": { 50 | "endpoint": "route53.amazonaws.com", 51 | "signingRegion": "us-east-1" 52 | }, 53 | "*/sts": { 54 | "endpoint": "sts.amazonaws.com", 55 | "signingRegion": "us-east-1" 56 | }, 57 | "*/waf": { 58 | "endpoint": "waf.amazonaws.com", 59 | "signingRegion": "us-east-1" 60 | }, 61 | "us-east-1/sdb": { 62 | "endpoint": "sdb.amazonaws.com", 63 | "signingRegion": "us-east-1" 64 | }, 65 | "*/s3": { 66 | "endpoint": "s3-{region}.amazonaws.com" 67 | }, 68 | "*/s3/dualstack": { 69 | "endpoint": "s3.dualstack.{region}.amazonaws.com" 70 | }, 71 | "us-east-1/s3": { 72 | "endpoint": "s3.amazonaws.com" 73 | }, 74 | "eu-central-1/s3": { 75 | "endpoint": "{service}.{region}.amazonaws.com" 76 | } 77 | } 78 | } 79 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/terraform/terraform/context_import.go: -------------------------------------------------------------------------------- 1 | package terraform 2 | 3 | import ( 4 | "github.com/hashicorp/terraform/config/module" 5 | ) 6 | 7 | // ImportOpts are used as the configuration for Import. 8 | type ImportOpts struct { 9 | // Targets are the targets to import 10 | Targets []*ImportTarget 11 | 12 | // Module is optional, and specifies a config module that is loaded 13 | // into the graph and evaluated. The use case for this is to provide 14 | // provider configuration. 15 | Module *module.Tree 16 | } 17 | 18 | // ImportTarget is a single resource to import. 19 | type ImportTarget struct { 20 | // Addr is the full resource address of the resource to import. 21 | // Example: "module.foo.aws_instance.bar" 22 | Addr string 23 | 24 | // ID is the ID of the resource to import. This is resource-specific. 25 | ID string 26 | } 27 | 28 | // Import takes already-created external resources and brings them 29 | // under Terraform management. Import requires the exact type, name, and ID 30 | // of the resources to import. 31 | // 32 | // This operation is idempotent. If the requested resource is already 33 | // imported, no changes are made to the state. 34 | // 35 | // Further, this operation also gracefully handles partial state. If during 36 | // an import there is a failure, all previously imported resources remain 37 | // imported. 38 | func (c *Context) Import(opts *ImportOpts) (*State, error) { 39 | // Hold a lock since we can modify our own state here 40 | v := c.acquireRun() 41 | defer c.releaseRun(v) 42 | 43 | // Copy our own state 44 | c.state = c.state.DeepCopy() 45 | 46 | // Get supported providers (for the graph builder) 47 | providers := make([]string, 0, len(c.providers)) 48 | for k, _ := range c.providers { 49 | providers = append(providers, k) 50 | } 51 | 52 | // Initialize our graph builder 53 | builder := &ImportGraphBuilder{ 54 | ImportTargets: opts.Targets, 55 | Module: opts.Module, 56 | Providers: providers, 57 | } 58 | 59 | // Build the graph! 60 | graph, err := builder.Build(RootModulePath) 61 | if err != nil { 62 | return c.state, err 63 | } 64 | 65 | // Walk it 66 | if _, err := c.walk(graph, walkImport); err != nil { 67 | return c.state, err 68 | } 69 | 70 | // Clean the state 71 | c.state.prune() 72 | 73 | return c.state, nil 74 | } 75 | -------------------------------------------------------------------------------- /vendor/github.com/aws/aws-sdk-go/aws/awsutil/string_value.go: -------------------------------------------------------------------------------- 1 | package awsutil 2 | 3 | import ( 4 | "bytes" 5 | "fmt" 6 | "reflect" 7 | "strings" 8 | ) 9 | 10 | // StringValue returns the string representation of a value. 11 | func StringValue(i interface{}) string { 12 | var buf bytes.Buffer 13 | stringValue(reflect.ValueOf(i), 0, &buf) 14 | return buf.String() 15 | } 16 | 17 | func stringValue(v reflect.Value, indent int, buf *bytes.Buffer) { 18 | for v.Kind() == reflect.Ptr { 19 | v = v.Elem() 20 | } 21 | 22 | switch v.Kind() { 23 | case reflect.Struct: 24 | buf.WriteString("{\n") 25 | 26 | names := []string{} 27 | for i := 0; i < v.Type().NumField(); i++ { 28 | name := v.Type().Field(i).Name 29 | f := v.Field(i) 30 | if name[0:1] == strings.ToLower(name[0:1]) { 31 | continue // ignore unexported fields 32 | } 33 | if (f.Kind() == reflect.Ptr || f.Kind() == reflect.Slice) && f.IsNil() { 34 | continue // ignore unset fields 35 | } 36 | names = append(names, name) 37 | } 38 | 39 | for i, n := range names { 40 | val := v.FieldByName(n) 41 | buf.WriteString(strings.Repeat(" ", indent+2)) 42 | buf.WriteString(n + ": ") 43 | stringValue(val, indent+2, buf) 44 | 45 | if i < len(names)-1 { 46 | buf.WriteString(",\n") 47 | } 48 | } 49 | 50 | buf.WriteString("\n" + strings.Repeat(" ", indent) + "}") 51 | case reflect.Slice: 52 | nl, id, id2 := "", "", "" 53 | if v.Len() > 3 { 54 | nl, id, id2 = "\n", strings.Repeat(" ", indent), strings.Repeat(" ", indent+2) 55 | } 56 | buf.WriteString("[" + nl) 57 | for i := 0; i < v.Len(); i++ { 58 | buf.WriteString(id2) 59 | stringValue(v.Index(i), indent+2, buf) 60 | 61 | if i < v.Len()-1 { 62 | buf.WriteString("," + nl) 63 | } 64 | } 65 | 66 | buf.WriteString(nl + id + "]") 67 | case reflect.Map: 68 | buf.WriteString("{\n") 69 | 70 | for i, k := range v.MapKeys() { 71 | buf.WriteString(strings.Repeat(" ", indent+2)) 72 | buf.WriteString(k.String() + ": ") 73 | stringValue(v.MapIndex(k), indent+2, buf) 74 | 75 | if i < v.Len()-1 { 76 | buf.WriteString(",\n") 77 | } 78 | } 79 | 80 | buf.WriteString("\n" + strings.Repeat(" ", indent) + "}") 81 | default: 82 | format := "%v" 83 | switch v.Interface().(type) { 84 | case string: 85 | format = "%q" 86 | } 87 | fmt.Fprintf(buf, format, v.Interface()) 88 | } 89 | } 90 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/terraform/terraform/hook_stop.go: -------------------------------------------------------------------------------- 1 | package terraform 2 | 3 | import ( 4 | "sync/atomic" 5 | ) 6 | 7 | // stopHook is a private Hook implementation that Terraform uses to 8 | // signal when to stop or cancel actions. 9 | type stopHook struct { 10 | stop uint32 11 | } 12 | 13 | func (h *stopHook) PreApply(*InstanceInfo, *InstanceState, *InstanceDiff) (HookAction, error) { 14 | return h.hook() 15 | } 16 | 17 | func (h *stopHook) PostApply(*InstanceInfo, *InstanceState, error) (HookAction, error) { 18 | return h.hook() 19 | } 20 | 21 | func (h *stopHook) PreDiff(*InstanceInfo, *InstanceState) (HookAction, error) { 22 | return h.hook() 23 | } 24 | 25 | func (h *stopHook) PostDiff(*InstanceInfo, *InstanceDiff) (HookAction, error) { 26 | return h.hook() 27 | } 28 | 29 | func (h *stopHook) PreProvisionResource(*InstanceInfo, *InstanceState) (HookAction, error) { 30 | return h.hook() 31 | } 32 | 33 | func (h *stopHook) PostProvisionResource(*InstanceInfo, *InstanceState) (HookAction, error) { 34 | return h.hook() 35 | } 36 | 37 | func (h *stopHook) PreProvision(*InstanceInfo, string) (HookAction, error) { 38 | return h.hook() 39 | } 40 | 41 | func (h *stopHook) PostProvision(*InstanceInfo, string) (HookAction, error) { 42 | return h.hook() 43 | } 44 | 45 | func (h *stopHook) ProvisionOutput(*InstanceInfo, string, string) { 46 | } 47 | 48 | func (h *stopHook) PreRefresh(*InstanceInfo, *InstanceState) (HookAction, error) { 49 | return h.hook() 50 | } 51 | 52 | func (h *stopHook) PostRefresh(*InstanceInfo, *InstanceState) (HookAction, error) { 53 | return h.hook() 54 | } 55 | 56 | func (h *stopHook) PreImportState(*InstanceInfo, string) (HookAction, error) { 57 | return h.hook() 58 | } 59 | 60 | func (h *stopHook) PostImportState(*InstanceInfo, []*InstanceState) (HookAction, error) { 61 | return h.hook() 62 | } 63 | 64 | func (h *stopHook) PostStateUpdate(*State) (HookAction, error) { 65 | return h.hook() 66 | } 67 | 68 | func (h *stopHook) hook() (HookAction, error) { 69 | if h.Stopped() { 70 | return HookActionHalt, nil 71 | } 72 | 73 | return HookActionContinue, nil 74 | } 75 | 76 | // reset should be called within the lock context 77 | func (h *stopHook) Reset() { 78 | atomic.StoreUint32(&h.stop, 0) 79 | } 80 | 81 | func (h *stopHook) Stop() { 82 | atomic.StoreUint32(&h.stop, 1) 83 | } 84 | 85 | func (h *stopHook) Stopped() bool { 86 | return atomic.LoadUint32(&h.stop) == 1 87 | } 88 | -------------------------------------------------------------------------------- /vendor/github.com/aws/aws-sdk-go/aws/credentials/env_provider.go: -------------------------------------------------------------------------------- 1 | package credentials 2 | 3 | import ( 4 | "os" 5 | 6 | "github.com/aws/aws-sdk-go/aws/awserr" 7 | ) 8 | 9 | // EnvProviderName provides a name of Env provider 10 | const EnvProviderName = "EnvProvider" 11 | 12 | var ( 13 | // ErrAccessKeyIDNotFound is returned when the AWS Access Key ID can't be 14 | // found in the process's environment. 15 | // 16 | // @readonly 17 | ErrAccessKeyIDNotFound = awserr.New("EnvAccessKeyNotFound", "AWS_ACCESS_KEY_ID or AWS_ACCESS_KEY not found in environment", nil) 18 | 19 | // ErrSecretAccessKeyNotFound is returned when the AWS Secret Access Key 20 | // can't be found in the process's environment. 21 | // 22 | // @readonly 23 | ErrSecretAccessKeyNotFound = awserr.New("EnvSecretNotFound", "AWS_SECRET_ACCESS_KEY or AWS_SECRET_KEY not found in environment", nil) 24 | ) 25 | 26 | // A EnvProvider retrieves credentials from the environment variables of the 27 | // running process. Environment credentials never expire. 28 | // 29 | // Environment variables used: 30 | // 31 | // * Access Key ID: AWS_ACCESS_KEY_ID or AWS_ACCESS_KEY 32 | // * Secret Access Key: AWS_SECRET_ACCESS_KEY or AWS_SECRET_KEY 33 | type EnvProvider struct { 34 | retrieved bool 35 | } 36 | 37 | // NewEnvCredentials returns a pointer to a new Credentials object 38 | // wrapping the environment variable provider. 39 | func NewEnvCredentials() *Credentials { 40 | return NewCredentials(&EnvProvider{}) 41 | } 42 | 43 | // Retrieve retrieves the keys from the environment. 44 | func (e *EnvProvider) Retrieve() (Value, error) { 45 | e.retrieved = false 46 | 47 | id := os.Getenv("AWS_ACCESS_KEY_ID") 48 | if id == "" { 49 | id = os.Getenv("AWS_ACCESS_KEY") 50 | } 51 | 52 | secret := os.Getenv("AWS_SECRET_ACCESS_KEY") 53 | if secret == "" { 54 | secret = os.Getenv("AWS_SECRET_KEY") 55 | } 56 | 57 | if id == "" { 58 | return Value{ProviderName: EnvProviderName}, ErrAccessKeyIDNotFound 59 | } 60 | 61 | if secret == "" { 62 | return Value{ProviderName: EnvProviderName}, ErrSecretAccessKeyNotFound 63 | } 64 | 65 | e.retrieved = true 66 | return Value{ 67 | AccessKeyID: id, 68 | SecretAccessKey: secret, 69 | SessionToken: os.Getenv("AWS_SESSION_TOKEN"), 70 | ProviderName: EnvProviderName, 71 | }, nil 72 | } 73 | 74 | // IsExpired returns if the credentials have been retrieved. 75 | func (e *EnvProvider) IsExpired() bool { 76 | return !e.retrieved 77 | } 78 | -------------------------------------------------------------------------------- /vendor/github.com/aws/aws-sdk-go/private/endpoints/endpoints_map.go: -------------------------------------------------------------------------------- 1 | package endpoints 2 | 3 | // THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. 4 | 5 | type endpointStruct struct { 6 | Version int 7 | Endpoints map[string]endpointEntry 8 | } 9 | 10 | type endpointEntry struct { 11 | Endpoint string 12 | SigningRegion string 13 | } 14 | 15 | var endpointsMap = endpointStruct{ 16 | Version: 2, 17 | Endpoints: map[string]endpointEntry{ 18 | "*/*": { 19 | Endpoint: "{service}.{region}.amazonaws.com", 20 | }, 21 | "*/cloudfront": { 22 | Endpoint: "cloudfront.amazonaws.com", 23 | SigningRegion: "us-east-1", 24 | }, 25 | "*/cloudsearchdomain": { 26 | Endpoint: "", 27 | SigningRegion: "us-east-1", 28 | }, 29 | "*/data.iot": { 30 | Endpoint: "", 31 | SigningRegion: "us-east-1", 32 | }, 33 | "*/ec2metadata": { 34 | Endpoint: "http://169.254.169.254/latest", 35 | }, 36 | "*/iam": { 37 | Endpoint: "iam.amazonaws.com", 38 | SigningRegion: "us-east-1", 39 | }, 40 | "*/importexport": { 41 | Endpoint: "importexport.amazonaws.com", 42 | SigningRegion: "us-east-1", 43 | }, 44 | "*/route53": { 45 | Endpoint: "route53.amazonaws.com", 46 | SigningRegion: "us-east-1", 47 | }, 48 | "*/s3": { 49 | Endpoint: "s3-{region}.amazonaws.com", 50 | }, 51 | "*/s3/dualstack": { 52 | Endpoint: "s3.dualstack.{region}.amazonaws.com", 53 | }, 54 | "*/sts": { 55 | Endpoint: "sts.amazonaws.com", 56 | SigningRegion: "us-east-1", 57 | }, 58 | "*/waf": { 59 | Endpoint: "waf.amazonaws.com", 60 | SigningRegion: "us-east-1", 61 | }, 62 | "cn-north-1/*": { 63 | Endpoint: "{service}.{region}.amazonaws.com.cn", 64 | }, 65 | "cn-north-1/ec2metadata": { 66 | Endpoint: "http://169.254.169.254/latest", 67 | }, 68 | "eu-central-1/s3": { 69 | Endpoint: "{service}.{region}.amazonaws.com", 70 | }, 71 | "us-east-1/s3": { 72 | Endpoint: "s3.amazonaws.com", 73 | }, 74 | "us-east-1/sdb": { 75 | Endpoint: "sdb.amazonaws.com", 76 | SigningRegion: "us-east-1", 77 | }, 78 | "us-gov-west-1/ec2metadata": { 79 | Endpoint: "http://169.254.169.254/latest", 80 | }, 81 | "us-gov-west-1/iam": { 82 | Endpoint: "iam.us-gov.amazonaws.com", 83 | }, 84 | "us-gov-west-1/s3": { 85 | Endpoint: "s3-{region}.amazonaws.com", 86 | }, 87 | "us-gov-west-1/sts": { 88 | Endpoint: "sts.us-gov-west-1.amazonaws.com", 89 | }, 90 | }, 91 | } 92 | -------------------------------------------------------------------------------- /vendor/github.com/aws/aws-sdk-go/private/protocol/idempotency.go: -------------------------------------------------------------------------------- 1 | package protocol 2 | 3 | import ( 4 | "crypto/rand" 5 | "fmt" 6 | "reflect" 7 | ) 8 | 9 | // RandReader is the random reader the protocol package will use to read 10 | // random bytes from. This is exported for testing, and should not be used. 11 | var RandReader = rand.Reader 12 | 13 | const idempotencyTokenFillTag = `idempotencyToken` 14 | 15 | // CanSetIdempotencyToken returns true if the struct field should be 16 | // automatically populated with a Idempotency token. 17 | // 18 | // Only *string and string type fields that are tagged with idempotencyToken 19 | // which are not already set can be auto filled. 20 | func CanSetIdempotencyToken(v reflect.Value, f reflect.StructField) bool { 21 | switch u := v.Interface().(type) { 22 | // To auto fill an Idempotency token the field must be a string, 23 | // tagged for auto fill, and have a zero value. 24 | case *string: 25 | return u == nil && len(f.Tag.Get(idempotencyTokenFillTag)) != 0 26 | case string: 27 | return len(u) == 0 && len(f.Tag.Get(idempotencyTokenFillTag)) != 0 28 | } 29 | 30 | return false 31 | } 32 | 33 | // GetIdempotencyToken returns a randomly generated idempotency token. 34 | func GetIdempotencyToken() string { 35 | b := make([]byte, 16) 36 | RandReader.Read(b) 37 | 38 | return UUIDVersion4(b) 39 | } 40 | 41 | // SetIdempotencyToken will set the value provided with a Idempotency Token. 42 | // Given that the value can be set. Will panic if value is not setable. 43 | func SetIdempotencyToken(v reflect.Value) { 44 | if v.Kind() == reflect.Ptr { 45 | if v.IsNil() && v.CanSet() { 46 | v.Set(reflect.New(v.Type().Elem())) 47 | } 48 | v = v.Elem() 49 | } 50 | v = reflect.Indirect(v) 51 | 52 | if !v.CanSet() { 53 | panic(fmt.Sprintf("unable to set idempotnecy token %v", v)) 54 | } 55 | 56 | b := make([]byte, 16) 57 | _, err := rand.Read(b) 58 | if err != nil { 59 | // TODO handle error 60 | return 61 | } 62 | 63 | v.Set(reflect.ValueOf(UUIDVersion4(b))) 64 | } 65 | 66 | // UUIDVersion4 returns a Version 4 random UUID from the byte slice provided 67 | func UUIDVersion4(u []byte) string { 68 | // https://en.wikipedia.org/wiki/Universally_unique_identifier#Version_4_.28random.29 69 | // 13th character is "4" 70 | u[6] = (u[6] | 0x40) & 0x4F 71 | // 17th character is "8", "9", "a", or "b" 72 | u[8] = (u[8] | 0x80) & 0xBF 73 | 74 | return fmt.Sprintf(`%X-%X-%X-%X-%X`, u[0:4], u[4:6], u[6:8], u[8:10], u[10:]) 75 | } 76 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/go-getter/decompress_tgz.go: -------------------------------------------------------------------------------- 1 | package getter 2 | 3 | import ( 4 | "archive/tar" 5 | "compress/gzip" 6 | "fmt" 7 | "io" 8 | "os" 9 | "path/filepath" 10 | ) 11 | 12 | // TarGzipDecompressor is an implementation of Decompressor that can 13 | // decompress tar.gzip files. 14 | type TarGzipDecompressor struct{} 15 | 16 | func (d *TarGzipDecompressor) Decompress(dst, src string, dir bool) error { 17 | // If we're going into a directory we should make that first 18 | mkdir := dst 19 | if !dir { 20 | mkdir = filepath.Dir(dst) 21 | } 22 | if err := os.MkdirAll(mkdir, 0755); err != nil { 23 | return err 24 | } 25 | 26 | // File first 27 | f, err := os.Open(src) 28 | if err != nil { 29 | return err 30 | } 31 | defer f.Close() 32 | 33 | // Gzip compression is second 34 | gzipR, err := gzip.NewReader(f) 35 | if err != nil { 36 | return fmt.Errorf("Error opening a gzip reader for %s: %s", src, err) 37 | } 38 | defer gzipR.Close() 39 | 40 | // Once gzip decompressed we have a tar format 41 | tarR := tar.NewReader(gzipR) 42 | done := false 43 | for { 44 | hdr, err := tarR.Next() 45 | if err == io.EOF { 46 | if !done { 47 | // Empty archive 48 | return fmt.Errorf("empty archive: %s", src) 49 | } 50 | 51 | return nil 52 | } 53 | if err != nil { 54 | return err 55 | } 56 | 57 | path := dst 58 | if dir { 59 | path = filepath.Join(path, hdr.Name) 60 | } 61 | 62 | if hdr.FileInfo().IsDir() { 63 | if !dir { 64 | return fmt.Errorf("expected a single file: %s", src) 65 | } 66 | 67 | // A directory, just make the directory and continue unarchiving... 68 | if err := os.MkdirAll(path, 0755); err != nil { 69 | return err 70 | } 71 | 72 | continue 73 | } 74 | 75 | // We have a file. If we already decoded, then it is an error 76 | if !dir && done { 77 | return fmt.Errorf("expected a single file, got multiple: %s", src) 78 | } 79 | 80 | // Mark that we're done so future in single file mode errors 81 | done = true 82 | 83 | // Open the file for writing 84 | dstF, err := os.Create(path) 85 | if err != nil { 86 | return err 87 | } 88 | _, err = io.Copy(dstF, tarR) 89 | dstF.Close() 90 | if err != nil { 91 | return err 92 | } 93 | 94 | // Chmod the file 95 | if err := os.Chmod(path, hdr.FileInfo().Mode()); err != nil { 96 | return err 97 | } 98 | } 99 | } 100 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/terraform/config/append.go: -------------------------------------------------------------------------------- 1 | package config 2 | 3 | // Append appends one configuration to another. 4 | // 5 | // Append assumes that both configurations will not have 6 | // conflicting variables, resources, etc. If they do, the 7 | // problems will be caught in the validation phase. 8 | // 9 | // It is possible that c1, c2 on their own are not valid. For 10 | // example, a resource in c2 may reference a variable in c1. But 11 | // together, they would be valid. 12 | func Append(c1, c2 *Config) (*Config, error) { 13 | c := new(Config) 14 | 15 | // Append unknown keys, but keep them unique since it is a set 16 | unknowns := make(map[string]struct{}) 17 | for _, k := range c1.unknownKeys { 18 | _, present := unknowns[k] 19 | if !present { 20 | unknowns[k] = struct{}{} 21 | c.unknownKeys = append(c.unknownKeys, k) 22 | } 23 | } 24 | 25 | for _, k := range c2.unknownKeys { 26 | _, present := unknowns[k] 27 | if !present { 28 | unknowns[k] = struct{}{} 29 | c.unknownKeys = append(c.unknownKeys, k) 30 | } 31 | } 32 | 33 | c.Atlas = c1.Atlas 34 | if c2.Atlas != nil { 35 | c.Atlas = c2.Atlas 36 | } 37 | 38 | if len(c1.Modules) > 0 || len(c2.Modules) > 0 { 39 | c.Modules = make( 40 | []*Module, 0, len(c1.Modules)+len(c2.Modules)) 41 | c.Modules = append(c.Modules, c1.Modules...) 42 | c.Modules = append(c.Modules, c2.Modules...) 43 | } 44 | 45 | if len(c1.Outputs) > 0 || len(c2.Outputs) > 0 { 46 | c.Outputs = make( 47 | []*Output, 0, len(c1.Outputs)+len(c2.Outputs)) 48 | c.Outputs = append(c.Outputs, c1.Outputs...) 49 | c.Outputs = append(c.Outputs, c2.Outputs...) 50 | } 51 | 52 | if len(c1.ProviderConfigs) > 0 || len(c2.ProviderConfigs) > 0 { 53 | c.ProviderConfigs = make( 54 | []*ProviderConfig, 55 | 0, len(c1.ProviderConfigs)+len(c2.ProviderConfigs)) 56 | c.ProviderConfigs = append(c.ProviderConfigs, c1.ProviderConfigs...) 57 | c.ProviderConfigs = append(c.ProviderConfigs, c2.ProviderConfigs...) 58 | } 59 | 60 | if len(c1.Resources) > 0 || len(c2.Resources) > 0 { 61 | c.Resources = make( 62 | []*Resource, 63 | 0, len(c1.Resources)+len(c2.Resources)) 64 | c.Resources = append(c.Resources, c1.Resources...) 65 | c.Resources = append(c.Resources, c2.Resources...) 66 | } 67 | 68 | if len(c1.Variables) > 0 || len(c2.Variables) > 0 { 69 | c.Variables = make( 70 | []*Variable, 0, len(c1.Variables)+len(c2.Variables)) 71 | c.Variables = append(c.Variables, c1.Variables...) 72 | c.Variables = append(c.Variables, c2.Variables...) 73 | } 74 | 75 | return c, nil 76 | } 77 | -------------------------------------------------------------------------------- /vendor/github.com/aws/aws-sdk-go/private/endpoints/endpoints.go: -------------------------------------------------------------------------------- 1 | // Package endpoints validates regional endpoints for services. 2 | package endpoints 3 | 4 | //go:generate go run ../model/cli/gen-endpoints/main.go endpoints.json endpoints_map.go 5 | //go:generate gofmt -s -w endpoints_map.go 6 | 7 | import ( 8 | "fmt" 9 | "regexp" 10 | "strings" 11 | ) 12 | 13 | // NormalizeEndpoint takes and endpoint and service API information to return a 14 | // normalized endpoint and signing region. If the endpoint is not an empty string 15 | // the service name and region will be used to look up the service's API endpoint. 16 | // If the endpoint is provided the scheme will be added if it is not present. 17 | func NormalizeEndpoint(endpoint, serviceName, region string, disableSSL, useDualStack bool) (normEndpoint, signingRegion string) { 18 | if endpoint == "" { 19 | return EndpointForRegion(serviceName, region, disableSSL, useDualStack) 20 | } 21 | 22 | return AddScheme(endpoint, disableSSL), "" 23 | } 24 | 25 | // EndpointForRegion returns an endpoint and its signing region for a service and region. 26 | // if the service and region pair are not found endpoint and signingRegion will be empty. 27 | func EndpointForRegion(svcName, region string, disableSSL, useDualStack bool) (endpoint, signingRegion string) { 28 | dualStackField := "" 29 | if useDualStack { 30 | dualStackField = "/dualstack" 31 | } 32 | 33 | derivedKeys := []string{ 34 | region + "/" + svcName + dualStackField, 35 | region + "/*" + dualStackField, 36 | "*/" + svcName + dualStackField, 37 | "*/*" + dualStackField, 38 | } 39 | 40 | for _, key := range derivedKeys { 41 | if val, ok := endpointsMap.Endpoints[key]; ok { 42 | ep := val.Endpoint 43 | ep = strings.Replace(ep, "{region}", region, -1) 44 | ep = strings.Replace(ep, "{service}", svcName, -1) 45 | 46 | endpoint = ep 47 | signingRegion = val.SigningRegion 48 | break 49 | } 50 | } 51 | 52 | return AddScheme(endpoint, disableSSL), signingRegion 53 | } 54 | 55 | // Regular expression to determine if the endpoint string is prefixed with a scheme. 56 | var schemeRE = regexp.MustCompile("^([^:]+)://") 57 | 58 | // AddScheme adds the HTTP or HTTPS schemes to a endpoint URL if there is no 59 | // scheme. If disableSSL is true HTTP will be added instead of the default HTTPS. 60 | func AddScheme(endpoint string, disableSSL bool) string { 61 | if endpoint != "" && !schemeRE.MatchString(endpoint) { 62 | scheme := "https" 63 | if disableSSL { 64 | scheme = "http" 65 | } 66 | endpoint = fmt.Sprintf("%s://%s", scheme, endpoint) 67 | } 68 | 69 | return endpoint 70 | } 71 | -------------------------------------------------------------------------------- /vendor/github.com/hashicorp/go-getter/get_file_unix.go: -------------------------------------------------------------------------------- 1 | // +build !windows 2 | 3 | package getter 4 | 5 | import ( 6 | "fmt" 7 | "io" 8 | "net/url" 9 | "os" 10 | "path/filepath" 11 | ) 12 | 13 | func (g *FileGetter) Get(dst string, u *url.URL) error { 14 | path := u.Path 15 | if u.RawPath != "" { 16 | path = u.RawPath 17 | } 18 | 19 | // The source path must exist and be a directory to be usable. 20 | if fi, err := os.Stat(path); err != nil { 21 | return fmt.Errorf("source path error: %s", err) 22 | } else if !fi.IsDir() { 23 | return fmt.Errorf("source path must be a directory") 24 | } 25 | 26 | fi, err := os.Lstat(dst) 27 | if err != nil && !os.IsNotExist(err) { 28 | return err 29 | } 30 | 31 | // If the destination already exists, it must be a symlink 32 | if err == nil { 33 | mode := fi.Mode() 34 | if mode&os.ModeSymlink == 0 { 35 | return fmt.Errorf("destination exists and is not a symlink") 36 | } 37 | 38 | // Remove the destination 39 | if err := os.Remove(dst); err != nil { 40 | return err 41 | } 42 | } 43 | 44 | // Create all the parent directories 45 | if err := os.MkdirAll(filepath.Dir(dst), 0755); err != nil { 46 | return err 47 | } 48 | 49 | return os.Symlink(path, dst) 50 | } 51 | 52 | func (g *FileGetter) GetFile(dst string, u *url.URL) error { 53 | path := u.Path 54 | if u.RawPath != "" { 55 | path = u.RawPath 56 | } 57 | 58 | // The source path must exist and be a directory to be usable. 59 | if fi, err := os.Stat(path); err != nil { 60 | return fmt.Errorf("source path error: %s", err) 61 | } else if fi.IsDir() { 62 | return fmt.Errorf("source path must be a file") 63 | } 64 | 65 | _, err := os.Lstat(dst) 66 | if err != nil && !os.IsNotExist(err) { 67 | return err 68 | } 69 | 70 | // If the destination already exists, it must be a symlink 71 | if err == nil { 72 | // Remove the destination 73 | if err := os.Remove(dst); err != nil { 74 | return err 75 | } 76 | } 77 | 78 | // Create all the parent directories 79 | if err := os.MkdirAll(filepath.Dir(dst), 0755); err != nil { 80 | return err 81 | } 82 | 83 | // If we're not copying, just symlink and we're done 84 | if !g.Copy { 85 | return os.Symlink(path, dst) 86 | } 87 | 88 | // Copy 89 | srcF, err := os.Open(path) 90 | if err != nil { 91 | return err 92 | } 93 | defer srcF.Close() 94 | 95 | dstF, err := os.Create(dst) 96 | if err != nil { 97 | return err 98 | } 99 | defer dstF.Close() 100 | 101 | _, err = io.Copy(dstF, srcF) 102 | return err 103 | } 104 | --------------------------------------------------------------------------------