Skip to content

Commit

Permalink
test without destroy
Browse files Browse the repository at this point in the history
  • Loading branch information
lourens-octopus committed Dec 8, 2024
1 parent d524c2c commit d00d227
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 6 deletions.
8 changes: 3 additions & 5 deletions octopusdeploy_framework/resource_git_trigger.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
1 change: 0 additions & 1 deletion octopusdeploy_framework/resource_git_trigger_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{
Expand Down

0 comments on commit d00d227

Please sign in to comment.