From 9b7d1509fc2002d8a5f076bd94d1bcc75976a5bd Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Thu, 12 Feb 2015 19:41:44 -0800 Subject: [PATCH] terraform: outputs in apply --- terraform/context_test.go | 6 +++--- terraform/eval_apply.go | 10 +++++++++- terraform/graph_config_node.go | 2 +- 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/terraform/context_test.go b/terraform/context_test.go index 1ff312deff..61e45d6b52 100644 --- a/terraform/context_test.go +++ b/terraform/context_test.go @@ -2706,13 +2706,12 @@ func TestContext2Apply(t *testing.T) { } } -/* -func TestContextApply_emptyModule(t *testing.T) { +func TestContext2Apply_emptyModule(t *testing.T) { m := testModule(t, "apply-empty-module") p := testProvider("aws") p.ApplyFn = testApplyFn p.DiffFn = testDiffFn - ctx := testContext(t, &ContextOpts{ + ctx := testContext2(t, &ContextOpts{ Module: m, Providers: map[string]ResourceProviderFactory{ "aws": testProviderFuncFixed(p), @@ -2736,6 +2735,7 @@ func TestContextApply_emptyModule(t *testing.T) { } } +/* func TestContextApply_createBeforeDestroy(t *testing.T) { m := testModule(t, "apply-good-create-before") p := testProvider("aws") diff --git a/terraform/eval_apply.go b/terraform/eval_apply.go index 032150f1e6..06b0ff8241 100644 --- a/terraform/eval_apply.go +++ b/terraform/eval_apply.go @@ -43,7 +43,15 @@ func (n *EvalApply) Eval( } } - // TODO: hooks + /* + // Call pre-apply hook + err := ctx.Hook(func(h Hook) (HookAction, error) { + return h.PreApply(n.Info, state, diff) + }) + if err != nil { + return nil, err + } + */ // With the completed diff, apply! log.Printf("[DEBUG] apply: %s: executing Apply", n.Info.Id) diff --git a/terraform/graph_config_node.go b/terraform/graph_config_node.go index 94880208e7..d208d7a45b 100644 --- a/terraform/graph_config_node.go +++ b/terraform/graph_config_node.go @@ -123,7 +123,7 @@ func (n *GraphNodeConfigOutput) DependentOn() []string { // GraphNodeEvalable impl. func (n *GraphNodeConfigOutput) EvalTree() EvalNode { return &EvalOpFilter{ - Ops: []walkOperation{walkRefresh, walkPlan}, + Ops: []walkOperation{walkRefresh, walkPlan, walkApply}, Node: &EvalWriteOutput{ Name: n.Output.Name, Value: &EvalInterpolate{Config: n.Output.RawConfig},