│ Error: Invalid index
│
│ on .terraform/modules/role_assignments/local.role.assignments.for.resources.tf line 39, in locals:
│ 39: scope = data.azurerm_resources.resources_by_resource_group_and_name[key].resources[0].id
│ ├────────────────
│ │ data.azurerm_resources.resources_by_resource_group_and_name is object with 1 attribute "example1"
│
│ The given key does not identify an element in this collection value: the collection has no elements.
Check for previous/existing GitHub issues
Issue Type?
Bug
(Optional) Module Version
0.0.1
(Optional) Correlation Id
No response
Description
when trying to apply the following module: module "role_assignments" { source = "Azure/avm-res-authorization-roleassignment/azurerm" version = "0.0.1"
groups_by_display_name = { group1 = "Example Group" }
role_definitions = { contributor = "Contributor" }
role_assignments_for_resources = { example1 = { resource_name = "kv-example" resource_group_name = "rg-example" role_assignments = { role_assignment_1 = { role_definition = "contributor" groups = ["group1"] } } }
} }
I'm receiving the following error:
│ Error: Invalid index │ │ on .terraform/modules/role_assignments/local.role.assignments.for.resources.tf line 39, in locals: │ 39: scope = data.azurerm_resources.resources_by_resource_group_and_name[key].resources[0].id │ ├──────────────── │ │ data.azurerm_resources.resources_by_resource_group_and_name is object with 1 attribute "example1" │ │ The given key does not identify an element in this collection value: the collection has no elements.
although I'm pretty sure my module is valid?