OctopusDeployLabs / terraform-provider-octopusdeploy

Terraform Provider for Octopus Deploy :octopus:
https://registry.terraform.io/providers/OctopusDeployLabs/octopusdeploy
Mozilla Public License 2.0
80 stars 67 forks source link

Data Sources that use is_disabled aren't able to list only false values #624

Open FinnianDempsey opened 5 months ago

FinnianDempsey commented 5 months ago

Describe the bug When using the TF provider with Data Sources for Deployment Targets, if using the is_disabled variable set to false, resources that are set to true are returned alongside false values

Steps to reproduce

  1. Configure Octopus with a disabled Deployment Target
  2. Create a data source for a deployment target using the is_disabled field set to false:
    data "octopusdeploy_polling_tentacle_deployment_targets" "targets" {
    is_disabled = false
    }
  3. Check terraform.tfstate file and see resources with is_disabled = true

Expected behavior Only false values should be returned when using is_disabled = false

Environment and versions:

Additional context is_disabled = true works as expected which seems odd

benPearce1 commented 1 month ago

This appears to be a bug in the API.

For my current test setup: image

http://localhost:8066/api/Spaces-1/machines?skip=0&take=2147483647&isDisabled=false returns all six targets

{
  ItemType: "Machine",
  TotalResults: 6,
  ItemsPerPage: 2147483647,
  NumberOfPages: 1,
  LastPageNumber: 0,
  Items: [ ... ]
}

http://localhost:8066/api/Spaces-1/machines?skip=0&take=2147483647&isDisabled=true returns just the two disabled ones:

{
  ItemType: "Machine",
  TotalResults: 2,
  ItemsPerPage: 2147483647,
  NumberOfPages: 1,
  LastPageNumber: 0,
  Items: [ ... ]

Raised this as an issue against Server https://github.com/OctopusDeploy/Issues/issues/8916