opentofu-common/variables.tf
GregoryDosh daf26312d1
All checks were successful
Update Version / Update Version (push) Successful in 9s
feat: consistency sweeping w/ other repos to add release/tag process + license checking
2025-05-13 10:11:01 -05:00

55 lines
1.5 KiB
HCL

# git.auengun.net/homelab/opentofu-common
# Copyright (C) 2024 GregoryDosh
# SPDX-License-Identifier: AGPL-3.0-or-later
# SPDX-FileCopyrightText: 2024 GregoryDosh
variable "hostname" {
type = string
nullable = false
description = "The name of this host without any FQDN suffix. (e.g. servicename)"
validation {
condition = !strcontains(var.hostname, ".")
error_message = "The hostname must not include subdomains or any periods."
}
}
variable "fqdn_apex" {
type = string
default = "auengun.net."
nullable = false
validation {
condition = can(regex("\\.$", var.fqdn_apex))
error_message = "The fqdn_apex must end with a period."
}
}
variable "fqdn_subdomain" {
type = string
default = "virt.auengun.net."
nullable = false
validation {
condition = can(regex("\\.$", var.fqdn_subdomain))
error_message = "The fqdn_subdomain must end with a period."
}
}
variable "internal_ipv4" {
type = string
nullable = false
validation {
# Not going for perfection, just rough structure.
# Param validation & other stuff can get handled by
# the respective modules resopnsible. :-P
condition = can(regex("^(\\d{1,3}).(\\d{1,3}).(\\d{1,3}).(\\d{1,3})$", var.internal_ipv4))
error_message = "The internal_ipv4 should be a valid IPV4 private IP."
}
}
locals {
external_hostname = "${var.hostname}.${substr(var.fqdn_apex, 0, length(var.fqdn_apex) - 1)}"
internal_hostname = "${var.hostname}.${substr(var.fqdn_subdomain, 0, length(var.fqdn_subdomain) - 1)}"
}