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 |
---|
title | NoteInfoblox strongly recommends that you use Infoblox_ip_association resource for allocation of IP addresses. The Infoblox_ipv4_allocation resource will be deprecated in an upcoming release. For more information, see see IP Address Association. If you are not using other Terraform providers with the Infoblox provider to deploy virtual machines and allocate IP addresses from NIOS, then ignore the infoblox_ipv4_association resource block, which is used for updating the properties of virtual machines.
|
---|
Excerpt |
---|
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: Parameter | Required/Optional | Description | Example Value |
---|
fqdn
| Required | Specifies the name (in FQDN format) of a host with which an IP address needs to be associated. When enable_dns is set to true , specify the zone name along with the host name in format: <hostname>.<zone>.com Example: hostname1.zone.com When enable_dns is set to false , specify only the host name: <hostname> Example: hostname1 | ip-12-34-56-78.us-west-2.compute.internal
| network_view
| Optional | Specifies the network view from which to get the specified network block. If a value is not specified, the default network view is considered. | networkview_name
| dns_view
| Optional | Specifies the DNS view in which to create the DNS resource records that are associated with the IP address. If a value is not specified, the default DNS view is considered. This parameter is relevant only if enable_dns is set to true . | dns_view_name
| enable_dns
| Optional | A flag that specifies whether DNS records associated with the resource must be created. The default value is true . | true
| enable_dhcp
| Optional | A flag that specifies whether to enable DHCP-related functionality for this resource. The default value is false . | false
| ip_addr
| Required | Specifies an IP address that must be associated (marked as ‘Used’ in NIOS Grid Manager). | 10.4.3.138
| ttl
| Optional | Specifies the time to live value for the DNS record. This parameter is relevant only when enable_dns is to true . If a value is not specified, the value is same as that of the parent zone of the DNS records for this resource. | 3600
| comment
| Optional | Describes the resource. | Associating an IPv4 address.
| ext_attrs
| Optional | Set of NIOS extensible attributes that are attached to the resource. | jsonencode({})
|
|
Additionally, define the following parameter for for infoblox_ipv4_association
:
Parameter | Required/Optional | Description | Example Value |
---|
mac_addr
| Optional | It specifies the MAC address to associate the IP address with. The default value |
is is 00:00:00:00:00:00 . | 02:42:97:87:70:f9
|
Example Example of the Resource Block
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
}