/
infoblox_host_record Data Source

infoblox_host_record Data Source

Use the data source to retrieve the following information for a host record, which is managed by a NIOS server:

Parameter

Description

Example

Parameter

Description

Example

dns_view

The DNS view in which the record's zone exists.

default

fqdn

The fully qualified domain name of the host record to which the IP address is assigned.

blues.test.com

ipv4_addr

The IPv4 address allocated to the host record.

10.0.0.32

ipv6_addr

The IPv6 address allocated to the host record.

2001:1890:1959:2710::32

mac_addr

The MAC address assigned to the IPv4 address of the host record created using the infoblox_ip_association resource block.

aa:bb:cc:dd:ee:11

zone

The zone that contains the record in the specified DNS view.

test.com

ttl

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

3600

duid

The DHCPv6 Unique Identifier (DUID) of the IPv6 address object.

34:df:37:1a:d9:7f

enable_dhcp

Specifies whether the host record was created in the DHCP server side.

true

enable_dns

Specifies whether DNS records associated with the resource was created.

true

disable

Displays whether the record is enabled or disabled.

false

aliases

The list of aliases configured for the host record.

["aws880.test.com"]

comment

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

Temporary host record

ext_attrs

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

{\"TestEA\":56,\"TestEA1\":\"kickoff\"}

To retrieve information about host 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 host records in the NIOS Grid.

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

Parameter

Alias*

Description

Parameter

Alias*

Description

name

fqdn

Specifies the fully qualified domain name to which the IP address is assigned.

network_view

-

Specifies the network view in which the record's zone exists.
If a value is not specified, matching records are retrieved from all views in the NIOS Grid.

view

dns_view

Specifies the DNS view in which the record's zone exists.
If a value is not specified, matching records are retrieved from all views in the NIOS Grid.

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"
"*Location" = "65.86878604, -37.0079113"
}

*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 Host Record Data Source Block

resource "infoblox_zone_auth" "zone1" {
fqdn = "example.org "
view = "default"
}

resource "infoblox_ip_allocation" "allocation1" {
dns_view = "default"
enable_dns = true
fqdn = "host1.example.org"
ipv4_addr = "10.10.0.7"
ipv6_addr = "1::1"
ext_attrs = jsonencode({"Location" = "USA"})
depends_on = [infoblox_zone_auth.zone1]
}

resource "infoblox_ip_association" "association1" {
internal_id = infoblox_ip_allocation.allocation1.id
mac_addr = "12:00:43:fe:9a:8c"
duid = "12:00:43:fe:9a:81"
enable_dhcp = false
depends_on = [infoblox_ip_allocation.allocation1]
}

data "infoblox_host_record" "host_rec_temp" {
filters = {
name = "host1.example.org"
}
}

output "host_rec_res" {
value = data.infoblox_host_record.host_rec_temp
}

 

// fetching Host-Records through extensible attributes tag
data "infoblox_host_record" "host_rec_ea" {
filters = {
"*Location" = "USA"
}
}

output "host_ea_out" {
value = data.infoblox_host_record.host_rec_ea
}

 

//fetching host records with aliases
resource "infoblox_zone_auth" "zone1" {
  fqdn = "http://example.org "
  view = "default"
} 

resource "infoblox_ip_allocation" "allocation1" {
  dns_view = "default"
  fqdn = "host1.example.org"
  ipv4_addr = "10.10.0.7"
  ipv6_addr = "1::1"
  ext_attrs = jsonencode({"Location" = "USA"})
  aliases = ["alias1.test.com","alias"]
  depends_on = [infoblox_zone_auth.zone1]
}

data "infoblox_host_record" "host_rec_temp" {
  filters = {
     name = "host1.example.org"
  }
}

Related content