opnsense_kea_subnet (Resource)

Configure DHCP subnets for Kea.

Example Usage

// Small example
resource "opnsense_kea_subnet" "lan" {
  subnet = "10.8.0.0/16"
  description = "LAN"
}

// Full resource
resource "opnsense_kea_subnet" "example" {
  subnet = "10.8.0.0/16"

  next_server = "10.8.0.1"

  match_client_id = false

  auto_collect = false

  static_routes = [
    {
      destination_ip = "10.10.10.10"
      router_ip = "10.8.0.1"
    },
    {
      destination_ip = "10.10.10.11"
      router_ip = "10.8.50.1"
    }
  ]

  pools = [
    "10.8.2.1-10.8.2.100",
    "10.8.2.101-10.8.2.200",
    "10.8.3.0/24"
  ]

  routers = [
    "10.8.0.1",
    "10.8.50.2"
  ]

  dns_servers = [
    "10.8.0.160",
    "10.8.0.161"
  ]

  domain_name = "example.com"

  domain_search = [
    "search.example.com",
    "search2.example.com"
  ]

  ntp_servers = [
    "10.10.101.10",
    "10.10.101.11"
  ]

  time_servers = [
    "10.10.101.10",
    "10.10.101.11"
  ]

  tfpt_server = "tfpt.example.com"
  tftp_bootfile = "bootfile.txt"

  description = "EXAMPLE"
}

Schema

Required

  • subnet (String) Subnet to use (e.g. "192.0.2.64/26"), should be large enough to hold the specified pools and reservations.

Optional

  • auto_collect (Boolean) Automatically update option data from the GUI for relevant attributes. When set, values for routers, dns_servers and ntp_servers will be ignored. Defaults to true.
  • description (String) Optional description here for your reference (not parsed).
  • dns_servers (Set of String) DNS servers to offer to the clients. Defaults to [].
  • domain_name (String) Domain name to offer to the client, set to this firewall's domain name when left empty. Defaults to "".
  • domain_search (Set of String) Set of Domain Names to be used by the client to locate not-fully-qualified domain names. Defaults to [].
  • match_client_id (Boolean) By default, KEA uses client-identifiers instead of MAC addresses to locate clients, disabling this option changes back to matching on MAC address which is used by most dhcp implementations. Defaults to true.
  • next_server (String) Next server IP address. Defaults to "".
  • ntp_servers (Set of String) Set of IP addresses indicating NTP (RFC 5905) servers available to the client. Defaults to [].
  • pools (Set of String) Set of pools in range or subnet format (e.g. "192.168.0.100 - 192.168.0.200" , "192.0.2.64/26"). Defaults to [].
  • routers (Set of String) Default gateways to offer to the clients. Defaults to [].
  • static_routes (Attributes Set) Static routes that the client should install in its routing cache. Defaults to []. (see below for nested schema)
  • tfpt_server (String) TFTP server address or fqdn. Defaults to "".
  • tftp_bootfile (String) Boot filename to request. Defaults to "".
  • time_servers (Set of String) Set of RFC 868 time servers available to the client. Defaults to [].

Read-Only

  • id (String) UUID of the subnet.

Nested Schema for static_routes

Required:

  • destination_ip (String) Destination IP address for static route.
  • router_ip (String) Gateway IP for static route.

Import

In Terraform v1.5.0 and later, use an import block to import opnsense_kea_subnet using the id. For example:

import {
  to = opnsense_kea_subnet.example
  id = "<opnsense-resource-id>"
}

Using terraform import, import opnsense_kea_subnet using the id. For example:

% terraform import opnsense_kea_subnet.example <opnsense-resource-id>