lord-kyron / terraform-provider-phpipam

Terrform provider for PHPIPAM
https://registry.terraform.io/providers/lord-kyron/phpipam/latest
Apache License 2.0
54 stars 30 forks source link

Spurious "No custom fields defined" error #81

Closed tseeker closed 9 months ago

tseeker commented 1 year ago

I am managing a bunch of addresses in a phpIPAM instance that has no custom fields defined, as the screenshot below shows.

no-custom-fields

The resource definitions are pretty straightforward:


resource "phpipam_address" "ipv6" {
  for_each = local.addr_allocations

  subnet_id   = data.phpipam_subnet.subnet6[each.value.network].subnet_id
  hostname    = each.value.dns_name
  description = each.value.description
}

Resource creation works fine in all cases. However, when trying to update these resources (in my specific case, due to a change in description), I get the following error for each updated resource:

│ Error: Error getting custom fields for updating: Error from API (404): No custom fields defined
│
│   with module.autobuild.phpipam_address.ipv6["..."],
│   on autobuild/ipam.tf line 73, in resource "phpipam_address" "ipv6":
│   73: resource "phpipam_address" "ipv6" {

Despite the error, the IP address record is actually updated in phpIPAM. However I still need to re-run Terraform for the state to update.

I have tried adding an empty custom_fields entry (as mentioned in #73), but that had no effect.