Infoblox IPv4 Network Resources
This example demonstrates a configuration file used to create an ipv4 network resource. The configuration will create 3 networks. In order for this configuration to be successfully applied, you will need to have an existing network view or default network view will also work. Copy the below example into a text file and save as ipv4_networks.tf. Replace the server, username, and password values with credentials from your Grid Master. Values used for other arguments such as CIDRs and names can be changed as desired for your environment. Lines that begin with # are comments explaining the resources and are not read when applying the configuration. The terraform and nested required provider block is required for Terraform version 1.8.1 and later.
# Terraform block containing the required providers block to install the Infoblox provider
terraform {
required_providers {
infoblox = {
source = "infobloxopen/infoblox"
version = "2.7.0"
}
}
}
# Provider block for Infoblox credentials
provider "infoblox" {
server = "<1.2.3.4"
username = "admin"
password = "infoblox"
}
# 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"
})
}