be53170557
Stop repeating the site slug inside the YAML: terragrunt passes the dc as site_slug and site.yaml carries only site-wide attributes. Declare device types, roles, platforms, custom fields and the dhcp IPAM role once in config/global via their own unit and state; the per-site unit looks them up by slug or name.
65 lines
1.9 KiB
Terraform
65 lines
1.9 KiB
Terraform
variable "device_types" {
|
|
description = <<-EOT
|
|
Device-type catalogue keyed by NetBox slug. `ports` declares interface
|
|
templates as ranges: each block names `count` ports from `first`, formatted
|
|
with `name_format` (a single %d). NetBox instantiates them on every device
|
|
created from the type. Manufacturers are created from the distinct
|
|
`manufacturer` values.
|
|
EOT
|
|
type = map(object({
|
|
manufacturer = string
|
|
model = string
|
|
u_height = optional(number, 1)
|
|
ports = optional(list(object({
|
|
name_format = string
|
|
type = string
|
|
first = optional(number, 1)
|
|
count = number
|
|
mgmt_only = optional(bool, false)
|
|
})), [])
|
|
}))
|
|
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 "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"
|
|
}
|