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

Duplicate IPs in different sections #57

Closed calloes closed 1 year ago

calloes commented 1 year ago

Hi,

Currently implementing multiple sections for different environments.

When using either phpipam_first_free_address or phpipam_first_free_subnet and the same address or subnet exists in another section then we see errors such ,

phpipam_first_free_address.ipam_address: Creating... ╷ │ Error: Your search returned zero or multiple results. Please correct your search and try again │  │  with phpipam_first_free_address.ipam_address, │  on module_rcc_core.tf line 91, in resource "phpipam_first_free_address" "ipam_address": │  91: resource "phpipam_first_free_address" "ipam_address" { │  ╵

Noting terraform actually creates the resource but never complets and add's it into state.

If we delete the duplicate record in the other section the transaction completes fine. Checking the code i see its's doing a call in the resource_phpipam_first_free_address.go addrs, err := c.GetAddressesByIP(out) which understandably returns all the addresses, i think this needs to be done by the subnet reference so it doesn't pull back duplicates in other sections.

Any help greatly appreciated.

steffencircle commented 1 year ago

Hi,

we ran into the same issue and the issue is fixed with #56 . It was merged to master, but since then no new release was created.

@lord-kyron @pavel-z1 Do you have any plans on when to push a new release ?

lord-kyron commented 1 year ago

@steffencircle Here you are: https://github.com/lord-kyron/terraform-provider-phpipam/releases/tag/v1.3.8