With the IP address association operation, you can update the Host record created using the IP address allocation operation with details of the VM created in the cloud environment. The VM details include MAC address and VM tags as extensible attributes.
Note The |
The resource maps the IP address of a Host record created in NIOS to a VM, by MAC address. The following table describes the parameters you can define in the resource block:
|
Additionally, define the following parameter for infoblox_ipv4_association
:
Parameter | Required/Optional | Description | Example Value |
---|---|---|---|
| Optional | It specifies the MAC address to associate the IP address with. The default value is |
|
As the IP address association operation is dependent on the allocation operation, the following examples for IPv4 demonstrate how to define the resource blocks in the Terraform configuration file:
For an IPv4 address:
resource "infoblox_ipv4_allocation" "ipv4_allocation"{
network_view= "default"
cidr = infoblox_ipv4_network.ipv4_network.cidr
#Create Host Record with DNS and DHCP flags
dns_view="default"
fqdn="testipv4.aws.com"
enable_dns = "true"
# The VM network interface’s MAC address is used.
comment = "Allocating an IP address"
ext_attrs = jsonencode({
"Tenant ID" = "tf-plugin"
"Cloud API Owned" = "True"
"CMP Type"= "AWS"
"Site" = "Nevada"
})
}
resource "infoblox_ipv4_association" "ipv4_associate"{
network_view = infoblox_ipv4_network.ipv4_network.network_view
dns_view=infoblox_ipv4_allocation.ipv4_allocation.dns_view
ip_addr = infoblox_ipv4_allocation.ipv4_allocation.ip_addr
fqdn=infoblox_ipv4_allocation.ipv4_allocation.fqdn
enable_dns = infoblox_ipv4_allocation.ipv4_allocation.enable_dns
enable_dhcp = infoblox_ipv4_allocation.ipv4_allocation.enable_dhcp
mac_addr = aws_network_interface.ni.mac_address
comment = "Associating of an IPv4 address"
ext_attrs = infoblox_ipv4_allocation.ipv4_allocation.ext_attrs
}