/
Create DNS A Record
Create DNS A Record
This example demonstrates a configuration file used to create DNS records for a DNS server. The configuration will create an A record. In order for this configuration to be successfully applied, you will need to have an existing authoritative DNS zone. Copy the below example into a text file and save as dns_records.tf. Replace the server, username, and password values with credentials from your Grid Master. Values used for other arguments such as CIDRs and names can be changed as desired for your environment. Lines that begin with # are comments explaining the resources and are not read when applying the configuration. The terraform and nested required provider block is required for Terraform version 0.13 and later.
# Terraform block containing the required providers block to install the Infoblox provider
terraform {
required_providers {
infoblox = {
source = "infobloxopen/infoblox"
version = "2.6.0"
}
}
}
# Provider block for Infoblox credentials
provider "infoblox" {
server = "1.2.3.4"
username = "admin"
password = "infoblox"
}
resource "infoblox_a_record" "a_rec1" {
# the zone 'example1.org' must exist in the DNS view ('default')
fqdn = "static1.example.org"
ip_addr = "1.3.5.4" # not necessarily from a network existing in NIOS DB
}
#full set of parameters required to statically create an A record
resource "infoblox_a_record" "a_rec2" {
fqdn = "static2.example.org"
ip_addr = "1.3.5.1"
comment = "example static A-record a_rec2"
dns_view = "nondefault_dnsview2"
ttl = 120 # 120s
ext_attrs = jsonencode({
"Location" = "65.8665701230204, -37.00791763398113"
})
}
#full set of parameters required to dynamically create an A record
resource "infoblox_a_record" "a_rec3" {
fqdn = "dynamic1.example.org"
cidr = 10.1.0.0/24 # the network must exist, you may use
# the example for infoblox_ipv4_network resource.
network_view = "nondefault_netview" # not necessarily in
# the same network view as the DNS view resides in.
comment = "example dynamic A-record a_rec3"
dns_view = "nondefault_dnsview1"
ttl = 0 # 0 = disable caching
ext_attrs = jsonencode({})
}
Related content
Infoblox Grid Configuration
Infoblox Grid Configuration
More like this
Infoblox IPv4 Network Resources
Infoblox IPv4 Network Resources
More like this
Overview of Infoblox IPAM Plug-In for Terraform
Overview of Infoblox IPAM Plug-In for Terraform
More like this
Configuring Infoblox IPAM Plug-In for Terraform
Configuring Infoblox IPAM Plug-In for Terraform
More like this