I am new to terraform and trying to understand how it exactly works with updating appsettings. I am using the following code block to insert values into the appsettings.
resource "azapi_update_resource" "UpdateWebAppSettings" {
type = "Microsoft.Web/sites/config@2022-03-01"
name = "appsettings"
parent_id = "/subscriptions/${data.azurerm_client_config.current.subscription_id}/resourceGroups/${var.RGName}/providers/Microsoft.Web/sites/${var.WebAppName}"
ignore_missing_property = true
body = {
properties = {
SQLServerNameFromKeyVault = data.azurerm_key_vault_secret.GetSQLServerName.value
StorageAccountAccessKey = azurerm_storage_account.storageaccount.primary_access_key
}
}
}
When I add a new line after StorageAccountAccessKey to add a new setting, it removes all the old ones. Is it necessary to merge old settings with the new ones ( I saw something like that) or is there an easy way to achieve this?
I did research but wasn’t succesfull