Skip to end of metadata
Go to start of metadata

You are viewing an old version of this content. View the current version.

Compare with Current View Version History

« Previous Version 4 Next »

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

Parameter

Description

Example

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 JSON map.

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

To get information about a CNAME record, you must specify a combination of the record's canonical name and an alias that the record points to.

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

Parameter

Required/Optional

Description

dns_view

Optional

Specifies the DNS view in which the record's zone exists.
If a value is not specified, default will be used as the DNS view name.
If the zone is in a non-default DNS view, then you must specify that view.

canonical

Required

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

alias

Required

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

Example of the CNAME Record Data Source Block

resource "infoblox_cname_record" "foo" {
    dns_view = "default.nondefault_netview"
    canonical = "strange-place.somewhere.in.the.net"
    alias = "foo.test.com"
    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" "foo"{

    dns_view="default.nondefault_netview"
    alias="foo.test.com"
    canonical="main.test.com"

    // 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]

}

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.infoblox_cname_record.foo.comment
}

output "foo_ext_attrs" {
    value = data.infoblox_cname_record.foo.ext_attrs
}



data "infoblox_cname_record" "cname_rec1" {
    dns_view = "default" // optional parameter
    canonical = "canonical.test.net"
    alias = "hq-server.example1.org"
}


  • No labels