move VarEnvPrefix out of terraform pkg
This commit is contained in:
parent
edf3afb854
commit
e3bc1e7d5c
|
@ -15,6 +15,10 @@ import (
|
||||||
"github.com/hashicorp/terraform/tfdiags"
|
"github.com/hashicorp/terraform/tfdiags"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// VarEnvPrefix is the prefix for environment variables that represent values
|
||||||
|
// for root module input variables.
|
||||||
|
const VarEnvPrefix = "TF_VAR_"
|
||||||
|
|
||||||
// collectVariableValues inspects the various places that root module input variable
|
// collectVariableValues inspects the various places that root module input variable
|
||||||
// values can come from and constructs a map ready to be passed to the
|
// values can come from and constructs a map ready to be passed to the
|
||||||
// backend as part of a backend.Operation.
|
// backend as part of a backend.Operation.
|
||||||
|
@ -31,10 +35,10 @@ func (m *Meta) collectVariableValues() (map[string]backend.UnparsedVariableValue
|
||||||
{
|
{
|
||||||
env := os.Environ()
|
env := os.Environ()
|
||||||
for _, raw := range env {
|
for _, raw := range env {
|
||||||
if !strings.HasPrefix(raw, terraform.VarEnvPrefix) {
|
if !strings.HasPrefix(raw, VarEnvPrefix) {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
raw = raw[len(terraform.VarEnvPrefix):] // trim the prefix
|
raw = raw[len(VarEnvPrefix):] // trim the prefix
|
||||||
|
|
||||||
eq := strings.Index(raw, "=")
|
eq := strings.Index(raw, "=")
|
||||||
if eq == -1 {
|
if eq == -1 {
|
||||||
|
|
|
@ -16,12 +16,6 @@ import (
|
||||||
"github.com/hashicorp/terraform/flatmap"
|
"github.com/hashicorp/terraform/flatmap"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
|
||||||
// VarEnvPrefix is the prefix of variables that are read from
|
|
||||||
// the environment to set variables here.
|
|
||||||
VarEnvPrefix = "TF_VAR_"
|
|
||||||
)
|
|
||||||
|
|
||||||
// Interpolater is the structure responsible for determining the values
|
// Interpolater is the structure responsible for determining the values
|
||||||
// for interpolations such as `aws_instance.foo.bar`.
|
// for interpolations such as `aws_instance.foo.bar`.
|
||||||
type Interpolater struct {
|
type Interpolater struct {
|
||||||
|
|
Loading…
Reference in New Issue