terraform-provider-power-platform icon indicating copy to clipboard operation
terraform-provider-power-platform copied to clipboard

Allow filtering of `data.powerplatform_environments` data source

Open mattdot opened this issue 1 year ago • 2 comments

Enhance the powerplatform_environments data source to accept a filter to return a more targeted list of environments


data "powerplatform_environments" "get_by_id" {
  filter = "name eq <guid>"
}

data "powerplatform_environments" "get_default" {
  filter = "properties.isDefault eq true"
}

data "powerplatform_environments" "get_coe_envs" {
  filter = "contains(properties.displayName,  'CoE')"
}

mattdot avatar Oct 02 '24 02:10 mattdot

This would be great!!! And terribly useful.

webstean avatar Oct 02 '24 03:10 webstean

After looking at the limitations of the API I'm considering an alternative syntax

data "powerplatform_environments" "get_by_id" {
  filter = {
    environment_id = "<guid>"
  }
}

data "powerplatform_environments" "get_default" {
  filter = {
     sku = "Default" # Default | Production | Sandbox | Developer
  }
}

data "powerplatform_environments" "get_unprotected" {
  filter = {
     security_group_id = "00000000-0000-0000-0000-000000000000"
  }
}

mattdot avatar Oct 03 '24 23:10 mattdot

If this issue remains blocked and there is no support in the API we should close it or lower its priority.

eduardodfmex avatar Jan 20 '25 18:01 eduardodfmex

closing because we can't implement with current API. feedback logged with API team

mattdot avatar Mar 06 '25 05:03 mattdot