d7c05b00ac
Carried over from terraform-infra, scoped to NetBox: Kea is managed by the kea-operator CRs. Devices carried no platform and NetBox had no custom fields, so bootapi could only ever render its default template. - prefixes, DHCP-pool ip_ranges, gateways, networks, devices and the PuppetDB backfill script, minus every Kea resource, provider and token - netbox_custom_field definitions from config/<region>/<dc>/custom-fields.yaml - netbox_platform per declared platform, set as the device platform_id - model_hint written to the device provision_template custom field - state key infra/terraform/netbox, NetBox token from netbox/creds/terraform-netbox pxe_enabled's value is deliberately unmanaged: it is runtime state that bootapi's provisioned callback clears.
96 lines
2.9 KiB
Terraform
96 lines
2.9 KiB
Terraform
variable "subnets" {
|
|
description = <<-EOT
|
|
Map of subnets keyed by name (config file basename). `dhcp` records the pool
|
|
as a NetBox ip_range only; the DHCP server itself is the kea-operator's
|
|
KeaSubnet CRs in argocd-apps, so pool/router/DNS/next-server for the server
|
|
are declared there, not here.
|
|
EOT
|
|
type = map(object({
|
|
prefix = string
|
|
description = optional(string, "")
|
|
site = optional(string)
|
|
router = optional(number)
|
|
dhcp = optional(object({
|
|
enabled = optional(bool, true)
|
|
start = number
|
|
stop = number
|
|
}))
|
|
}))
|
|
default = {}
|
|
}
|
|
|
|
variable "networks" {
|
|
description = <<-EOT
|
|
Named logical networks devices join, keyed by network name. `subnet` binds the
|
|
network to a subnet (its prefix is tagged net:<name> and used for device IP
|
|
allocation). gateway/dns/search are per-network provisioning constants (carried
|
|
for downstream consumers; not per-device).
|
|
EOT
|
|
type = map(object({
|
|
subnet = string
|
|
gateway = optional(string)
|
|
dns = optional(list(string), [])
|
|
search = optional(string)
|
|
}))
|
|
default = {}
|
|
}
|
|
|
|
variable "devices" {
|
|
description = <<-EOT
|
|
Intent-only device declarations keyed by device name. Reality (serial, real
|
|
interface names, MACs) is owned by discovery/PuppetDB, not this file.
|
|
`networks` maps a network name to a requested IP in CIDR form, or "" to
|
|
allocate the next-available from the network's prefix. `bootstrap_mac` is
|
|
transitional: it seeds a placeholder interface so bootapi can key the PXE boot
|
|
on MAC until the discovery image exists.
|
|
EOT
|
|
type = map(object({
|
|
site = string
|
|
role = string
|
|
model_hint = optional(string)
|
|
provision = optional(object({
|
|
platform = optional(string)
|
|
}))
|
|
networks = optional(map(string), {})
|
|
pxe = optional(bool, false)
|
|
bootstrap_mac = optional(string)
|
|
}))
|
|
default = {}
|
|
}
|
|
|
|
variable "managed_ips" {
|
|
description = "Manually managed extra IP addresses (full CIDR form, e.g. 198.18.15.5/24)."
|
|
type = list(object({
|
|
ip = string
|
|
description = optional(string, "")
|
|
}))
|
|
default = []
|
|
}
|
|
|
|
variable "vault_address" {
|
|
description = "Vault server address for the token data source."
|
|
type = string
|
|
default = "https://vault.service.consul:8200"
|
|
}
|
|
|
|
variable "netbox_server_url" {
|
|
description = "NetBox server base URL."
|
|
type = string
|
|
default = "https://netbox.k8s.syd1.au.unkin.net"
|
|
}
|
|
|
|
variable "custom_fields" {
|
|
description = <<-EOT
|
|
NetBox custom-field definitions keyed by field name. These are the field
|
|
DEFINITIONS only; values are set per device (or left to the owning service).
|
|
`content_types` are NetBox "app_label.model" strings, e.g. "dcim.device".
|
|
EOT
|
|
type = map(object({
|
|
type = optional(string, "text")
|
|
content_types = list(string)
|
|
label = optional(string)
|
|
description = optional(string)
|
|
}))
|
|
default = {}
|
|
}
|