Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

The infoblox_ip_allocation resource allows allocation of a new IP address from a network that already exists as a NIOS object. The IP address can be allocated statically by specifying an address or dynamically as the next available IP address from the specified IPv4 and/or IPv6 network blocks.

The allocation is done by creating a Host host record in NIOS with an IPv4 address, an IPv6 address, or both assigned to the record. The allocated IP address is marked as ‘used’ in the appropriate network block.

Note

Note

As a prerequisite for creation of Host host records using the infoblox_ip_allocation and infoblox_ip_association resources, you must create the extensible attribute Terraform Internal ID of string type in Infoblox NIOS Grid Manager. For steps, refer to the Infoblox NIOS Documentation.

...

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 allocated.
In a cloud environment, a VM name could be used as a host name.
If you disable the flag for a host record with its name in the FQDN format and the enable_dns flag enabled, you must remove the zone part from the record name and keep only the host name. For example, you must change hostname1.zone.com to 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 name default is set as the network view configured in NIOS is used.

dmz_netview

dns_view

Optional

Specifies the DNS view in which to create the DNS resource records that are associated with the IP address.


This parameter is relevant only if
  • If

a value is not specified, the default DNS view configured in NIOS is used.
  • enable_dns is set to true, you must configure this parameter.

  • If enable_dns is set to

true
  • false, you must remove this parameter from the resource block.

For more information, see the description of the enable_dns parameter.

dmz_dnsview

enable_dns

Optional

A flag that specifies whether DNS records associated with the resource must be created.
The default value is true.

When you update the enable_dns parameter, consider the following points:

  • If you set the parameter to false when creating a resource, you must not specify the dns_view parameter.

  • If you set the parameter to false when updating a resource, you must:

    • Remove the dns_view parameter. Not removing it can result in unexpected errors.

    • Remove the zone part in the FQDN, and keep only the host record’s name.
      For example, an FQDN with host1 as the record name and example.org as the zone must be changed from host1.example.org to host1.

  • If you set the parameter from false to true, you must:

    • Specify the dns_view parameter. If you do not, the name default will not be configured.

    • Change the fqdn value to FQDN without a leading dot. That is, to the name of the host record, add a zone that exists in the specified DNS view.
      For example, if the fqdn value is host1 and the zone selected from the specified DNS view is example.com, then the fqdn must be changed to host1.example.com.

true

ipv4_cidr

Required only for dynamic allocation

Specifies the IPv4 network block (in CIDR format) from where to allocate an IP address.
Use this parameter only when ipv4_addr is not specified.

10.0.0.0/24

ipv6_cidr

Required only for dynamic allocation

Specifies the IPv6 network block (in CIDR format) from where to allocate an IP address.
Use this parameter only when ipv6_addr is not specified.

2000:1148::/32

ipv4_addr

Required only for static allocation

Specifies an IPv4 address to allocate.
Use this parameter only when ipv4_cidr is not specified.
The allocated IP address will be marked as ‘Used’ in NIOS Grid Manager.
The default value is an empty string. If you specify both ipv4_addr and ipv4_cidr, then ipv4_addr takes precedence.

10.0.0.10

ipv6_addr

Required only for static allocation

Specifies an IPv6 address to allocate.
Use this parameter only when ipv6_cidr is not specified.
The allocated IP address will be marked as ‘Used’ in NIOS Grid Manager.
The default value is an empty string. If you specify both ipv6_addr and ipv6_cidr, then ipv6_addr takes precedence.

2000:1148::10

ttl

Optional

Specifies the time to live value for the DNS record.
This parameter is relevant only when enable_dns is set to true.
If a value is not specified, then in NIOS, the value is inherited from the parent zone object of the DNS records record for this resource.

3600

comment

Optional

Human Specifies the human readable description of the resource.

Front-end cloud node.

ext_attrs

Optional

Specifies the set of NIOS extensible attributes that are attached to the NIOS resource.

An extensible attribute must be a JSON map translated into a string value.

ext_attrs = jsonencode({ "Tenant ID" = "tf-plugin"
 "Location" = "Test loc."
 "Site" = "Test site"
})

...

For a Host record with its name in FQDN format and the enable_dns flag enabled, if you disable the flag, you must remove the zone part from the record name and only keep the host name.
For example: hostname1.zone.com must be changed to hostname1

