Skip to content

Commit

Permalink
fix: Implement filtering a worker pool by name (#537) (#786)
Browse files Browse the repository at this point in the history
fixes #536

Co-authored-by: Itai Spiegel <[email protected]>
  • Loading branch information
domenicsim1 and itaispiegel authored Sep 18, 2024
1 parent be44617 commit 4c0f227
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions octopusdeploy/data_source_worker_pools.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ func dataSourceWorkerPoolsRead(ctx context.Context, d *schema.ResourceData, m in
Skip: d.Get("skip").(int),
Take: d.Get("take").(int),
}
name := d.Get("name").(string)

client := m.(*client.Client)
workerPools, err := workerpools.Get(client, d.Get("space_id").(string), query)
Expand All @@ -39,6 +40,11 @@ func dataSourceWorkerPoolsRead(ctx context.Context, d *schema.ResourceData, m in
return diag.FromErr(err)
}

// There is no name filter on the WorkerPools endpoint in the Octopus API,
// so filter in-memory if the name field is specified
if name != "" && workerPoolResource.Name != name {
continue
}
flattenedWorkerPools = append(flattenedWorkerPools, flattenWorkerPool(workerPoolResource))
}

Expand Down

0 comments on commit 4c0f227

Please sign in to comment.