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

Data source phpipam_address returns an error for an unallocated/unreserved ip address #37

Closed MisterRaviolii closed 2 years ago

MisterRaviolii commented 2 years ago

Affected Resource(s) phpipam_address data source

Terraform Version v1.0.8

Provider Version v1.2.8

Terraform Script data "phpipam_address" "address" { ip_address="10.18.160.132" }

Output Error: JSON parsing error: json: cannot unmarshal number into Go struct field APIResponse.Success of type bool - Response body: {"code":200,"success":0,"message":"Address not found","time":0.006}

Actual Behavior For IP addresses that are not reserved or allocated in IPAM, the data sources throws an error. Can you please resolve this?

Expected Behavior Data source returns an empty record or a record with 'Address not found'.

MrKoopaKiller commented 2 years ago

Same behaviour for sections:

data "phpipam_section" "section" {
  name = "notexists"
}

Error: Error from API (404): Not Found

It would be nice if it returns an empty record

lord-kyron commented 2 years ago

@pavel-z1 - can you help with this one also? Thanks!

pavel-z1 commented 2 years ago

Hi @MrKoopaKiller @MisterRaviolii Try now with latest PR