hashicorp / terraform-provider-azurerm

Terraform provider for Azure Resource Manager
https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs
Mozilla Public License 2.0
4.52k stars 4.6k forks source link

azurerm_resource_provider_registration "Microsoft.Compute" always updates the resource despite no changes made #25752

Open mruepp opened 4 months ago

mruepp commented 4 months ago

Is there an existing issue for this?

Community Note

Terraform Version

1.8.2

AzureRM Provider Version

3.97.1

Affected Resource(s)/Data Source(s)

azurerm_resource_provider_registration

Terraform Configuration Files

locals {
  common_resource_providers      = toset([
                                    "Microsoft.Storage",
                                    "Microsoft.Compute",
                                    "Microsoft.KeyVault",
                                    "Microsoft.Kubernetes",
                                    "Microsoft.Network",
                                    "Microsoft.DevTestLab",
                                  ])

}

resource "azurerm_resource_provider_registration" "logmon" {
  for_each  = var.ISPRD || var.ISINT ? local.common_resource_providers : []
  name      = each.key
}

Debug Output/Panic Output

# azurerm_resource_provider_registration.logmon["Microsoft.Compute"] will be updated in-place
  ~ resource "azurerm_resource_provider_registration" "logmon" {
        id   = "/subscriptions/<REDACTED>/providers/Microsoft.Compute"
        name = "Microsoft.Compute"

      - feature {
          - name       = "FastPathForced_uswestcentral" -> null
          - registered = false -> null
        }
    }

Expected Behaviour

The resource provider should not change anything because we never introduced the feature:

      - feature {
          - name       = "FastPathForced_uswestcentral" -> null
          - registered = false -> null
        }

wether via terraform nor via Azure Gui config or something else.

Actual Behaviour

Despite the provider was registered, each run of the tf conf reconfigures the following:

      - feature {
          - name       = "FastPathForced_uswestcentral" -> null
          - registered = false -> null
        }

This results in extremely long runs because the reconfiguring of the Resource providers results in 20-30min runs.

Why is the feature enabled anyway? Our location is switzerlandnorth and we never use the uswestcentral region:

      - feature {
          - name       = "FastPathForced_uswestcentral" -> null
          - registered = false -> null
        }

Steps to Reproduce

Configure subscription resource providers via terraform Rerun the terraform plan/apply. The feature gets introduced without defining it.

Important Factoids

Region is Switzerlandnorth

References

No response

aochsner commented 4 months ago

FWIW seeing the same behavior today.

TF Version 1.5.1 Provider version 3.91.0

Strongly suspecting something on the MSFT side...

pranabpm commented 4 months ago

My Cx is seeing same issue and its taking them > 16min without any changes to their code. Is there an active case registered that MSFT team is working on? Interested to get an update on potential fix.