Invalid reference from destroy provisioner

On one of my modules i keep getting a pipeline error saying: Invalid reference from destroy provisioner: Destroy-time provisioners and their connection configurations may only reference attributes of the related resource, via ‘self’, ‘count.index’, or ‘each.key’.

provisioner “local-exec” {

when       = destroy

command    = "az network nic ip-config update --name ${var.vm_name}-ip --resource-group ${data.azurerm_resource_group.vm_rg.name} --nic-name ${var.vm_name}-nic --remove PublicIpAddress"

on_failure = continue

}

what do i need to change in order for this to work with the latest terraform version?

Thanks
}