cead6ab2a0
Switches are created by hand in the NetBox UI, so the model and its port templates have no consumer.
142 lines
4.0 KiB
Terraform
142 lines
4.0 KiB
Terraform
variable "sites" {
|
|
description = "NetBox sites keyed by slug."
|
|
type = map(object({
|
|
name = string
|
|
description = optional(string, "")
|
|
}))
|
|
default = {}
|
|
}
|
|
|
|
variable "subnets" {
|
|
description = <<-EOT
|
|
Map of subnets keyed by name (config file basename,
|
|
net-<a>-<b>-<c>-<d>-<len>). `dhcp` records the pool as a NetBox ip_range
|
|
only; the DHCP server itself is the kea-operator's KeaSubnet CRs in
|
|
argocd-apps. `dns`, `domain` and `next_server` are not read by any resource
|
|
here -- they are retained so a later change can drive Kea from this repo
|
|
without re-deriving them.
|
|
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
|
|
}))
|
|
dns = optional(list(string), [])
|
|
domain = optional(string)
|
|
next_server = optional(string)
|
|
}))
|
|
default = {}
|
|
}
|
|
|
|
variable "device_types" {
|
|
description = <<-EOT
|
|
Device-type catalogue keyed by NetBox slug. Manufacturers are created from
|
|
the distinct `manufacturer` values.
|
|
EOT
|
|
type = map(object({
|
|
manufacturer = string
|
|
model = string
|
|
u_height = optional(number, 1)
|
|
}))
|
|
default = {}
|
|
}
|
|
|
|
variable "device_roles" {
|
|
description = "NetBox device roles keyed by role name; the slug is derived from the name."
|
|
type = map(object({
|
|
description = optional(string, "")
|
|
color_hex = optional(string, "9e9e9e")
|
|
}))
|
|
default = {}
|
|
}
|
|
|
|
variable "platforms" {
|
|
description = "NetBox platforms, slug -> display name. A device's platform slug is bootapi's distro-catalog selector."
|
|
type = map(string)
|
|
default = {}
|
|
}
|
|
|
|
variable "vlans" {
|
|
description = <<-EOT
|
|
VLANs keyed by site slug. Each site gets one NetBox VLAN group scoped to the
|
|
site, so the same VID may exist in more than one site.
|
|
EOT
|
|
type = map(object({
|
|
vid_ranges = optional(list(list(number)), [[1, 4094]])
|
|
vlans = list(object({
|
|
vid = number
|
|
name = string
|
|
description = optional(string, "")
|
|
}))
|
|
}))
|
|
default = {}
|
|
}
|
|
|
|
variable "network_profiles" {
|
|
description = <<-EOT
|
|
Network profiles keyed by profile name. A profile describes the interfaces a
|
|
logical host should have: one entry per interface, each bound to a VLAN VID
|
|
and a subnet key, optionally with subinterfaces. Published as a NetBox
|
|
config context scoped to `sites` (and `roles`, if given) so the UI reads
|
|
profiles from the NetBox API.
|
|
EOT
|
|
type = map(object({
|
|
description = optional(string, "")
|
|
sites = list(string)
|
|
roles = optional(list(string), [])
|
|
weight = optional(number, 1000)
|
|
interfaces = list(object({
|
|
name = string
|
|
vlan = number
|
|
subnet = string
|
|
subinterfaces = optional(list(object({
|
|
name = string
|
|
vlan = number
|
|
subnet = 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 "custom_fields" {
|
|
description = <<-EOT
|
|
NetBox custom-field definitions keyed by field name. These are the field
|
|
DEFINITIONS only; values are set per device by 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 = {}
|
|
}
|
|
|
|
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"
|
|
}
|