update apply tests

This commit is contained in:
James Bardin 2018-05-21 19:20:32 -04:00 committed by Martin Atkins
parent 492a3b09fa
commit cae5c2feaa
4 changed files with 7 additions and 10 deletions

View File

@ -5434,7 +5434,7 @@ func TestContext2Apply_provisionerResourceRef(t *testing.T) {
pr := testProvisioner()
pr.ApplyFn = func(rs *InstanceState, c *ResourceConfig) error {
val, ok := c.Config["foo"]
val, ok := c.Config["command"]
if !ok || val != "2" {
t.Fatalf("bad value for foo: %v %#v", val, c)
}
@ -8979,7 +8979,7 @@ func TestContext2Apply_ignoreChangesWithDep(t *testing.T) {
},
},
"aws_eip.foo.0": &ResourceState{
Type: "aws_instance",
Type: "aws_eip",
Primary: &InstanceState{
ID: "eip-abc123",
Attributes: map[string]string{
@ -8989,7 +8989,7 @@ func TestContext2Apply_ignoreChangesWithDep(t *testing.T) {
},
},
"aws_eip.foo.1": &ResourceState{
Type: "aws_instance",
Type: "aws_eip",
Primary: &InstanceState{
ID: "eip-bcd234",
Attributes: map[string]string{
@ -9012,10 +9012,8 @@ func TestContext2Apply_ignoreChangesWithDep(t *testing.T) {
State: s,
})
if p, diags := ctx.Plan(); diags.HasErrors() {
if _, diags := ctx.Plan(); diags.HasErrors() {
t.Fatalf("diags: %s", diags.Err())
} else {
t.Logf(p.String())
}
state, diags := ctx.Apply()
@ -9026,7 +9024,7 @@ func TestContext2Apply_ignoreChangesWithDep(t *testing.T) {
actual := strings.TrimSpace(state.String())
expected := strings.TrimSpace(s.String())
if actual != expected {
t.Fatalf("bad: \n%s", actual)
t.Fatalf("expected:\n%s\n\ngot:\n%s", expected, actual)
}
}

View File

@ -2603,7 +2603,7 @@ func TestContext2Plan_taint(t *testing.T) {
}
}
func TestContext2Apply_taintIgnoreChanges(t *testing.T) {
func TestContext2Plan_taintIgnoreChanges(t *testing.T) {
m := testModule(t, "plan-taint-ignore-changes")
p := testProvider("aws")
p.ApplyFn = testApplyFn

View File

@ -1,4 +1,3 @@
resource "aws_instance" "web" {
require_new = "ami-new"
lifecycle {

View File

@ -8,5 +8,5 @@ resource "aws_instance" "foo" {
resource "aws_eip" "foo" {
count = 2
instance = "${element(aws_instance.foo.*.id, count.index)}"
instance = "${aws_instance.foo.*.id[count.index]}"
}