terraform-provider-avi icon indicating copy to clipboard operation
terraform-provider-avi copied to clipboard

discovered_networks in avi_pool causes an update on each plan/apply

Open giovannibaratta opened this issue 1 year ago • 5 comments

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.

giovannibaratta avatar Dec 04 '23 16:12 giovannibaratta