Hello…
i have been tasked to write the below code with minimal lines, rather having 3 resource blocks can this be done in a single block using for_each function. It should be scalable in near future when we add additional role assignements. Can someone please help
resource “azurerm_role_assignment” “role_assignment_01” {
scope = data.azurerm_subscription.primary.id
role_definition_name = “Reader”
principal_id = data.azurerm_client_config.example.object_id
}
resource “azurerm_role_assignment” “role_assignment_02” {
scope = data.azurerm_subscription.primary.id
role_definition_name = “Contributor”
principal_id = data.azurerm_client_config.example.object_id
}
resource “azurerm_role_assignment” “role_assignment_03” {
scope = data.azurerm_subscription.primary.id
role_definition_name = “Network Contributor”
principal_id = data.azurerm_client_config.example.object_id
}