CiscoDevNet / terraform-provider-catalystcenter

Terraform Cisco Catalyst Center Provider
https://registry.terraform.io/providers/CiscoDevNet/catalystcenter
Mozilla Public License 2.0
8 stars 5 forks source link

catalystcenter_ip_pool forces replacement even if there is no change #125

Closed jolstorn closed 2 weeks ago

jolstorn commented 1 month ago

After terraform apply of new global ip pool catalystcenter reports correct information:

        {
            "ipPoolName": "glob_net_1",
            "dhcpServerIps": [],
            "gateways": [],
            "createTime": 1725532689040,
            "lastUpdateTime": 1725532723037,
            "totalIpAddressCount": 128,
            "usedIpAddressCount": 128,
            "parentUuid": "root",
            "owner": "ipam",
            "shared": true,
            "overlapping": false,
            "configureExternalDhcp": false,
            "usedPercentage": "100",
            "clientOptions": {},
            "ipPoolType": "generic",
            "unavailableIpAddressCount": 0,
            "availableIpAddressCount": 0,
            "totalAssignableIpAddressCount": 126,
            "dnsServerIps": [],
            "hasSubpools": false,
            "defaultAssignedIpAddressCount": 2,
            "context": [
                {
                    "owner": "ipam",
                    "contextKey": "type",
                    "contextValue": "generic"
                }
            ],
            "ipv6": false,
            "id": "0b4b3be7-e785-4b1c-8c5b-c89a400d2240",
            "ipPoolCidr": "10.10.10.0/25"
        },

But data is not written to state:

        {
          "index_key": "glob_net_1",
          "schema_version": 0,
          "attributes": {
            "dhcp_server_ips": null,
            "dns_server_ips": null,
            "gateway": null,
            "id": "",
            "ip_address_space": "IPv4",
            "ip_subnet": null,
            "name": null,
            "type": "generic"
          },
          "sensitive_attributes": []
        },

Which causes next terraform apply to try force replace on the same resource.

  # catalystcenter_ip_pool.pool_global["glob_net_1"] must be replaced
-/+ resource "catalystcenter_ip_pool" "pool_global" {
      + id               = (known after apply)
      + ip_subnet        = "10.10.10.0/25"
      + name             = "glob_net_1" # forces replacement
        # (2 unchanged attributes hidden)
    }
jolstorn commented 1 month ago

Might be ralated to https://github.com/CiscoDevNet/terraform-provider-catalystcenter/issues/125 and api issues with more pools than 25.

jolstorn commented 1 month ago

As a workaround I can add attributes.name and attributes.id manually to the state. Subsequent applies are successful / no change.

danischm commented 2 weeks ago

Fixed in v0.1.13 release.