From c80f71569cedaea6a231c8b930eadc7ba44c9f37 Mon Sep 17 00:00:00 2001 From: pavel-z1 <53462452+pavel-z1@users.noreply.github.com> Date: Wed, 26 Apr 2023 13:05:10 +0300 Subject: [PATCH] Added resolveDNS option --- README.md | 2 ++ go.mod | 2 +- go.sum | 2 ++ plugin/providers/phpipam/subnet_structure.go | 6 ++++++ .../pavel-z1/phpipam-sdk-go/controllers/subnets/subnets.go | 7 +++++-- vendor/modules.txt | 2 +- 6 files changed, 17 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 04cb0262..80b3cf05 100644 --- a/README.md +++ b/README.md @@ -624,6 +624,7 @@ The following attributes are exported: * `allow_ip_requests` - `true` if the subnet allows IP requests in PHPIPAM. * `scan_agent_id` - The ID of the ping scan agent that is used for this subnet. * `include_in_ping` - `true` if this subnet is included in ping probes. + * `resolve_dns` - `true` if enabled resolving of DNS names. * `host_discovery_enabled` - `true` if this subnet is included in new host scans. * `is_folder` - `true` if this subnet is a folder and not an actual subnet. @@ -1174,6 +1175,7 @@ The resource takes the following parameters: probes. * `host_discovery_enabled` (Optional) - `true` if this subnet is included in new host scans. + * `resolve_dns` (Optional) - `true` if enabled resolving of DNS names. * `is_folder` (Optional) - `true` if this subnet is a folder and not an actual subnet. * `is_full` (Optional) - `true` if the subnet has been marked as full. diff --git a/go.mod b/go.mod index c9e5ac7c..9dbac4d3 100644 --- a/go.mod +++ b/go.mod @@ -5,7 +5,7 @@ go 1.20 require ( github.com/hashicorp/terraform-plugin-sdk v1.17.2 github.com/hashicorp/terraform-plugin-sdk/v2 v2.25.0 - github.com/pavel-z1/phpipam-sdk-go v0.1.4 + github.com/pavel-z1/phpipam-sdk-go v0.1.5 ) require ( diff --git a/go.sum b/go.sum index 3bc0a844..6350b344 100644 --- a/go.sum +++ b/go.sum @@ -419,6 +419,8 @@ github.com/pavel-z1/phpipam-sdk-go v0.1.3 h1:wXQEO9MNQOJI9CzfW0kCkUuVIw8KJHR6KoW github.com/pavel-z1/phpipam-sdk-go v0.1.3/go.mod h1:bRGJxGeHzqnA0lEXmXynrKq5pDkIlFCggDL7kq16yTA= github.com/pavel-z1/phpipam-sdk-go v0.1.4 h1:Ys0dRed8k44H2m56U3maAd/DRIHNgySYIHfQRwUygr0= github.com/pavel-z1/phpipam-sdk-go v0.1.4/go.mod h1:eBzldFEIC56hn++VUDx14CfHF4X93cEE5NDSqdk0hjs= +github.com/pavel-z1/phpipam-sdk-go v0.1.5 h1:4h+Ws7vbUJCJu23HHHYe9Puf4UZEhQQkVkZWFtoxJak= +github.com/pavel-z1/phpipam-sdk-go v0.1.5/go.mod h1:eBzldFEIC56hn++VUDx14CfHF4X93cEE5NDSqdk0hjs= github.com/pierrec/lz4 v2.0.5+incompatible/go.mod h1:pdkljMzZIN41W+lC3N2tnIh5sFi+IEE17M5jbnwPHcY= github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= diff --git a/plugin/providers/phpipam/subnet_structure.go b/plugin/providers/phpipam/subnet_structure.go index 532c02e5..013cc513 100644 --- a/plugin/providers/phpipam/subnet_structure.go +++ b/plugin/providers/phpipam/subnet_structure.go @@ -32,6 +32,7 @@ var resourceSubnetOptionalFields = linearSearchSlice{ "is_full", "utilization_threshold", "location_id", + "resolve_dns", } // bareSubnetSchema returns a map[string]*schema.Schema with the schema used @@ -100,6 +101,9 @@ func bareSubnetSchema() map[string]*schema.Schema { "host_discovery_enabled": &schema.Schema{ Type: schema.TypeBool, }, + "resolve_dns": &schema.Schema{ + Type: schema.TypeBool, + }, "is_folder": &schema.Schema{ Type: schema.TypeBool, }, @@ -251,6 +255,7 @@ func expandSubnet(d *schema.ResourceData) subnets.Subnet { Permissions: d.Get("permissions").(string), DNSRecursive: phpipam.BoolIntString(d.Get("create_ptr_records").(bool)), DNSRecords: phpipam.BoolIntString(d.Get("display_hostnames").(bool)), + ResolveDNS: phpipam.BoolIntString(d.Get("resolve_dns").(bool)), AllowRequests: phpipam.BoolIntString(d.Get("allow_ip_requests").(bool)), ScanAgent: d.Get("scan_agent_id").(int), PingSubnet: phpipam.BoolIntString(d.Get("include_in_ping").(bool)), @@ -286,6 +291,7 @@ func flattenSubnet(s subnets.Subnet, d *schema.ResourceData) { d.Set("permissions", s.Permissions) d.Set("create_ptr_records", s.DNSRecursive) d.Set("display_hostnames", s.DNSRecords) + d.Set("resolve_dns", s.ResolveDNS) d.Set("allow_ip_requests", s.AllowRequests) d.Set("scan_agent_id", s.ScanAgent) d.Set("include_in_ping", s.PingSubnet) diff --git a/vendor/github.com/pavel-z1/phpipam-sdk-go/controllers/subnets/subnets.go b/vendor/github.com/pavel-z1/phpipam-sdk-go/controllers/subnets/subnets.go index 5ae2cae5..62893ec0 100644 --- a/vendor/github.com/pavel-z1/phpipam-sdk-go/controllers/subnets/subnets.go +++ b/vendor/github.com/pavel-z1/phpipam-sdk-go/controllers/subnets/subnets.go @@ -88,10 +88,10 @@ type Subnet struct { EditDate string `json:"editDate,omitempty"` // Gateway IP and ID of Gateway IP - Gateway map[string]interface{} `json:"gateway,omitempty"` + Gateway map[string]interface{} `json:"gateway,omitempty"` // Gateway IP ID - GatewayID string `json:"gatewayId,omitempty"` + GatewayID string `json:"gatewayId,omitempty"` // A map[string]interface{} of custom fields to set on the resource. Note // that this functionality requires PHPIPAM 1.3 or higher with the "Nest @@ -99,6 +99,9 @@ type Subnet struct { // enabled, this map will be nil on GETs and POSTs and PATCHes with this // field set will fail. Use the explicit custom field functions instead. CustomFields map[string]interface{} `json:"custom_fields,omitempty"` + + // Controls enabling resolve DNS function. + ResolveDNS phpipam.BoolIntString `json:"resolveDNS,omitempty"` } // Controller is the base client for the Subnets controller. diff --git a/vendor/modules.txt b/vendor/modules.txt index 5afa00b4..d3b9650f 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -358,7 +358,7 @@ github.com/mitchellh/reflectwalk # github.com/oklog/run v1.1.0 ## explicit; go 1.13 github.com/oklog/run -# github.com/pavel-z1/phpipam-sdk-go v0.1.4 +# github.com/pavel-z1/phpipam-sdk-go v0.1.5 ## explicit; go 1.13 github.com/pavel-z1/phpipam-sdk-go/controllers/addresses github.com/pavel-z1/phpipam-sdk-go/controllers/sections