Skip to content

Commit

Permalink
terraform: add more Same test cases to cover hashicorp#9171
Browse files Browse the repository at this point in the history
  • Loading branch information
mitchellh authored and fatmcgav committed Feb 27, 2017
1 parent 80ca7a7 commit 8074057
Showing 1 changed file with 94 additions and 0 deletions.
94 changes: 94 additions & 0 deletions terraform/diff_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -991,6 +991,100 @@ func TestInstanceDiffSame(t *testing.T) {
true,
"",
},

// Innner computed set should allow outer change in key
{
&InstanceDiff{
Attributes: map[string]*ResourceAttrDiff{
"foo.#": &ResourceAttrDiff{
Old: "0",
New: "1",
},
"foo.~1.outer_val": &ResourceAttrDiff{
Old: "",
New: "foo",
},
"foo.~1.inner.#": &ResourceAttrDiff{
Old: "0",
New: "1",
},
"foo.~1.inner.~2.value": &ResourceAttrDiff{
Old: "",
New: "${var.bar}",
NewComputed: true,
},
},
},
&InstanceDiff{
Attributes: map[string]*ResourceAttrDiff{
"foo.#": &ResourceAttrDiff{
Old: "0",
New: "1",
},
"foo.12.outer_val": &ResourceAttrDiff{
Old: "",
New: "foo",
},
"foo.12.inner.#": &ResourceAttrDiff{
Old: "0",
New: "1",
},
"foo.12.inner.42.value": &ResourceAttrDiff{
Old: "",
New: "baz",
},
},
},
true,
"",
},

// Innner computed list should allow outer change in key
{
&InstanceDiff{
Attributes: map[string]*ResourceAttrDiff{
"foo.#": &ResourceAttrDiff{
Old: "0",
New: "1",
},
"foo.~1.outer_val": &ResourceAttrDiff{
Old: "",
New: "foo",
},
"foo.~1.inner.#": &ResourceAttrDiff{
Old: "0",
New: "1",
},
"foo.~1.inner.0.value": &ResourceAttrDiff{
Old: "",
New: "${var.bar}",
NewComputed: true,
},
},
},
&InstanceDiff{
Attributes: map[string]*ResourceAttrDiff{
"foo.#": &ResourceAttrDiff{
Old: "0",
New: "1",
},
"foo.12.outer_val": &ResourceAttrDiff{
Old: "",
New: "foo",
},
"foo.12.inner.#": &ResourceAttrDiff{
Old: "0",
New: "1",
},
"foo.12.inner.0.value": &ResourceAttrDiff{
Old: "",
New: "baz",
},
},
},
true,
"",
},
}

for i, tc := range cases {
Expand Down

0 comments on commit 8074057

Please sign in to comment.