terraform: setup proper count.index value for interpolation
This commit is contained in:
parent
cbbe9cb588
commit
14aee00bf0
|
@ -567,12 +567,11 @@ func TestContext2Plan_countComputed(t *testing.T) {
|
|||
}
|
||||
}
|
||||
|
||||
/*
|
||||
func TestContextPlan_countIndex(t *testing.T) {
|
||||
func TestContext2Plan_countIndex(t *testing.T) {
|
||||
m := testModule(t, "plan-count-index")
|
||||
p := testProvider("aws")
|
||||
p.DiffFn = testDiffFn
|
||||
ctx := testContext(t, &ContextOpts{
|
||||
ctx := testContext2(t, &ContextOpts{
|
||||
Module: m,
|
||||
Providers: map[string]ResourceProviderFactory{
|
||||
"aws": testProviderFuncFixed(p),
|
||||
|
@ -591,6 +590,7 @@ func TestContextPlan_countIndex(t *testing.T) {
|
|||
}
|
||||
}
|
||||
|
||||
/*
|
||||
func TestContextPlan_countIndexZero(t *testing.T) {
|
||||
m := testModule(t, "plan-count-index-zero")
|
||||
p := testProvider("aws")
|
||||
|
|
|
@ -89,13 +89,21 @@ func (n *graphNodeExpandedResource) ProvidedBy() []string {
|
|||
|
||||
// GraphNodeEvalable impl.
|
||||
func (n *graphNodeExpandedResource) EvalTree() EvalNode {
|
||||
resource := &Resource{CountIndex: n.Index}
|
||||
|
||||
// Shared node for interpolation of configuration
|
||||
interpolateNode := &EvalInterpolate{
|
||||
Config: n.Resource.RawConfig,
|
||||
Resource: resource,
|
||||
}
|
||||
|
||||
seq := &EvalSequence{Nodes: make([]EvalNode, 0, 5)}
|
||||
|
||||
// Validate the resource
|
||||
vseq := &EvalSequence{Nodes: make([]EvalNode, 0, 5)}
|
||||
vseq.Nodes = append(vseq.Nodes, &EvalValidateResource{
|
||||
Provider: &EvalGetProvider{Name: n.ProvidedBy()[0]},
|
||||
Config: &EvalInterpolate{Config: n.Resource.RawConfig},
|
||||
Config: interpolateNode,
|
||||
ResourceName: n.Resource.Name,
|
||||
ResourceType: n.Resource.Type,
|
||||
})
|
||||
|
@ -104,7 +112,8 @@ func (n *graphNodeExpandedResource) EvalTree() EvalNode {
|
|||
for _, p := range n.Resource.Provisioners {
|
||||
vseq.Nodes = append(vseq.Nodes, &EvalValidateProvisioner{
|
||||
Provisioner: &EvalGetProvisioner{Name: p.Type},
|
||||
Config: &EvalInterpolate{Config: p.RawConfig},
|
||||
Config: &EvalInterpolate{
|
||||
Config: p.RawConfig, Resource: resource},
|
||||
})
|
||||
}
|
||||
|
||||
|
@ -145,7 +154,7 @@ func (n *graphNodeExpandedResource) EvalTree() EvalNode {
|
|||
Dependencies: n.DependentOn(),
|
||||
State: &EvalDiff{
|
||||
Info: info,
|
||||
Config: &EvalInterpolate{Config: n.Resource.RawConfig},
|
||||
Config: interpolateNode,
|
||||
Provider: &EvalGetProvider{Name: n.ProvidedBy()[0]},
|
||||
State: &EvalReadState{Name: n.stateId()},
|
||||
Output: &diff,
|
||||
|
|
Loading…
Reference in New Issue