Versions Compared

Key

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

Use the data resource for the CNAME object to retrieve the following information for CNAME records:

Parameter

Description

Example

dns_viewThe DNS view in which the record's zone exists.nondefault_dnsview
canonicalThe canonical name of the record in the FQDN format.debug.point.somewhere.in
aliasThe alias name of the record in the FQDN format.foo1.test.com

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

comment

A text describing the record. This is a regular comment.

Temporary A 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\",\"ExpiresExpiry\":\"neverNever\"}

To get retrieve information about a CNAME record, you must specify a combination of the DNS view, canonical name, and an alias that the record points toCNAME 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 CNAME records in the NIOS Grid.

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

ParameterRequired/Optional

Alias*

Description

namealiasSpecifies the alias name of the record in the FQDN format.

view

dns_viewRequired

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

canonical

Requiredcanonical

Specifies the canonical name of the record in the FQDN format.

alias

Required

Specifies the alias name of the record in the FQDN format

zone

zone

Specifies the zone that contains the record.

commentcommentDescribes 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.8665701230204, -37.00791763398113"
}

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

This example defines a data source of type `infoblox_cname_record` and the name "cname_rec", which is configured in a Terraform file. You can reference this resource and retrieve information about it.

resource "infoblox_cname_record" "foo" {
    dns_view = "default.nondefault_netview"
    canonical = "strange-place.somewhere.in.the.net"
    alias = "foo.test.com"
    canonical="main.test.com"

}

output "foo_ttl" {
    value = data.infoblox_cname_record.foo.ttl
}

output "foo_zone" {
    value = data.infoblox_cname_record.foo.zone
}

output "foo_comment" {
    value = data.comment = "we need to keep an eye on this strange host"
    ttl = 0 // disable caching
    ext_attrs = jsonencode({
      Site = "unknown"
      Location = "TBD"
    })

}
data "infoblox_cname_record" "cname_rec"{

    filters = {
      name = "foo.test.com"
      canonical = "strange-place.somewhere.in.the.net"
      view = "default.nondefault_netview"
    }


    // This is just to ensure that the record has been be created
    // using 'infoblox_cname_record' resource block before the data source will be queried.
    depends_on = [infoblox_cname_record.foo.comment]

}

output "foocname_extrec_attrsout" {
    value = data data.infoblox_cname_record.foo.ext_attrs
}cname_rec.results.0.alias //zero represents index of json object from results list
}


// accessing CNAME-Record through EA's
data "infoblox_cname_record" "cname_rec1rec_ea" {

    dns_view   filters = {
      "*Location" = "defaultCali" // required parameter here
    canonical = "canonical.test.net"

    alias = "hq-server.example1.org"  "*Location!" = "Florida"
    }

}
// throws matching CNAME records with EA, if any
output "cname_rec_res" {
    value = data.infoblox_cname_record.cname_rec_ea
}