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

New feature: Resolve DNS names #64

Closed sjurtf closed 1 year ago

sjurtf commented 1 year ago

Under the Scan agent settings in phpipam, there are scans that can be enabled.

Screenshot 2023-04-19 at 13 54 37

This provider supports Host Check and Discover new host with these attributes:

include_in_ping        = true
host_discovery_enabled = true

My feature request would be to support the option of enabling resolving of DNS names.

lord-kyron commented 1 year ago

@pavel-z1 what do you think? Will this be possible to implement?

pavel-z1 commented 1 year ago

Hi @sjurtf I checked phpIPAM documentation https://phpipam.net/#subnets Seems phpIPAM don't have resolveDNS parameter for subnet API controller or this parameter not documented.

If you provide example of phpIPAM API usage which activate resolve DNS names option I guess we could add it.

sjurtf commented 1 year ago

Hi, you are right - it is missing from the documentation. (Edit: I opened a PR with phpipam/phpipam to add it to the docs)

We are running phpipam 1.5.3 and the resolveDNS is present in the API and it is working as expected when I tested it now.

Working notes: When I call /api//subnets/ the response includes a field named resolveDNS set to "1" which matched my expectations and the GUI setting.

I tried to modify it with PATCH, and I was able to confirm that it changed the Resolve DNS names setting in the GUI.

curl --request PATCH \
  --url https://<redacted>/api/<appid>/subnets/<subnetid> \
  --header 'Content-Type: application/json' \
  --header 'token: X' \
  --data '{"resolveDNS": "1"}'
pavel-z1 commented 1 year ago

Hi @sjurtf Feature was added in this PR https://github.com/lord-kyron/terraform-provider-phpipam/pull/65

Added subnet parameter - resolve_dns