Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature Request: Please add the "is_pool" field to the phpipam_subnet resource #78

Closed
JonTheNiceGuy opened this issue Jun 9, 2023 · 11 comments
Assignees
Labels
enhancement New feature or request

Comments

@JonTheNiceGuy
Copy link
Contributor

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.

@lord-kyron
Copy link
Owner

@pavel-z1

@pavel-z1
Copy link
Collaborator

pavel-z1 commented Sep 5, 2023

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?

@JonTheNiceGuy
Copy link
Contributor Author

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.

@JonTheNiceGuy
Copy link
Contributor Author

I've added a PR to implement this at the SDK layer.

@pavel-z1 pavel-z1 self-assigned this Sep 6, 2023
@pavel-z1 pavel-z1 added the enhancement New feature or request label Sep 6, 2023
@lord-kyron
Copy link
Owner

@pavel-z1

@pavel-z1
Copy link
Collaborator

pavel-z1 commented Nov 2, 2023

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

@JonTheNiceGuy
Copy link
Contributor Author

@lord-kyron is there much that needs to happen to get this new variable/value into the terraform provider?

@lord-kyron
Copy link
Owner

@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?

@JonTheNiceGuy
Copy link
Contributor Author

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 :)

@lord-kyron
Copy link
Owner

@JonTheNiceGuy, Did you have some time to take a look at this?

@JonTheNiceGuy
Copy link
Contributor Author

Apologies, my focus at work shifted considerably, so I didn't get time to dedicate to this. Sorry!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants