diff --git a/internal/terraform/context_plan_actions_test.go b/internal/terraform/context_plan_actions_test.go index bebd7d055f..2ebb1fb041 100644 --- a/internal/terraform/context_plan_actions_test.go +++ b/internal/terraform/context_plan_actions_test.go @@ -100,7 +100,23 @@ resource "test_object" "a" { t.Fatalf("expected action address to be 'action.test_unlinked.hello', got '%s'", action.Addr) } - // TODO: Test that action the triggering resource address is set correctly + if !action.TriggeringResourceAddr.Equal(mustResourceInstanceAddr("test_object.a")) { + t.Fatal("expected action to have a triggering resource address, but it is nil") + } + + if action.ActionTriggerBlockIndex != 0 { + t.Fatalf("expected action to have a triggering block index of 0, got %d", action.ActionTriggerBlockIndex) + } + if action.TriggerEvent != configs.BeforeCreate { + t.Fatalf("expected action to have a triggering event of 'before_create', got '%s'", action.TriggerEvent) + } + if action.ActionsListIndex != 0 { + t.Fatalf("expected action to have a actions list index of 0, got %d", action.ActionsListIndex) + } + + if action.ProviderAddr.Provider != addrs.NewDefaultProvider("test") { + t.Fatalf("expected action to have a provider address of 'provider[\"registry.terraform.io/hashicorp/test\"]', got '%s'", action.ProviderAddr) + } }, },