vmware / terraform-provider-avi

Terraform AVI Networks provider
https://registry.terraform.io/providers/vmware/avi/latest/docs
Mozilla Public License 2.0
31 stars 32 forks source link

discovered_networks in avi_pool causes an update on each plan/apply #571

Open giovannibaratta opened 9 months ago

giovannibaratta commented 9 months ago

Describe the bug

When creating a resource of type avi_pool, leaving the attribute discovered_networks in servers will produce a diff in subsequent plan/apply.

Reproduction steps

resource "avi_pool" "pool2" {
  name                = "additional-pool"
  cloud_ref           = var.cloud_id
  default_server_port = 8200
  health_monitor_refs = [avi_healthmonitor.hm.id]

  servers {
    ip {
      type = "V4"
      addr = "172.17.0.14"
    }
    hostname = "this-is-a-value"
  }

  ssl_profile_ref = avi_sslprofile.pool_profile.id
}

Result in this terraform diff

Terraform will perform the following actions:

  # module.vault_cluster.module.lb[0].avi_pool.pool2 will be updated in-place
  ~ resource "avi_pool" "pool2" {
        id                                    = "https://172.17.0.30/api/pool/pool-feafecc3-1b69-466f-91dd-c4d4c6d8c0a6"
        name                                  = "additional-pool"
        # (38 unchanged attributes hidden)

      ~ servers {
            # (7 unchanged attributes hidden)

          - discovered_networks {
              - network_ref = "https://172.17.0.30/api/network/dvportgroup-4033-cloud-746a7edc-7d79-49f4-bffb-c8cc2a05967b" -> null

              - subnet {
                  - mask = "16" -> null

                  - ip_addr {
                      - addr = "172.17.0.0" -> null
                      - type = "V4" -> null
                    }
                }
            }

            # (1 unchanged block hidden)
        }

        # (1 unchanged block hidden)
    }

Plan: 0 to add, 1 to change, 0 to destroy.

Expected behavior

Terraform should not generate any difference during subsequent plan/apply

Additional context

From my understanding discovered_networks should be an internal-use attribute and it should not even be proposed as an editable attribute in terraform. In this case, leaving the attribute unset will produce the diff posted above.

Rohan-sss1 commented 9 months ago

HI @giovannibaratta I tried to reproduce the issue using the provided terraform config but unable to reproduce it. Can you provide the alb provider and controller version which you are using? Also add if you are performing any manual operations on pool from UI side

giovannibaratta commented 9 months ago

The terraform provider version is 22.1.5 The controller version is 30.1.1-9415

provider "avi" {
   ...
  avi_version    = "30.1.1"
}

All the AVI resources are provisioned using Terraform except for the Cloud configuration. The behavior is observed is subsequent runs (terraform plan/apply) without the need of open the UI.

Rohan-sss1 commented 9 months ago

@giovannibaratta Thanks for raising this issue; I am able to reproduce the issue. In the release of 22.1.5, we fixed the issue to track the UI side changes. While applying the Terraform plan, earlier it was not there; that's why it is showing diff, and some internal fields are part of the resource schema; those fields should not come. I will update here once I fix the issue.

Thanks

lopf commented 5 months ago

As this is really annoying, is there an ETA for the fix? Running provider 22.1.5 with controller 22.1.5 2p3 build 9093.

lopf commented 1 month ago

We're still desperately waiting for this to be fixed. Can you @Rohan-sss1 provide an ETA?