I am having trouble with secret value update. If I recreate azurerm_windows_function_app with new name the new ID is not being updated in secret value. The secret will contain old ID of the azurerm_windows_function_app.
resource "azurerm_windows_function_app" "function_app" {
name = "function-app"
resource_group_name = azurerm_resource_group.xxxx.name
location = azurerm_resource_group.xxxx.location
storage_account_name = azurerm_storage_account.xxx.name
service_plan_id = azurerm_service_plan.xxxx.id
site_config {}
}
resource "azurerm_key_vault_secret" "function_app_id" {
name = "function-app-id"
value = azurerm_windows_function_app.function_app.id
key_vault_id = var.vault_id
}