microsoft / terraform-provider-azuredevops

Terraform Azure DevOps provider
https://www.terraform.io/docs/providers/azuredevops/
MIT License
372 stars 260 forks source link

Allow data azuredevops_group return nil? #1021

Open lukaskolafa opened 2 months ago

lukaskolafa commented 2 months ago

Hello Team,

I would like to propose a change to the data azuredevops_group source to allow returning nil in case the group does not exist. This would allow us to use the data source for conditional group maintenance. The problem is, that AZDO creates some groups conditionally (e.g.: "Deployment Group Administrators").

My proposal would be, to update the function dataSourceGroupRead - include a new parameter called allow_empty_result and based on that throw an error in case the group is not found or returns nil. The default value would be false, so there is no breaking change for existing behavior.

If I create a PR for this change, would you accept it?

Our current workaround would be using an "external" data source with a custom script.

thanks

xuzhang3 commented 2 months ago

@lukaskolafa I would suggest add a filter to the azuredevops_groups then you can get the result directly if the group exists

lukaskolafa commented 2 months ago

ok, thanks!

On Tue, Apr 9, 2024 at 8:18 AM xuzhang3 @.***> wrote:

@lukaskolafa https://github.com/lukaskolafa I would suggest add a filter to the azuredevops_groups then you can get the result directly if the group exists

— Reply to this email directly, view it on GitHub https://github.com/microsoft/terraform-provider-azuredevops/issues/1021#issuecomment-2044226667, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABYQ6HTIHEGQ7PDC3I6MVCDY4OB5HAVCNFSM6AAAAABF4ZDTTGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDANBUGIZDMNRWG4 . You are receiving this because you were mentioned.Message ID: @.*** com>