Skip to content

hlokensgard/terraform-azure-res-ipam

Repository files navigation

terraform-azure-res-ipam

This Terraform module is designed to deploy IPAM (IP Address Management) pools into an existing Azure Virtual Network Manager. It simplifies the process of managing IP address spaces across multiple virtual networks in Azure.

Requirements

  • Terraform >= 1.0
  • Azure Virtual Network Manager already configured.

Examples

Example input

subscription_id                             = ""
virtual_network_manager_name                = "avnm"
virtual_network_manager_resource_group_name = "avnm"

ipam_pools = {
  name                  = "root"
  display_name          = "root"
  main_address_prefixes = ["10.0.0.0/16", "10.1.0.0/16"]
  child_pools = {
    level21 = {
      name           = "level21"
      display_name     = "level21"
      address_prefixes = ["10.0.1.0/24", "10.0.2.0/24"]
    }
    level22 = {
      name           = "level22"
      display_name     = "level22"
      address_prefixes = ["10.1.1.0/24", "10.1.2.0/24"]
    }
  }
}

ipam_pools_level_3_and_4 = {
  name                  = "level31"
  display_name          = "level31"
  main_address_prefixes = ["10.1.1.0/24"]
  parent_pool_name = "level22"
  child_pools = {
    level41 = {
      name            = "level41"
      display_name     = "level41"
      address_prefixes = ["10.1.1.0/25"]
    }
  }
}

Example on how to create a new virtual network

resource "azurerm_virtual_network" "this" {
  name                = "example-vnet"
  location            = "westeurope"
  resource_group_name = "example-rg"
  ip_address_pool {
    id                     = module.ipam_pools.ipam_child_pools["child1"].id
    number_of_ip_addresses = 256
  }

License

This module is licensed under the MIT License. See LICENSE for details.

Requirements

Name Version
terraform ~>1.0
azurerm ~>4.0
time ~>0.1

Providers

Name Version
azurerm ~>4.0
time ~>0.1

Modules

No modules.

Resources

Name Type
azurerm_network_manager_ipam_pool.child_pools resource
azurerm_network_manager_ipam_pool.parent_pools resource
time_sleep.wait_before_child_pools resource
azurerm_network_manager.this data source

Inputs

Name Description Type Default Required
ipam_pools Configuration for IPAM pools
object({
name = string
display_name = string
main_address_prefixes = list(string)
parent_pool_name = optional(string, null)
# Optional child pools, can be null if not provided
# If provided, it should be a map of objects with display_name and address_prefixes
# If null, no child pools will be created
# If provided, the child pools will be created under the parent pool
# If not provided, only the parent pool will be created
child_pools = optional(map(object({
name = string
display_name = string
address_prefixes = list(string)
})))
})
n/a yes
virtual_network_manager_name Name of the Virtual Network Manager string n/a yes
virtual_network_manager_resource_group_name Name of the resource group for the Virtual Network Manager string n/a yes

Outputs

Name Description
ipam_child_pools The child IPAM pools created in the Virtual Network Manager.
ipam_parent_pools The parent IPAM pool created in the Virtual Network Manager.

About

Module to deploy IPAM for Azure Virtual Network Manager.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages