terraform-provider-azuread icon indicating copy to clipboard operation
terraform-provider-azuread copied to clipboard

directory object data source fails on unexpected object type

Open chrismilson opened this issue 1 year ago • 2 comments

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritise this request
  • Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritise the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Terraform (and AzureAD Provider) Version

Terraform v1.3.7 on windows_amd64

  • provider registry.terraform.io/hashicorp/azuread v2.42.0

Affected Resource(s)

  • azuread_directory_object data source

Terraform Configuration Files

data "azuread_directory_object" "this" {
  object_id = ... # object type "#microsoft.graph.device"
}

Expected Behavior

I expected the code to succeed; and for the data source to have some string (not documented, so not sure what the format would be) indicating the type of the object.

Actual Behavior

The code failed with error:

╷
│ Error: unknown object type "#microsoft.graph.device" returned for directory object with ID: "..."
│ ...

Steps to Reproduce

  1. terraform plan

chrismilson avatar Sep 20 '23 15:09 chrismilson

We have a use case where we want to collect the users in multiple groups, however these groups may contain other directory objects that are out of our control. In the case of those objects, we want our code to ignore those objects, but in its current state, the provider throws an error, preventing us from continuing.

chrismilson avatar Sep 20 '23 16:09 chrismilson

Any progress on this? I made a quick and dirty PR that just uses the string from upstream as-is. Would be great to get a review so that I can improve the solution or get this merged.

chrismilson avatar Oct 25 '23 14:10 chrismilson