When you use the infoblox_ip_allocation resource block to allocate or deallocate a static IP address from a Host host record, you must configure appropriate dependencies so that workflows run in the correct order. In the following example, dependencies have been configured for network view and the extensible attribute, Network Name:

...

When you perform a create or an update operation using this allocation resource, the following read-only parameters are computed:

Parameter

Description

internal_id

An ID generated by Terraform for the created resource.
This ID is referenced by the infoblox_ip_association resource to identify the NIOS object created by the allocation resource.

Note: As this is a read-only field, you must not configure it as part of a resource block in a .tf file, or edit its value in the Terraform .state file.

allocated_ipv4_addr

If you allocated a dynamic IP address, this value is the IP address allocated from the specified IPv4 CIDR.
If you allocated a static IP address, this value is the IP address that you specified in the ipv4_addr field.
You can reference this field for the IP address when using other resources.
Example:

resource "infoblox_ip_aloocation" "allocation1" {
  ipv4_cidr = infoblox_ipv4_network.cidr
  fqdn = local.vm_name
}

You can add a reference for the IP address as follows:

infoblox_ip_allocation.allocation1.allocated_ipv4_addr

allocated_ipv6_addr

If you allocated a dynamic IP address, this value is the IP address allocated from the specified IPv6 CIDR.
If you allocated a static IP address, this value is the IP address that you specified ipv6_addr field.

You can reference this field for the IP address when using other resources. See the previous description for an example.

...

You can use static and dynamic allocation methods independently to assign IPv4 and IPv6 addresses within the same resource:.

// minimal set of parameters for IP address allocation
resource "infoblox_ip_allocation" "ipv4v6allocation1" {
  ipv4_cidr = infoblox_ipv4_network.cidr
  dns_view = "default" // this time the parameter is not optional, because...
# enable_dns = true // ... this is 'true', by default
fqdn = "example1.org " // this resource type is implemented as a host record at the NIOS side
ipv4_addr = "1.2.3.4"
}

// Wide set of parameters
resource "infoblox_ip_allocation" "allocation2" {
dns_view = "nondefault_dnsview1"
fqdn = "example2.org "
ipv6_addr = "20012002:18901f93:1959:2710::32"

  #Create Host Record with DNS flags
  fqdn="testipv4v6"
  enable_dns = "false"

  }

1234"
ttl = 120
comment = "another host record, statically allocated"
ext_attrs = jsonencode({
"Tenant ID" = "tenant_3261798"
})
}

// allocation of IPv4 and IPv6 address simultaneously
resource "infoblox_ip_allocation" " "ip_allocation" {
  ipv4_addr = "20.0.0.10"
  allocation3" {
dns_view = "nondefault_dnsview2"
network_view = "nondefault_netview" // you must specify the network view
// which the DNS view belongs to
fqdn = "host3.example4.org"
ipv6_addr = "20002002:1f93::12:1040"    
  fqdn ipv4_addr = "testipNew1.2.example3.com40"
  enable_dns = "true"    ttl = 0
comment = "tf still statically allocated, but IPv4 and ipv6 allocationIPv6 together"
  ext_attrs = jsonencode({
      "Tenant ID" = "tf-plugin"
      "Network Name" = "tf-network"
      "VM Name" =  "tf-ec2-instance"
      "Location" = "Test loc2."
      "Site" = "Test site"
  })tenant_3261798"
})
}

resource "infoblox_ip_allocation" "allocation4" {
enable_dns = false
# dns_view = "nondefault_dnsview2" // remove or comment out dns_view
// when enable_dns = false
network_view = "nondefault_netview" // you must mention the network view which the
//DNS view belongs to
fqdn = "host4" // just one name component because there is no host-to-DNS-zone assignment

// either of the IP addresses must belong to an existing network
// (not a network container) in the specified network view
// because of enable_dns = false
ipv6_addr = "2002:1f93::12:40"
ipv4_addr = "10.1.0.60"

// ensure that the appropriate network exists before creating this resource
depends_on = [infoblox_ipv4_network.net1]
}

// dynamic allocation
resource "infoblox_ip_allocation" "allocation5" {
dns_view = "nondefault_dnsview2"
network_view = "nondefault_netview"
fqdn = "host5.example4.org"
ipv6_cidr = infoblox_ipv6_network.net2.cidr
ipv4_cidr = infoblox_ipv4_network.net2.cidr
}