From 715036d209b82bd5d71ccba103779e2568203732 Mon Sep 17 00:00:00 2001 From: James Bardin Date: Fri, 29 Sep 2017 14:45:55 -0400 Subject: [PATCH] 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. --- terraform/eval_output.go | 24 ++++++++++++++---------- terraform/features.go | 9 +++++++++ 2 files changed, 23 insertions(+), 10 deletions(-) create mode 100644 terraform/features.go diff --git a/terraform/eval_output.go b/terraform/eval_output.go index a454efe94..657c70304 100644 --- a/terraform/eval_output.go +++ b/terraform/eval_output.go @@ -68,18 +68,22 @@ func (n *EvalWriteOutput) Eval(ctx EvalContext) (interface{}, error) { // handling the interpolation error if err != nil { - if n.ContinueOnErr { - log.Printf("[ERROR] Output interpolation %q failed: %s", n.Name, err) - // if we're continueing, make sure the output is included, and - // marked as unknown - mod.Outputs[n.Name] = &OutputState{ - Type: "string", - Value: config.UnknownVariableValue, + switch { + case featureOutputErrors: + if n.ContinueOnErr { + log.Printf("[ERROR] Output interpolation %q failed: %s", n.Name, err) + // if we're continueing, make sure the output is included, and + // marked as unknown + 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 diff --git a/terraform/features.go b/terraform/features.go new file mode 100644 index 000000000..9bcf19d9c --- /dev/null +++ b/terraform/features.go @@ -0,0 +1,9 @@ +package terraform + +import ( + "os" +) + +// This file holds feature flags for the next release + +var featureOutputErrors = os.Getenv("TF_OUTPUT_ERRORS") != ""