terraform-provider-azapi icon indicating copy to clipboard operation
terraform-provider-azapi copied to clipboard

bug: ignore diagnostics settings categories that are not enabled

Open kewalaka opened this issue 1 year ago • 2 comments

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)

kewalaka avatar Jan 04 '25 23:01 kewalaka

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 avatar Jan 06 '25 05:01 ms-henglu

@ms-henglu this isn't a top priority ask, but it does seem like a nice QoL improvement.

stemaMSFT avatar Jan 09 '25 19:01 stemaMSFT