diff --git a/terraform/context_test.go b/terraform/context_test.go index 0c7994458..faa7f75d8 100644 --- a/terraform/context_test.go +++ b/terraform/context_test.go @@ -3839,7 +3839,6 @@ func TestContext2Apply_destroy(t *testing.T) { } } -/* func TestContext2Apply_destroyOutputs(t *testing.T) { m := testModule(t, "apply-destroy-outputs") h := new(HookRecordApplyOrder) @@ -3880,7 +3879,6 @@ func TestContext2Apply_destroyOutputs(t *testing.T) { t.Fatalf("bad: %#v", mod) } } -*/ func TestContext2Apply_destroyOrphan(t *testing.T) { m := testModule(t, "apply-error") diff --git a/terraform/eval_output.go b/terraform/eval_output.go index dedef0532..849c2c90d 100644 --- a/terraform/eval_output.go +++ b/terraform/eval_output.go @@ -10,17 +10,20 @@ import ( // for the given name to the current state. type EvalWriteOutput struct { Name string - Value EvalNode + Value *config.RawConfig } func (n *EvalWriteOutput) Args() ([]EvalNode, []EvalType) { - return []EvalNode{n.Value}, []EvalType{EvalTypeConfig} + return nil, nil } // TODO: test func (n *EvalWriteOutput) Eval( ctx EvalContext, args []interface{}) (interface{}, error) { - cfg := args[0].(*ResourceConfig) + cfg, err := ctx.Interpolate(n.Value, nil) + if err != nil { + // Ignore it + } state, lock := ctx.State() if state == nil { @@ -38,12 +41,16 @@ func (n *EvalWriteOutput) Eval( } // Get the value from the config - valueRaw, ok := cfg.Get("value") - if !ok { - valueRaw = "" - } - if cfg.IsComputed("value") { - valueRaw = config.UnknownVariableValue + var valueRaw interface{} = config.UnknownVariableValue + if cfg != nil { + var ok bool + valueRaw, ok = cfg.Get("value") + if !ok { + valueRaw = "" + } + if cfg.IsComputed("value") { + valueRaw = config.UnknownVariableValue + } } // If it is a list of values, get the first one diff --git a/terraform/graph_config_node.go b/terraform/graph_config_node.go index 84ac9eef0..4402a3751 100644 --- a/terraform/graph_config_node.go +++ b/terraform/graph_config_node.go @@ -124,9 +124,13 @@ func (n *GraphNodeConfigOutput) DependentOn() []string { func (n *GraphNodeConfigOutput) EvalTree() EvalNode { return &EvalOpFilter{ Ops: []walkOperation{walkRefresh, walkPlan, walkApply}, - Node: &EvalWriteOutput{ - Name: n.Output.Name, - Value: &EvalInterpolate{Config: n.Output.RawConfig}, + Node: &EvalSequence{ + Nodes: []EvalNode{ + &EvalWriteOutput{ + Name: n.Output.Name, + Value: n.Output.RawConfig, + }, + }, }, } }