Juniper / terraform-provider-apstra

Apstra Terraform Provider
Apache License 2.0
16 stars 2 forks source link

Eliminate apparent state churn with resource pool computed attributes #927

Closed chrismarget-j closed 1 month ago

chrismarget-j commented 1 month ago

This PR eliminates apparent state churn related to always-null computed values in pool resources.

Consider a simple pool name change:

Before:

  # apstra_vni_pool.x will be updated in-place
  ~ resource "apstra_vni_pool" "x" {
        id              = "686e9c0b-e084-4e9a-9498-f9efa698969b"
      ~ name            = "bar" -> "foo"
      ~ ranges          = [
          - {
              - first = 5001 -> null
              - last  = 5010 -> null
            },
          + {
              + first           = 5001
              + last            = 5010
              + status          = (known after apply)
              + total           = (known after apply)
              + used            = (known after apply)
              + used_percentage = (known after apply)
            },
        ]
      + status          = (known after apply)
      + total           = (known after apply)
      + used            = (known after apply)
      + used_percentage = (known after apply)
    }

Note that most of the output is computed values which are going to be null anyway (#737, #752).

After:

  # apstra_vni_pool.x will be updated in-place
  ~ resource "apstra_vni_pool" "x" {
        id     = "686e9c0b-e084-4e9a-9498-f9efa698969b"
      ~ name   = "bar" -> "foo"
        # (1 unchanged attribute hidden)
    }

In this PR we have:

Tested with:

Closes #923