infoblox_cname_record Data Source
Use the data resource for the CNAME object to retrieve the following information for CNAME records:
Parameter | Description | Example |
---|---|---|
dns_view | The DNS view in which the record's zone exists. | nondefault_dnsview |
canonical | The canonical name of the record in the FQDN format. | debug.point.somewhere.in |
alias | The alias name of the record in the FQDN format. | foo1.test.com |
| The zone that contains the record in the specified DNS view. | test.com |
| The Time to Live value of the record, in seconds. | 3600 |
| A text describing the record. This is a regular comment. | Temporary A record |
| The set of extensible attributes of the record, if any. The content is formatted as a string of JSON map. | {\"Owner\":\"State Library\",\"Expiry\":\"Never\"} |
To retrieve information about CNAME 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:
Parameter | Alias* | Description |
---|---|---|
name | alias | Specifies the alias name of the record in the FQDN format. |
|
| Specifies the DNS view in which the record's zone exists. |
|
| Specifies the canonical name of the record in the FQDN format. |
| 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.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"
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]}
output "cname_rec_out" {
value = data.infoblox_cname_record.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_rec_ea" { filters = {
"*Location" = "Cali"
"*Location!" = "Florida"
}}
// throws matching CNAME records with EA, if any
output "cname_rec_res" {
value = data.infoblox_cname_record.cname_rec_ea
}