Closed JonTheNiceGuy closed 6 months ago
@pavel-z1
Hi @JonTheNiceGuy
I don't see pool
in the PHPIPAM REST API documentation https://phpipam.net/api/api_reference/
Can you provides HTTP POST and GET examples?
Sure :)
isPool is a flag on the subnet;
~$ curl --silent https://phpipam.example.org/api/terraform/subnets/218/ --header "token: DECAFbad123456789-." -X GET | jq .
{
"code": 200,
"success": true,
"data": {
"id": "218",
"subnet": "198.51.100.0",
"mask": "24",
"sectionId": "19",
"description": "demo",
"linked_subnet": null,
"firewallAddressObject": null,
"vrfId": null,
"masterSubnetId": "0",
"allowRequests": "0",
"vlanId": null,
"showName": "0",
"device": null,
"permissions": "[]",
"pingSubnet": "0",
"discoverSubnet": "0",
"resolveDNS": "0",
"DNSrecursive": "0",
"DNSrecords": "0",
"nameserverId": "0",
"scanAgent": "0",
"customer_id": null,
"isFolder": "0",
"isFull": "0",
"isPool": "1",
"tag": "2",
"threshold": "0",
"location": null,
"editDate": null,
"lastScan": null,
"lastDiscovery": null,
"calculation": {
"Type": "IPv4",
"IP address": "/",
"Network": "198.51.100.0",
"Broadcast": "198.51.100.255",
"Subnet bitmask": "24",
"Subnet netmask": "255.255.255.0",
"Subnet wildcard": "0.0.0.255",
"Min host IP": "198.51.100.1",
"Max host IP": "198.51.100.254",
"Number of hosts": "254",
"Subnet Class": "TEST-NET-2"
}
},
"time": 0.005
}
For some reason, I'm struggling to create an add-subnet example, but this is failing on sections and CIDRs, not on the "isPool" value.
I've added a PR to implement this at the SDK layer.
@pavel-z1
Hi @JonTheNiceGuy I've merged you PR and created the new SDk release https://github.com/pavel-z1/phpipam-sdk-go/releases/tag/v0.1.8 But this will not add automatically ispool feature to the terraform provider You need to connect updated SDK to this project and add logic for creating pool
@lord-kyron is there much that needs to happen to get this new variable/value into the terraform provider?
@JonTheNiceGuy I guess it will take some effort to add this support. WIll you be able to create the pull requests for adding the support here also, as @pavel-z1 suggested?
Yep, I'll take a look. My go knowledge is pretty weak, so I'll have a poke around one evening and see what I can do :)
@JonTheNiceGuy, Did you have some time to take a look at this?
Apologies, my focus at work shifted considerably, so I didn't get time to dedicate to this. Sorry!
Setting a subnet as a "pool" makes the "network" and "broadcast" IPs available to allocation in the address space.
This is used when defining supernets (such as 192.168.0.0/16) or when partitioning subnets into smaller portions (e.g. 192.0.2.64/29 as a DHCP pool or a static IP range).
Version 1.5.2 of the terraform module does not currently provide this.