After upgrading from azure/azapi version 2.7.0 to version 2.8.0, I get the following error when running an apply to modify existing resources. Switching back to version 2.7.0 resolves the issue.
Error: Missing Resource Identity After Read
│
│ with module.policy.azapi_resource.remediation["vm-plnd-mnt-VMPlannedMaintenance"],
│ on ......\terraform-registry\modules\azure\policy\main.remediation.tf line 40, in resource "azapi_resource" "remediation":
│ 40: resource "azapi_resource" "remediation" {
│
│ The Terraform Provider unexpectedly returned no resource identity data after having no errors in the resource read. This is always an issue in the Terraform Provider and should be reported to the provider
│ developers.
The resource block that's being referenced:
resource "azapi_resource" "remediation" {
for_each = local.remediation_tasks_map
type = "Microsoft.PolicyInsights/remediations@2024-10-01"
name = "${each.key}-remediation"
parent_id = each.value.assignment_scope
body = {
properties = {
policyAssignmentId = azapi_resource.assignment[each.value.assignment_name].id
policyDefinitionReferenceId = each.value.policy_ref_id
resourceDiscoveryMode = each.value.resource_discovery_mode
}
}
depends_on = [azapi_resource.assignment]
}