bug: ignore diagnostics settings categories that are not enabled
When setting diagnostic settings, any that are not enabled should be removed from the items returned.
e.g. for a storage account, if you set "StorageDelete" and "StorageWrite", on subsequent plans you will see this:
~ resource "azapi_resource" "diagnostic_settings" {
~ body = {
~ properties = {
~ logs = [
{
category = "StorageDelete"
categoryGroup = null
enabled = true
},
- {
- category = "StorageRead"
- categoryGroup = null
- enabled = false
},
{
category = "StorageWrite"
categoryGroup = null
enabled = true
},
]
# (7 unchanged attributes hidden)
Hi @kewalaka ,
Thank you for taking time to report this issue.
The azapi_resource is a generic resource to manage all azure resources, so it uses an universal way to compare between configuration and remote states, for example, there's no customized logic to remove the disabled settings from the diagnostic settings.
But I think we could improve this in the future, by introducing a machniesm to suppress the difference when the array returns not-configured items.
@ms-henglu this isn't a top priority ask, but it does seem like a nice QoL improvement.