data.azurerm_client_config.current.object_id returns null “”
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.
Leave a Reply