---
title: "infoblox_ipv4_network Resource"
canonical: "https://docs.infoblox.com/space/ipamdriverterraform/53023320/infoblox_ipv4_network%20Resource"
format: markdown
---
> Macro (excerpt)
> 
> This resource enables you to perform create, update, and delete operations on IP networks. Network resources support the next available network feature when you use the `allocate_prefix_len` parameter listed in the below table.
> 
> The following table describes the parameters you can define in a network resource block:
> 
> | **Parameter** | **Required/**  
> **Optional** | **Description** |
> | --- | --- | --- |
> | `network_view` | Optional | Specifies the network view in which to create the network.  
> If a value is not specified, `default` will be used as the network view name. |
> | `cidr` | Required only if `parent_cidr` is not set | Specifies the network block to use for the network, in CIDR notation.  
> Do not use the IPv4 CIDR for an IPv6 network and IPv6 CIDR for an IPv4 network.  
> <span style="color: #000000">If you configure both </span>`cidr`<span style="color: #000000"> and </span>`parent_cidr`<span style="color: #000000">, the value of </span>`parent_cidr`<span style="color: #000000"> will be ignored.</span> |
> | `parent_cidr` | Required only if `cidr` is not set | Specifies the network container from which the network must be dynamically allocated.  
> The network container must exist in the NIOS database, but not necessarily as a Terraform resource. |
> | `allocate_prefix_len` | Required only if `parent_cidr` or `filter_params `is set | Defines the length of the network part of the address for a network that should be allocated from a network container, which in turn is determined by `parent_cidr` or `filter_params`. |
> | `gateway` | Optional | <span style="color: #000000">Defines the</span> IP address of the gateway within the network block.<br>- <span style="color: #000000">If a value is not set, the first IP address of the allocated network will be assigned.</span>
> - <span style="color: #000000">If the value is set to </span>`none`<span style="color: #000000">, no value will be assigned.</span><br>For more information, see *[Limitations](https://infoblox-docs.atlassian.net/wiki/spaces/ipamdriverterraform/pages/53055610/Overview+of+Infoblox+IPAM+Plug-In+for+Terraform#Limitations)*. |
> | `object` | Optional | Specifies the type of object from which to allocate the network.  
> The values can be `network` or `networkcontainer`. The default value is `networkcontainer`.  
> **Note**:<br>- The `object` parameter is applicable only if `filter_params` is configured.
> - If the `object` parameter is set to `network`, after the creation of the network object, the parent network object will be converted to a network container object. |
> | `filter_params` | Optional | <span style="color: #172B4D">Specifies the extensible attributes of the parent network or network container that must be used as filters to retrieve the next available network for creating the network object.</span> |
> | `comment` | Optional | <span style="color: #000000">Describes the network.</span> |
> | `ext_attrs` | Optional | Specifies the set of NIOS extensible attributes that will be attached to the network. |

Additionally, <span style="color: #000000">define the following parameter for the</span><span style="color: #000000"> </span>`infoblox_ipv4_network`<span style="color: #000000"> resource:</span>

| **<span style="color: #000000">Parameter</span>** | **<span style="color: #000000">Required/</span>**  
**<span style="color: #000000">Optional</span>** | **<span style="color: #000000">Description</span>** |
| --- | --- | --- |
| `reserve_ip` | <span style="color: #000000">Optional</span> | Specifies the number of IPv4 addresses that you want to reserve in the IPv4 network.  
The default value is `0`. |


> ⚠️ **Note**
> ⚠️ 
> ⚠️ - Either `cidr,` the combination of `parent_cidr` and `allocate_prefix_len`, or the combination of `filter_params` and `allocate_prefix_len` is required. The rest of the parameters are optional.
> ⚠️ - Once a network object is created, the `reserve_ip` `gateway`, and `filter_params` parameter values cannot be changed by performing an update operation..
> ⚠️ - IP addresses that are reserved by setting the `reserve_ip` field are used for network maintenance by the cloud providers. Therefore, Infoblox does not recommend using these IP addresses for other purposes.

## Examples of the Network Block

`// statically allocated IPv4 network. Example with minimal set of parameters`  
`resource "infoblox_ipv4_network" "net1" {`  
`    cidr = 10.0.0.0/16`  
`}`

`//full set of parameters for a statically allocated IPv4 network`  
`resource "infoblox_ipv4_network" "net2" {`  
`    cidr = 10.1.0.0/24`  
`    network_view = "nondefault_netview"`  
`    reserve_ip = 5`  
`    gateway = "10.1.0.254"`  
`    comment = "small network for testing"`  
`    ext_attrs = jsonencode({`  
`      "Site" = "Nevada"`  
`    })`  
`}`


`//full set of parameters for a dynamically allocated IPv4 network`  
`resource "infoblox_ipv4_network" "net3" {`  
`    parent_cidr = infoblox_ipv4_network_container.v4net_c1.cidr // reference to the resource from another example`  
`    allocate_prefix_len = 26 # 24 (existing network container) + 2 (new network), prefix`  
`    network_view = "default" # optional parameter`  
`    reserve_ip = 2`  
`    gateway = "none" # no gateway defined for this network`  
`    comment = "even smaller network for testing"`  
`    ext_attrs = jsonencode({`  
`      "Site" = "``Nevada``"`  
`    })`  
`}`


`//full set of parameters for dynamically allocated IPv4 network using next-available network ``based on extensible attributes tag`  
`resource "infoblox_ipv4_network" "ipv4network1" {`  
`  allocate_prefix_len = 28`  
`  network_view = "nondefault_netview"`  
`  comment = "IPV4 NW within a NW container"`  
`  filter_params = jsonencode({`

`    "*Site": "Blr"`  
`  })`  
`  ext_attrs = jsonencode({`  
`    "Site" = "UK"`  
`  })``  `  
`  object = "networkcontainer"`

`  })`  
`}`