put output errors behind a feature flag

We're going to start merging breaking functgionality behind feature
flags, to reduce the need for long-lived feature branches.
This commit is contained in:
James Bardin 2017-09-29 14:45:55 -04:00
parent 35c6a4e89d
commit 715036d209
2 changed files with 23 additions and 10 deletions

View File

@ -68,18 +68,22 @@ func (n *EvalWriteOutput) Eval(ctx EvalContext) (interface{}, error) {
// handling the interpolation error // handling the interpolation error
if err != nil { if err != nil {
if n.ContinueOnErr { switch {
log.Printf("[ERROR] Output interpolation %q failed: %s", n.Name, err) case featureOutputErrors:
// if we're continueing, make sure the output is included, and if n.ContinueOnErr {
// marked as unknown log.Printf("[ERROR] Output interpolation %q failed: %s", n.Name, err)
mod.Outputs[n.Name] = &OutputState{ // if we're continueing, make sure the output is included, and
Type: "string", // marked as unknown
Value: config.UnknownVariableValue, mod.Outputs[n.Name] = &OutputState{
Type: "string",
Value: config.UnknownVariableValue,
}
return nil, EvalEarlyExitError{}
} }
return nil, EvalEarlyExitError{} return nil, err
default:
log.Printf("[WARN] Output interpolation %q failed: %s", n.Name, err)
} }
return nil, err
} }
// Get the value from the config // Get the value from the config

9
terraform/features.go Normal file
View File

@ -0,0 +1,9 @@
package terraform
import (
"os"
)
// This file holds feature flags for the next release
var featureOutputErrors = os.Getenv("TF_OUTPUT_ERRORS") != ""