Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: MonitorDiagnosticSetting continually updates #797

Open
1 task done
stevendborrelli opened this issue Aug 21, 2024 · 1 comment
Open
1 task done

[Bug]: MonitorDiagnosticSetting continually updates #797

stevendborrelli opened this issue Aug 21, 2024 · 1 comment
Labels
bug Something isn't working needs:triage

Comments

@stevendborrelli
Copy link
Contributor

stevendborrelli commented Aug 21, 2024

Is there an existing issue for this?

  • I have searched the existing issues

Affected Resource(s)

  • insights.azure.upbound.io/v1beta2 - MonitorDiagnosticSetting

Resource MRs required to reproduce the bug

# SPDX-FileCopyrightText: 2024 The Crossplane Authors <https://crossplane.io>
#
# SPDX-License-Identifier: Apache-2.0

apiVersion: insights.azure.upbound.io/v1beta2
kind: MonitorDiagnosticSetting
metadata:
  annotations:
    meta.upbound.io/example-id: insights/v1beta2/monitordiagnosticsetting
  labels:
    testing.upbound.io/example-name: insightsmds
  name: insightsmds
spec:
  forProvider:
    enabledLog:
      - categoryGroup: audit
    logAnalyticsDestinationType: Dedicated
    name: insightsmds
    storageAccountIdSelector:
      matchLabels:
        testing.upbound.io/example-name: insightsmds   
    targetResourceId: /subscriptions/${data.azurerm_client_config.current.subscription_resource_id}/resourceGroups/insightsmds/providers/Microsoft.Storage/storageAccounts/insightsmds/blobServices/default
---
apiVersion: keyvault.azure.upbound.io/v1beta2
kind: Vault
metadata:
  annotations:
    meta.upbound.io/example-id: insights/v1beta2/monitordiagnosticsetting
  labels:
    testing.upbound.io/example-name: insightsmds
  name: insightsmds
spec:
  forProvider:
    location: West Europe
    purgeProtectionEnabled: false
    resourceGroupNameSelector:
      matchLabels:
        testing.upbound.io/example-name: insightsmds
    skuName: standard
    softDeleteRetentionDays: 7
    tenantId: ${data.azurerm_client_config.current.tenant_id}

---

apiVersion: azure.upbound.io/v1beta1
kind: ResourceGroup
metadata:
  annotations:
    meta.upbound.io/example-id: insights/v1beta1/monitordiagnosticsetting
  labels:
    testing.upbound.io/example-name: insightsmds
  name: insightsmds
spec:
  forProvider:
    location: West Europe

---

apiVersion: storage.azure.upbound.io/v1beta2
kind: Account
metadata:
  annotations:
    meta.upbound.io/example-id: insights/v1beta2/monitordiagnosticsetting
  labels:
    testing.upbound.io/example-name: insightsmds
  name: insightsmds
spec:
  forProvider:
    accountReplicationType: LRS
    accountTier: Standard
    location: West Europe
    resourceGroupNameSelector:
      matchLabels:
        testing.upbound.io/example-name: insightsmds

Steps to Reproduce

Install the following providers:

provider-azure-containerservice          True        True      xpkg.upbound.io/upbound/provider-azure-containerservice:v1.4.0      11d
provider-azure-insights                  True        True      xpkg.upbound.io/upbound/provider-azure-insights:v1.4.0              7d15h
provider-azure-keyvault                  True        True      xpkg.upbound.io/upbound/provider-azure-keyvault:v1.4.0              7d15h
provider-azure-network                   True        True      xpkg.upbound.io/upbound/provider-azure-network:v1.4.0               11d
provider-azure-operationalinsights       True        True      xpkg.upbound.io/upbound/provider-azure-operationalinsights:v1.4.0   11h
provider-azure-storage                   True        True      xpkg.upbound.io/upbound/provider-azure-storage:v1.4.0               7d15h
upbound-provider-family-azure            True        True      xpkg.upbound.io/upbound/provider-family-azure:v1.4.0                11d
  • Enable debugging on provider-azure-insights
  • Apply the manifest
  • Review debug logs

What happened?

Resource will continually try to update itself on the logAnalyticsDestinationType field. The provider attempts to set the field, but atProvider returns a null value.

