From d00d227b1b91390fdc956d2e7474b6c20df51cef Mon Sep 17 00:00:00 2001 From: Lourens de Jager <165963988+lourens-octopus@users.noreply.github.com> Date: Mon, 9 Dec 2024 09:46:20 +1300 Subject: [PATCH] test without destroy --- octopusdeploy_framework/resource_git_trigger.go | 8 +++----- octopusdeploy_framework/resource_git_trigger_test.go | 1 - 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/octopusdeploy_framework/resource_git_trigger.go b/octopusdeploy_framework/resource_git_trigger.go index 6352af2f..6ae8444e 100644 --- a/octopusdeploy_framework/resource_git_trigger.go +++ b/octopusdeploy_framework/resource_git_trigger.go @@ -162,12 +162,10 @@ func (r *gitTriggerResource) Delete(ctx context.Context, req resource.DeleteRequ client := r.Config.Client - project := projects.NewProject(data.ProjectId.ValueString(), data.SpaceId.ValueString(), "") - projectTrigger := triggers.NewProjectTrigger(data.Name.ValueString(), data.Description.ValueString(), data.IsDisabled.ValueBool(), project, nil, nil) - projectTrigger.ID = data.ID.ValueString() + projectTriggers, _ := client.ProjectTriggers.GetAll() - if err := client.ProjectTriggers.Delete(projectTrigger); err != nil { - reason := fmt.Sprintf("unable to delete Git Trigger '%s' with space '%s'", client.GetSpaceID(), data.SpaceId.ValueString()) + if err := client.ProjectTriggers.DeleteByID(data.ID.ValueString()); err != nil { + reason := fmt.Sprintf("unable to delete Git Trigger '%s' with space '%s', count of triggers: %d, name: '%s'", client.GetSpaceID(), data.SpaceId.ValueString(), len(projectTriggers), projectTriggers[0].Filter.GetFilterType()) resp.Diagnostics.AddError(reason, err.Error()) return } diff --git a/octopusdeploy_framework/resource_git_trigger_test.go b/octopusdeploy_framework/resource_git_trigger_test.go index 7365ddc0..c8c19b3b 100644 --- a/octopusdeploy_framework/resource_git_trigger_test.go +++ b/octopusdeploy_framework/resource_git_trigger_test.go @@ -72,7 +72,6 @@ func TestAccOctopusDeployGitTrigger(t *testing.T) { //} resource.Test(t, resource.TestCase{ - CheckDestroy: func(s *terraform.State) error { return testGitTriggerCheckDestroy(s) }, PreCheck: func() { TestAccPreCheck(t) }, ProtoV6ProviderFactories: ProtoV6ProviderFactories(), Steps: []resource.TestStep{