When module_enabled set to false in the kusto_cluster, gives a reference error to the azurerm_kusto_cluster resource.
Private Endpoint Module should be disabled using the count property like other pe modules like storage.
Details
> ╷
> │ Error: Invalid index
> │
> │ on .terraform/modules/kusto_cluster/terraform/data-explorer/kusto-cluster/main.tf line 31, in module "dec_pe":
> │ 31: basename = "${azurerm_kusto_cluster.adl_dec[0].name}-dec"
> │ ├────────────────
> │ │ azurerm_kusto_cluster.adl_dec is empty tuple
> │
> │ The given key does not identify an element in this collection value: the collection has no elements.
> ╵
> ╷
> │ Error: Invalid index
> │
> │ on .terraform/modules/kusto_cluster/terraform/data-explorer/kusto-cluster/main.tf line 35, in module "dec_pe":
> │ 35: private_connection_resource_id = azurerm_kusto_cluster.adl_dec[0].id
> │ ├────────────────
> │ │ azurerm_kusto_cluster.adl_dec is empty tuple
> │
> │ The given key does not identify an element in this collection value: the collection has no elements.
> ╵
When module_enabled set to false in the kusto_cluster, gives a reference error to the azurerm_kusto_cluster resource. Private Endpoint Module should be disabled using the count property like other pe modules like storage.
Details
> ╷ > │ Error: Invalid index > │ > │ on .terraform/modules/kusto_cluster/terraform/data-explorer/kusto-cluster/main.tf line 31, in module "dec_pe": > │ 31: basename = "${azurerm_kusto_cluster.adl_dec[0].name}-dec" > │ ├──────────────── > │ │ azurerm_kusto_cluster.adl_dec is empty tuple > │ > │ The given key does not identify an element in this collection value: the collection has no elements. > ╵ > ╷ > │ Error: Invalid index > │ > │ on .terraform/modules/kusto_cluster/terraform/data-explorer/kusto-cluster/main.tf line 35, in module "dec_pe": > │ 35: private_connection_resource_id = azurerm_kusto_cluster.adl_dec[0].id > │ ├──────────────── > │ │ azurerm_kusto_cluster.adl_dec is empty tuple > │ > │ The given key does not identify an element in this collection value: the collection has no elements. > ╵