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.46k stars 4.54k forks source link

Error: Provider produced inconsistent result after apply #26409

Open ar316234 opened 2 weeks ago

ar316234 commented 2 weeks ago

Is there an existing issue for this?

Community Note

Terraform Version

1.8.5

AzureRM Provider Version

3.52.0

Affected Resource(s)/Data Source(s)

azurerm_network_interface_backend_address_pool_association

Terraform Configuration Files

We were working one 4 server deployment via terraform and after apply it failed with the below error.
while adding the internal load balancer backend pull.
Though in the azure console we could see that resources created properly.

Debug Output/Panic Output

Error: Provider produced inconsistent result after apply
When applying changes to module.compute.module.windows["UAENP-DCP-02"].azurerm_network_interface_backend_address_pool_association.windows["/subscriptions/b56001aa-ae04-4759-82b8-e403cd83d2df/resourceGroups/SERVC001-UAENORTH/providers/Microsoft.Network/networkInterfaces/UAENP-DCP-02_nic_01./subscriptions/b56001aa-ae04-4759-82b8-e403cd83d2df/resourceGroups/SERVC001-UAENORTH/providers/Microsoft.Network/loadBalancers/UAENP-DNS-INTERNAL-LB/backendAddressPools/PROD-DNS-Internal-BackEnd"], provider "provider[\"registry.terraform.io/hashicorp/azurerm\"]" produced an unexpected new value: Root object was present, but now absent.

This is a bug in the provider, which should be reported in the provider's own issue tracker.

Expected Behaviour

image

Actual Behaviour

image

Steps to Reproduce

This is a simple azure VM build task which we were doing with all the additional components like LB, ever faced this kind of error previously. and please make it noted that the for which we got this error actually got created, please check the above mentioned picture.

Important Factoids

No response

References

No response

neil-yechenwei commented 2 weeks ago

Thanks for raising this issue. Seems I can't reproduce this issue with below tf config and latest tf azurerm provider. Could you provide reproduce steps and the simplest tf config that triggers this issue? Could you also try below tf config with latest tf azurerm provider to see if the issue still exists? Thanks.

provider "azurerm" {
  features {}
}

resource "azurerm_resource_group" "test" {
  name     = "acctestRG-nica-test02"
  location = "westeurope"
}

resource "azurerm_virtual_network" "test" {
  name                = "acctestvn-test02"
  address_space       = ["10.0.0.0/16"]
  location            = azurerm_resource_group.test.location
  resource_group_name = azurerm_resource_group.test.name
}

resource "azurerm_subnet" "test" {
  name                 = "testsubnet"
  resource_group_name  = azurerm_resource_group.test.name
  virtual_network_name = azurerm_virtual_network.test.name
  address_prefixes     = ["10.0.2.0/24"]
}

resource "azurerm_public_ip" "test" {
  name                = "test-ip-test02"
  location            = azurerm_resource_group.test.location
  resource_group_name = azurerm_resource_group.test.name
  allocation_method   = "Static"
}

resource "azurerm_lb" "test" {
  name                = "acctestlb-test02"
  location            = azurerm_resource_group.test.location
  resource_group_name = azurerm_resource_group.test.name

  frontend_ip_configuration {
    name                 = "primary"
    public_ip_address_id = azurerm_public_ip.test.id
  }
}

resource "azurerm_lb_backend_address_pool" "test" {
  loadbalancer_id = azurerm_lb.test.id
  name            = "acctestpool"
}

resource "azurerm_network_interface" "test" {
  name                = "acctestni-test02"
  location            = azurerm_resource_group.test.location
  resource_group_name = azurerm_resource_group.test.name

  ip_configuration {
    name                          = "testconfiguration1"
    subnet_id                     = azurerm_subnet.test.id
    private_ip_address_allocation = "Dynamic"
  }
}

resource "azurerm_network_interface_backend_address_pool_association" "test" {
  network_interface_id    = azurerm_network_interface.test.id
  ip_configuration_name   = "testconfiguration1"
  backend_address_pool_id = azurerm_lb_backend_address_pool.test.id
}

resource "azurerm_network_interface" "test2" {
  name                = "acctestni-test03"
  location            = azurerm_resource_group.test.location
  resource_group_name = azurerm_resource_group.test.name

  ip_configuration {
    name                          = "testconfiguration1"
    subnet_id                     = azurerm_subnet.test.id
    private_ip_address_allocation = "Dynamic"
  }
}

resource "azurerm_network_interface_backend_address_pool_association" "test2" {
  network_interface_id    = azurerm_network_interface.test2.id
  ip_configuration_name   = "testconfiguration1"
  backend_address_pool_id = azurerm_lb_backend_address_pool.test.id
}

resource "azurerm_lb_backend_address_pool" "test2" {
  loadbalancer_id = azurerm_lb.test.id
  name            = "acctestpool2"
}

resource "azurerm_network_interface" "test4" {
  name                = "acctestni-test04"
  location            = azurerm_resource_group.test.location
  resource_group_name = azurerm_resource_group.test.name

  ip_configuration {
    name                          = "testconfiguration1"
    subnet_id                     = azurerm_subnet.test.id
    private_ip_address_allocation = "Dynamic"
  }
}

resource "azurerm_network_interface_backend_address_pool_association" "test4" {
  network_interface_id    = azurerm_network_interface.test4.id
  ip_configuration_name   = "testconfiguration1"
  backend_address_pool_id = azurerm_lb_backend_address_pool.test2.id
}

resource "azurerm_network_interface" "test5" {
  name                = "acctestni-test05"
  location            = azurerm_resource_group.test.location
  resource_group_name = azurerm_resource_group.test.name

  ip_configuration {
    name                          = "testconfiguration1"
    subnet_id                     = azurerm_subnet.test.id
    private_ip_address_allocation = "Dynamic"
  }
}

resource "azurerm_network_interface_backend_address_pool_association" "test5" {
  network_interface_id    = azurerm_network_interface.test5.id
  ip_configuration_name   = "testconfiguration1"
  backend_address_pool_id = azurerm_lb_backend_address_pool.test2.id
}