Skip to content

Commit

Permalink
Workaround to fetch space ID from the provider for imports
Browse files Browse the repository at this point in the history
  • Loading branch information
bec-callow-oct committed Dec 9, 2024
1 parent 4ba51c9 commit 8be69ab
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion octopusdeploy/resource_project_scheduled_trigger.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"github.com/OctopusDeploy/go-octopusdeploy/v2/pkg/client"
"github.com/OctopusDeploy/go-octopusdeploy/v2/pkg/projects"
"github.com/OctopusDeploy/go-octopusdeploy/v2/pkg/triggers"
"github.com/OctopusDeploy/terraform-provider-octopusdeploy/octopusdeploy_framework/util"
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
"log"
Expand All @@ -25,6 +26,7 @@ func resourceProjectScheduledTrigger() *schema.Resource {
func resourceProjectScheduledTriggerRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
client := m.(*client.Client)
spaceId := d.Get("space_id").(string)
spaceId = util.Ternary(len(spaceId) > 0, spaceId, client.GetSpaceID())

scheduledTrigger, err := triggers.GetByID(client, spaceId, d.Id())

Check failure on line 31 in octopusdeploy/resource_project_scheduled_trigger.go

View workflow job for this annotation

GitHub Actions / build

undefined: triggers.GetByID

Check failure on line 31 in octopusdeploy/resource_project_scheduled_trigger.go

View workflow job for this annotation

GitHub Actions / build

undefined: triggers.GetByID

Expand Down Expand Up @@ -112,7 +114,7 @@ func resourceProjectScheduledTriggerUpdate(ctx context.Context, d *schema.Resour
func resourceProjectScheduledTriggerDelete(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
client := m.(*client.Client)
spaceId := d.Get("space_id").(string)
err := triggers.DeleteById(client, spaceId, d.Id())
err := triggers.DeleteByID(client, spaceId, d.Id())

Check failure on line 117 in octopusdeploy/resource_project_scheduled_trigger.go

View workflow job for this annotation

GitHub Actions / build

undefined: triggers.DeleteByID

Check failure on line 117 in octopusdeploy/resource_project_scheduled_trigger.go

View workflow job for this annotation

GitHub Actions / build

undefined: triggers.DeleteByID

if err != nil {
return diag.FromErr(err)
Expand Down

0 comments on commit 8be69ab

Please sign in to comment.