Here’s a piece of terraform code I wrote:
data "azurerm_subscription" "current" {
}
data "azurerm_role_definition" "foo-bar" {
name = "foo-bar"
scope = data.azurerm_subscription.current.id
}
output "scope" {
value = data.azurerm_subscription.current.id
}
The error I get is
Error loading Role Definition List: could not find role 'foo-bar'
That said, when I open Azure Portal and open the Roles tab for data.azurerm_subscription.current.id
subscription, I can see that foo-bar
role in that list. How can I debug / fix that?
I can also see that role when running
az role definition list -n foo-bar
[
{
"assignableScopes": [
"/subscriptions/1111..." # same as data.azurerm_subscription.current.id
],