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.51k stars 4.6k forks source link

azurerm_kubernetes_cluster_node_pool wants to be recreated because kubernetes_cluster_id changes from resourcegroups -> resourceGroups #11075

Closed mauriciodou closed 2 years ago

mauriciodou commented 3 years ago

Community Note

Terraform (and AzureRM Provider) Version

Terraform v0.13.6
+ provider registry.terraform.io/hashicorp/azurerm v2.47.0

Affected Resource(s)

Terraform Configuration Files

resource "azurerm_kubernetes_cluster_node_pool" "application" {
  count                 = var.multi_np_flag ? 1 : 0
  name                  = "application"
  mode                  = "User"
  kubernetes_cluster_id = azurerm_kubernetes_cluster.cluster.id # This id is forcing the recreation
  node_count            = local.node_count
  min_count             = local.min_count
  max_count             = var.max_count
  vm_size               = var.vm_size
  os_disk_size_gb       = var.os_disk_size_gb
  vnet_subnet_id        = local.subnet_id
  enable_auto_scaling   = var.enable_auto_scaling
  availability_zones    = var.availability_zones
  orchestrator_version  = local.kubernetes_version
  tags                  = var.standard_tags
  node_labels           = { "kroger/node-type" : "application" }
  lifecycle {
    ignore_changes = [
      node_count
    ]
  }
}

Debug Output

Panic Output

Expected Behaviour

Terraform should not be recreating the node pool or provide a migration for the changed id.

Actual Behaviour

The state has: kubernetes_cluster_id = "/subscriptions/xxx/resourcegroups/rg6744galactusk8dev/providers/Microsoft.ContainerService/managedClusters/galactus-cluster-dev-aks"

But has changed to: kubernetes_cluster_id = "/subscriptions/xxx/resourceGroups/rg6744galactusk8dev/providers/Microsoft.ContainerService/managedClusters/galactus-cluster-dev-aks"

Note the resourcegroups -> resourceGroups change. Perhaps this was updated in a version?

Steps to Reproduce

  1. terraform plan

Important Factoids

References

stephybun commented 2 years ago

Hi @mauriciodou, thanks for raising this issue. Since this was re-raised in #13919 where there is an ongoing discussion I am going to close this issue. Please subscribe to #13919 for updates.

Thanks!

github-actions[bot] commented 2 years ago

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.