Relevant Error Output Snippet

2024-08-21T05:26:45Z	DEBUG	provider-azure	Diff detected	{"uid": "e5e1f802-1ee5-4178-a627-26d357ec044a", "name": "insightsmds", "gvk": "insights.azure.upbound.io/v1beta1, Kind=MonitorDiagnosticSetting", "instanceDiff": "*terraform.InstanceDiff{mu:sync.Mutex{state:0, sema:0x0}, Attributes:map[string]*terraform.ResourceAttrDiff{\"log_analytics_destination_type\":*terraform.ResourceAttrDiff{Old:\"\", New:\"Dedicated\", NewComputed:false, NewRemoved:false, NewExtra:interface {}(nil), RequiresNew:false, Sensitive:false, Type:0x0}}, Destroy:false, DestroyDeposed:false, DestroyTainted:false, RawConfig:cty.NilVal, RawState:cty.NilVal, RawPlan:cty.NilVal, Meta:map[string]interface {}(nil)}"}

Crossplane Version

1.16.0

Provider Version

1.4.0

Kubernetes Version

No response

Kubernetes Distribution

No response

Additional Info

Possibly related:
hashicorp/terraform-provider-azurerm#20203,
hashicorp/terraform-provider-azurerm#17779, and Azure/azure-rest-api-specs#22400.

@turkenf
Copy link
Collaborator

turkenf commented Oct 9, 2024

Hi @stevendborrelli, thanks for the issue report and clear replication steps 🙌

The issue cannot be reproduced with the latest provider version, v1.7.0:

spec:
  deletionPolicy: Delete
  forProvider:
    enabledLog:
    - categoryGroup: audit
    logAnalyticsDestinationType: Dedicated
    metric:
    - category: AllMetrics
      retentionPolicy:
        enabled: false
    name: insightsmds
    storageAccountId: /subscriptions/<redacted>/resourceGroups/insightsmds/providers/Microsoft.Storage/storageAccounts/insightsmds
    storageAccountIdRef:
      name: insightsmds
    storageAccountIdSelector:
      matchLabels:
        testing.upbound.io/example-name: insightsmds
    targetResourceId: /subscriptions/<redacted>/resourceGroups/insightsmds/providers/Microsoft.KeyVault/vaults/insightsmds
  initProvider: {}
  managementPolicies:
  - '*'
  providerConfigRef:
    name: default
status:
  atProvider:
    enabledLog:
    - category: ""
      categoryGroup: audit
      retentionPolicy:
        days: 0
        enabled: false
    eventhubAuthorizationRuleId: ""
    eventhubName: ""
    id: /subscriptions/<redacted>/resourceGroups/insightsmds/providers/Microsoft.KeyVault/vaults/insightsmds|insightsmds
    log:
    - category: ""
      categoryGroup: allLogs
      enabled: false
      retentionPolicy:
        days: 0
        enabled: false
    - category: ""
      categoryGroup: audit
      enabled: true
      retentionPolicy:
        days: 0
        enabled: false
    logAnalyticsDestinationType: Dedicated
    logAnalyticsWorkspaceId: ""
    metric:
    - category: AllMetrics
      enabled: true
      retentionPolicy:
        days: 0
        enabled: false
    name: insightsmds
    storageAccountId: /subscriptions/<redacted>/resourceGroups/insightsmds/providers/Microsoft.Storage/storageAccounts/insightsmds
    targetResourceId: /subscriptions/<redacted>/resourceGroups/insightsmds/providers/Microsoft.KeyVault/vaults/insightsmds
  conditions:
  - lastTransitionTime: "2024-10-09T19:31:11Z"
    reason: Available
    status: "True"
    type: Ready
  - lastTransitionTime: "2024-10-09T19:30:59Z"
    reason: ReconcileSuccess
    status: "True"
    type: Synced
  - lastTransitionTime: "2024-10-09T19:31:04Z"
    reason: Success
    status: "True"
    type: LastAsyncOperation
  - lastTransitionTime: "2024-10-09T19:32:58Z"
    reason: UpToDate
    status: "True"
    type: Test

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working needs:triage
Projects
None yet
Development

No branches or pull requests

2 participants