Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Use the infoblox_ptr_record data source to retrieve the following information about a PTR record from the corresponding object in NIOS:

Parameter

Description

Example

dns_view

The DNS view which the record's zone belongs to.

test.com

ip_addr

the IPv4 or IPv6 address associated with the PTR-record.

1.3.5.1

record_name

The name of the PTR-record in FQDN format, which can be used instead of an IP address.

1.0.0.10.in-addr.arpa

ptrdname

The fully qualified domain name that the PTR-record points to.

delivery.test.com

zone

The zone in which the record exists.

test.com

ttl

The Time to Live value of the record, in seconds.

1800

comment

A description of the record. This is a regular comment.

Temporary PTR record

ext_attrs

The set of extensible attributes of the record, if any. The content is formatted as a string of JSON map.

{\"Owner\":\"State Library\", \"Expires\": \"never\"}

To get retrieve information about a PTR record, specify a combination of the DNS view, the IPv4 address that the record points to or the record’s name in the FQDN format, and the FQDN that corresponds to the IP addressPTR records that match the specified filters, use the filters argument and specify the parameters mentioned in the below table. These are the searchable parameters of the corresponding object in Infoblox NIOS WAPI. If you do not specify any parameter, the data source retrieves information about all PTR records in the NIOS Grid.

The following table describes the parameters you can define in an infoblox_ptr_record data source block:

Parameter

Required/Optional

Alias*

Description

ptrdname

ptrdname

Specifies the fully qualified domain name the PTR record points to.

name

record_name

Specifies the name of the PTR record, in the FQDN format, that can be used instead of an IP address. Example: 1.0.0.10.in-addr.arpa.

view

dns_view

Optional

Specifies the DNS view in which the

record in a reverse mapping

record’s zone exists.
If a value is not specified,

the name default will be used.

matching objects are retrieved from all DNS views in the NIOS Grid.

ipv4addr

ip_addr

Required only if record_name is not set

Specifies the IPv4

or IPv6

address associated with the PTR record. If both

ip

ipv4_addr and record_name are set,

ip

ipv4_addr will take precedence.

record_name

Required only if

ipv6addr

ip_addr

is not set

Specifies the

name of

IPv6 address associated with the PTR record. If both ipv6_addr and record

, in the FQDN format, that can be used instead of an IP address. Example: 1.0.0.10.in-addr.arpa.

ptrdname

Required

Specifies the fully qualified domain name the PTR record points to

_name are set, ipv6_addr will take precedence.

zone

zone

Specifies the zone that contains the record.

comment

comment

Describes the record.

Extensible Attributes

-

Specifies the extensible attributes specified for the record. You must specify the key/value pair within the filters argument.
Example:
filters = {
"*Site" = "some test site"
}

*Aliases are the parameter names used in the prior releases of Infoblox IPAM Plug-In for Terraform. Do not use the alias names for parameters in the data source blocks. Using them can result in error scenarios.

Example of the PTR Record Data Source Block

The following example of an infoblox_ptr_record data source block defines a data source of type infoblox_ptr_record and name host1, which is configured in a Terraform configuration file. You can reference this resource and retrieve information about it. For example, data.infoblox_ptr_record.host1.comment returns the text in the comment field of the PTR record.

data resource "infoblox_ptr_record" "host1" {
dns_view="default"
ptrdname = "host.example.org"
ip_addr = "2a05:d014:275:cb00:ec0d:12e2:df27:aa60"
comment = "workstation #3"
}output "host1_id" {
value = data.infoblox_ptr_record.host1.id
}
output "host1_ip_addr" {
value = data. ttl = 300 # 5 minutes
ext_attrs = jsonencode({
"Location" = "the main office"
})
}

data "infoblox_ptr_record.host1.ip_addr
}output " "host1_record_name" " {
filters = {
value ptrdname= data.infoblox_ptr_record.host1.record_name
}

output "host1_ttl" {
value = data.infoblox_ptr_record.host1.ttl
}

output "host1_comment" {
value = data."host.example.org"
ipv6addr="2a05:d014:275:cb00:ec0d:12e2:df27:aa60"
}

// This is just to ensure that the record has been be created
// using 'infoblox_ptr_record' resource block before the data source will be queried.
depends_on = [infoblox_ptr_record.host1.comment]
}
output "host1ptr_extrec_attrsres" {
value = data.infoblox_ptr_record.host1.ext_attrs
}

data "infoblox_ptr_record" "host2" {
filters = {
dns_ view="default"
ptrdname="host.example.org"
record_ name="0.6.a.a.7.2.f.d.2.e.2.1.d.0.c.e.0.0.b.c.5.7.2.0.4.1.0.d.5.0.a.2.ip6.arpa"
}
output "host2_id" {
value = data.infoblox_ptr_record.host2.id
}
output "host2ptr_iphost_addrres" {
value = data.infoblox_ptr_record.host2.ip_addr
}
// accessing individual field in results
output "host2ptr_recordrec_name" {
value = data.infoblox_ptr_record.host2.record_name
}
output "host2_ttl" {
value = data..results.0.ptrdname //zero represents index of json object from results list
}

// accessing PTR-Record through EAs
data "infoblox_ptr_record.host2.ttl
}
output " host2_comment " {
value = data.infoblox_ptr_record.host2.comment
}
output "host2_ext_attrsptr_rec_ea" {
value = data.infoblox_ptr_record.host2.ext_attrs
}

// searching by an IP address
data "infoblox_ptr_record" "ptr1" {
ptrdname = "example1.org "
ip_addr = "10.0.0.1"
}

// searching by a record's name
data "infoblox_ptr_record" "ptr2" {
ptrdname = "example1.org "
record_name = "2.0.0.10.in-addr.arpa"
}

// non-default DNS view name
data "infoblox_ptr_record" "ptr3" {
ptrdname = "rec3.example2.org "
dns_view = "nondefault_dnsview1"
ip_addr = "2002:1f93::3" filters = {
"*Owner" = "State Library"
"*Owner!" = "State Block"
}
}
// throws PTR-Records with EA, if any
output "ptr_rec_out" {
value = data.infoblox_ptr_record.ptr_rec_ea
}