---
title: "infoblox_ipv4_allocation"
canonical: "https://docs.infoblox.com/space/ipamdriverterraform/53023355/infoblox_ipv4_allocation"
format: markdown
---
> Macro (excerpt)
> 
> > ⚠️ **Note**
> > ⚠️ 
> > ⚠️ The `infoblox_ipv4_allocation` resource is deprecated and is not supported from Infoblox IPAM Plug-In version 2.3.0. Infoblox strongly recommends that you use *[Infoblox_ip_allocation](https://infoblox-docs.atlassian.net/wiki/spaces/ipamdriverterraform/pages/53121460)* resource for allocation of IP addresses. For more information, see *[IP Address Allocation](https://infoblox-docs.atlassian.net/wiki/spaces/ipamdriverterraform/pages/53154100)*.
> 
> <span style="color: #000000">The resource allows allocation of the next available IP address from a specified network block if an IP address is not explicitly specified. The IP address can be allocated by specifying it in the resource definition or can be allocated automatically by defining the CIDR field. The allocated IP address is marked as ‘used’ in the appropriate network block.</span>
> 
> <span style="color: #000000">The allocation is done by creating a Host record in NIOS. The Host record can be created at the DNS server side by using the </span>`enable_dns`<span style="color: #000000"> flag, which is enabled by default. If you disable the flag, the record is not created in the DNS server side, but is visible on the </span>**<span style="color: #000000">IPAM</span>**<span style="color: #000000"> tab in NIOS Grid Manager.</span>
> 
> <span style="color: #000000">When you create the Host record at the DNS server side, specify the host name in the FQDN format. The name must include the zone name and the host name as shown in the following example:</span>  
> `enable_dns=true`  
> `fqdn=hostname1.zone.com`
> 
> <span style="color: #000000">If you disable the </span>`enable_dns`<span style="color: #000000"> flag, specify only the host name as </span>`fqdn`<span style="color: #000000">. For example:</span>  
> `fqdn=hostname1`
> 
> <span style="color: #000000">The following table describes the parameters you can define in the IP address allocation resource blocks:</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 for which an IP address needs to be allocated.</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>`hostname>.<zone>.com`<span style="color: #000000">.</span>  
> <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: <hostname>.</span><br><span style="color: #000000">In a cloud environment, a VM name could be used as a host name.</span> | ` 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 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 when </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` |
> | `cidr` | <span style="color: #000000">Required only for dynamic allocation</span> | <span style="color: #000000">It specifies the network block (in CIDR format) from where to allocate an IP address.</span><br><span style="color: #000000">For static allocation, do not use this field</span> | `10.4.3.128/20` |
> | `ip_addr` | <span style="color: #000000">Required only for static allocation</span> | <span style="color: #000000">It specifies an IP address that should be allocated (marked as ‘Used’ in NIOS Grid Manager).</span><br><span style="color: #000000">For dynamic allocation, do not use this field.</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, then in NIOS, the value is inherited from the parent object of the DNS record for this resource.</span> | `3600` |
> | `comment` | <span style="color: #000000">Optional</span> | <span style="color: #000000">Describes the resource.</span> | `Allocating 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({})` |

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

`resource "infoblox_ipv4_allocation" "alloc1" {`  
`  network_view="edge"`  
`  cidr=172.30.11.0/24 # this is to allocate`  
`                       # an IP address from the given network block`  
`  dns_view="default" # may be commented out`  
`  fqdn="test-vm.edge.example.com"`  
`  enable_dns = "true"`  
`  comment = "Allocating an IPv4 address"`  
`  ext_attrs = jsonencode({ `  
`    "Tenant ID" = "tf-plugin"`  
`    "Cloud API Owned" = "True"`  
`    "CMP Type"= "VMware"`  
`    "Site" = "Nevada"`  
`  })`  
`}`