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.58k stars 4.62k forks source link

Provider produced inconsistent final plan when expanding the plan for azurerm_network_interface_backend_address_pool_association #17462

Open cello86 opened 2 years ago

cello86 commented 2 years ago

Is there an existing issue for this?

Community Note

Terraform Version

1.2.2

AzureRM Provider Version

3.2.0

Affected Resource(s)/Data Source(s)

azurerm_network_interface

Terraform Configuration Files

resource "azurerm_network_interface" "fe_nic" {
  count               = var.fe_nodes_count
  name                = "vm-${var.vm_name}${format("%02d", count.index + 1)}-${var.environment}-${local.region_short_name}-nic"
  location            = data.azurerm_resource_group.main.location
  resource_group_name = data.azurerm_resource_group.main.name

  ip_configuration {
    name                          = "fe"
    subnet_id                     = data.azurerm_subnet.fe_subnet.id
    private_ip_address_allocation = "Dynamic"
  }

  tags = var.tags
}

resource "azurerm_network_interface_backend_address_pool_association" "example" {
  count                   = var.fe_nodes_count
  network_interface_id    = "${element(azurerm_network_interface.fe_nic.*.id, count.index)}"
  ip_configuration_name   = "fe"
  backend_address_pool_id = data.azurerm_lb_backend_address_pool.fe_lb_backend_pool.id
}

Debug Output/Panic Output

None

Expected Behaviour

None

Actual Behaviour

│ Error: Provider produced inconsistent result after apply
│
│ When applying changes to azurerm_network_interface.fe_nic[0], provider "provider[\"registry.terraform.io/hashicorp/azurerm\"]" produced an unexpected new value: Root resource was present, but now
│ absent.
│
│ This is a bug in the provider, which should be reported in the provider's own issue tracker.

Steps to Reproduce

terraform apply

Important Factoids

None

References

I noticed a similar issue on #5928 and if I use a dynamic name into the ip_configuration name the issue appears.

cello86 commented 2 years ago

We noticed that this problem appears only with the module integration.

Marcello

detredwings02 commented 1 year ago

I am also seeing this issue using v ~>3.10.0 of the provider.