terraform: properly interpolate variable counts

This commit is contained in:
Mitchell Hashimoto 2015-02-11 23:02:55 -08:00
parent 4c3ea016b9
commit 354a35afb0
2 changed files with 11 additions and 6 deletions

View File

@ -613,12 +613,11 @@ func TestContext2Plan_countIndexZero(t *testing.T) {
} }
} }
/* func TestContext2Plan_countVar(t *testing.T) {
func TestContextPlan_countVar(t *testing.T) {
m := testModule(t, "plan-count-var") m := testModule(t, "plan-count-var")
p := testProvider("aws") p := testProvider("aws")
p.DiffFn = testDiffFn p.DiffFn = testDiffFn
ctx := testContext(t, &ContextOpts{ ctx := testContext2(t, &ContextOpts{
Module: m, Module: m,
Providers: map[string]ResourceProviderFactory{ Providers: map[string]ResourceProviderFactory{
"aws": testProviderFuncFixed(p), "aws": testProviderFuncFixed(p),
@ -640,6 +639,7 @@ func TestContextPlan_countVar(t *testing.T) {
} }
} }
/*
func TestContextPlan_countZero(t *testing.T) { func TestContextPlan_countZero(t *testing.T) {
m := testModule(t, "plan-count-zero") m := testModule(t, "plan-count-zero")
p := testProvider("aws") p := testProvider("aws")

View File

@ -217,9 +217,14 @@ func (n *GraphNodeConfigResource) DynamicExpand(ctx EvalContext) (*Graph, error)
// GraphNodeEvalable impl. // GraphNodeEvalable impl.
func (n *GraphNodeConfigResource) EvalTree() EvalNode { func (n *GraphNodeConfigResource) EvalTree() EvalNode {
return &EvalOpFilter{ return &EvalSequence{
Ops: []walkOperation{walkValidate}, Nodes: []EvalNode{
Node: &EvalValidateCount{Resource: n.Resource}, &EvalInterpolate{Config: n.Resource.RawCount},
&EvalOpFilter{
Ops: []walkOperation{walkValidate},
Node: &EvalValidateCount{Resource: n.Resource},
},
},
} }
} }