terraform: non-multi count resource is still index 0
This commit is contained in:
parent
14aee00bf0
commit
4c3ea016b9
|
@ -590,12 +590,11 @@ func TestContext2Plan_countIndex(t *testing.T) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
func TestContext2Plan_countIndexZero(t *testing.T) {
|
||||||
func TestContextPlan_countIndexZero(t *testing.T) {
|
|
||||||
m := testModule(t, "plan-count-index-zero")
|
m := testModule(t, "plan-count-index-zero")
|
||||||
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),
|
||||||
|
@ -614,6 +613,7 @@ func TestContextPlan_countIndexZero(t *testing.T) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
func TestContextPlan_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")
|
||||||
|
|
|
@ -89,7 +89,13 @@ func (n *graphNodeExpandedResource) ProvidedBy() []string {
|
||||||
|
|
||||||
// GraphNodeEvalable impl.
|
// GraphNodeEvalable impl.
|
||||||
func (n *graphNodeExpandedResource) EvalTree() EvalNode {
|
func (n *graphNodeExpandedResource) EvalTree() EvalNode {
|
||||||
resource := &Resource{CountIndex: n.Index}
|
// Build the resource. If we aren't part of a multi-resource, then
|
||||||
|
// we still consider ourselves as count index zero.
|
||||||
|
index := n.Index
|
||||||
|
if index < 0 {
|
||||||
|
index = 0
|
||||||
|
}
|
||||||
|
resource := &Resource{CountIndex: index}
|
||||||
|
|
||||||
// Shared node for interpolation of configuration
|
// Shared node for interpolation of configuration
|
||||||
interpolateNode := &EvalInterpolate{
|
interpolateNode := &EvalInterpolate{
|
||||||
|
|
Loading…
Reference in New Issue