user object id null azure terraform Archives - For all your terraform needs https://terraformarchitect.com/tag/user-object-id-null-azure-terraform/ Automation cannot be an afterthought (TM) Tue, 17 Jan 2023 13:22:32 +0000 en-US hourly 1 https://wordpress.org/?v=6.5.5 data.azurerm_client_config.current.object_id returns null “” https://terraformarchitect.com/known-issues-terraform/data-azurerm_client_config-current-object_id-returns-null/?utm_source=rss&utm_medium=rss&utm_campaign=data-azurerm_client_config-current-object_id-returns-null https://terraformarchitect.com/known-issues-terraform/data-azurerm_client_config-current-object_id-returns-null/#respond Tue, 06 Sep 2022 13:48:44 +0000 https://terraformarchitect.com/?p=245 You may be using the current client config object to retrieve the current user’s object id. And that used to work just fine. object_id =  data.azurerm_client_config.current.object_id However, for me, this […]

The post data.azurerm_client_config.current.object_id returns null “” appeared first on For all your terraform needs.

]]>
You may be using the current client config object to retrieve the current user’s object id. And that used to work just fine.

object_id =  data.azurerm_client_config.current.object_id
However, for me, this started returning an empty string. This was the workaround I found:
#AV - diff route to get current user object id

data external account_info {
  program                      = [
                                 "az",
                                 "ad",
                                 "signed-in-user",
                                 "show",
                                 "--query",
                                 "{object_id:id}",
                                 "-o",
                                 "json",
                                 ]
}
/*output user_object_id {
    value = data.external.account_info.result.object_id
}*/
Summary
data.azurerm_client_config.current.object_id  does not return a correct user object id can be fixed by using a different approach – shown above.

The post data.azurerm_client_config.current.object_id returns null “” appeared first on For all your terraform needs.

]]>
https://terraformarchitect.com/known-issues-terraform/data-azurerm_client_config-current-object_id-returns-null/feed/ 0