---
title: "infoblox_ipv4_association"
canonical: "https://docs.infoblox.com/space/ipamdriverterraform/53023379/infoblox_ipv4_association"
format: markdown
---
<span style="color: #000000">With the IP address association operation, you can update the Host record created using the </span><span style="color: #000000">*[IP address allocation](https://infoblox-docs.atlassian.net/wiki/spaces/ipamdriverterraform/pages/53154100)*</span><span style="color: #000000"> operation with details of the VM created in the cloud environment. The VM details include MAC address and VM tags as extensible attributes.</span>

> ⚠️ **Note**
> ⚠️ 
> ⚠️ The `Infoblox_ipv4_allocation` resource is deprecated and is not supported from Infoblox IPAM Plug-In version 2.3.0. <span style="color: #000000">Infoblox strongly recommends that you use </span><span style="color: #000000">*[infoblox_ip_association](https://infoblox-docs.atlassian.net/wiki/spaces/ipamdriverterraform/pages/53023339)*</span><span style="color: #000000"> resource for allocation of IP addresses. For more information, see </span><span style="color: #000000">*[IP Address Association](https://infoblox-docs.atlassian.net/wiki/spaces/ipamdriverterraform/pages/53121336)*</span><span style="color: #000000">.</span>

> Macro (excerpt)
> 
> <span style="color: #000000">The resource maps the IP address of a Host record created in NIOS to a VM, by MAC address.</span>
> 
> <span style="color: #000000">The following table describes the parameters you can define in the resource block:</span>
> 
> | <span style="color: #000000">**Parameter**</span> | <span style="color: #000000">**Required/Optional**</span> | <span style="color: #000000">**Description**</span> | <span style="color: #000000">**Example Value**</span> |
> | --- | --- | --- | --- |
> | `fqdn` | <span style="color: #000000">Required</span> | <span style="color: #000000">Specifies the name (in FQDN format) of a host with which an IP address needs to be associated.</span><br><span style="color: #000000">When </span>`enable_dns`<span style="color: #000000"> is set to </span>`true`<span style="color: #000000">, specify the zone name along with the host name in format:</span>  
> <span style="color: #000000"><</span>`hostname>.<zone>.com`  
> <span style="color: #000000">Example: </span>`hostname1.zone.com`<br><span style="color: #000000">When </span>`enable_dns`<span style="color: #000000"> is set to </span>`false`<span style="color: #000000">, specify only the host name:</span>  
> <span style="color: #000000"><hostname></span>  
> <span style="color: #000000">Example: </span>`hostname1` | ` ip-12-34-56-78.us-west-2.compute.internal` |
> | `network_view` | <span style="color: #000000">Optional</span> | <span style="color: #000000">Specifies the network view from which to get the specified network block. If a value is not specified, the default network view is considered.</span> | `networkview_name` |
> | `dns_view` | <span style="color: #000000">Optional</span> | <span style="color: #000000">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.</span><br><span style="color: #000000">This parameter is relevant only if </span>`enable_dns`<span style="color: #000000"> is set to </span>`true`<span style="color: #000000">.</span> | `dns_view_name` |
> | `enable_dns` | <span style="color: #000000">Optional</span> | <span style="color: #000000">A flag that specifies whether DNS records associated with the resource must be created. The default value is </span>`true`<span style="color: #000000">.</span> | `true` |
> | `enable_dhcp` | <span style="color: #000000">Optional</span> | <span style="color: #000000">A flag that specifies whether to enable DHCP-related functionality for this resource. The default value is </span>`false`<span style="color: #000000">.</span> | `false` |
> | `ip_addr` | <span style="color: #000000">Required</span> | <span style="color: #000000">Specifies an IP address that must be associated (marked as ‘Used’ in NIOS Grid Manager).</span> | `10.4.3.138` |
> | `ttl` | <span style="color: #000000">Optional</span> | <span style="color: #000000">Specifies the time to live value for the DNS record. This parameter is relevant only when </span>`enable_dns`<span style="color: #000000"> is to </span>`true`<span style="color: #000000">.</span>  
> <span style="color: #000000">If a value is not specified, the value is same as that of the parent zone of the DNS records for this resource.</span> | `3600` |
> | `comment` | <span style="color: #000000">Optional</span> | <span style="color: #000000">Describes the resource.</span> | `Associating an IPv4 address.` |
> | `ext_attrs` | <span style="color: #000000">Optional</span> | <span style="color: #000000">Set of NIOS extensible attributes that are attached to the resource.</span> | `jsonencode({})` |

Additionally, define the following parameter for `infoblox_ipv4_association`:

| <span style="color: #000000">**Parameter**</span> | <span style="color: #000000">**Required/Optional**</span> | <span style="color: #000000">**Description**</span> | <span style="color: #000000">**Example Value**</span> |
| --- | --- | --- | --- |
| `mac_addr` | <span style="color: #000000">Optional</span> | <span style="color: #000000">It specifies the MAC address to associate the IP address with. The default value is </span>`00:00:00:00:00:00`<span style="color: #000000">.</span> | `02:42:97:87:70:f9` |

## <span style="color: #000000">Example of the Resource Block</span>

<span style="color: #000000">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:</span>

<span style="color: #000000">For an IPv4 address:</span>

`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`  
`}`