my-homelab-configs/bootstrap/oci/variables.tf

205 lines
4.1 KiB
HCL

variable "enabled" {
type = bool
default = false
}
variable "region" {
description = "OCI region."
type = string
default = ""
}
variable "oci_config_profile" {
type = string
default = "DEFAULT"
}
variable "tenancy_id" {
description = "Tenancy OCID; used as the parent for the optional child compartment."
type = string
default = ""
}
variable "create_compartment" {
type = bool
default = true
}
variable "compartment_id" {
description = "Existing compartment OCID when create_compartment is false."
type = string
default = ""
}
variable "compartment_name" {
type = string
default = "homelab-learning"
}
variable "compartment_description" {
type = string
default = "Jeannie-managed OCI learning resources"
}
variable "vcn_display_name" {
type = string
default = "homelab-vcn"
}
variable "vcn_cidr" {
type = string
default = "10.50.0.0/16"
}
variable "public_subnet_cidr" {
type = string
default = "10.50.10.0/24"
}
variable "private_subnet_cidr" {
type = string
default = "10.50.20.0/24"
}
variable "admin_cidr" {
description = "CIDR allowed to SSH to the edge and email VMs. Do not leave this at 0.0.0.0/0."
type = string
default = ""
}
variable "open_mail_ports" {
description = "Open SMTP submission, SMTP, and IMAPS ingress in the email NSG. Keep false until DNS/PTR and hardening are complete."
type = bool
default = false
}
variable "edge_enabled" {
type = bool
default = true
}
variable "email_enabled" {
type = bool
default = true
}
variable "edge_availability_domain" {
type = string
default = ""
}
variable "email_availability_domain" {
type = string
default = ""
}
variable "edge_image_id" {
description = "OCI image OCID compatible with edge_shape."
type = string
default = ""
}
variable "email_image_id" {
description = "OCI image OCID compatible with email_shape."
type = string
default = ""
}
variable "ssh_public_key" {
type = string
sensitive = true
default = ""
}
variable "edge_shape" {
type = string
default = "VM.Standard.A1.Flex"
}
variable "email_shape" {
type = string
default = "VM.Standard.A1.Flex"
}
variable "edge_ocpus" {
type = number
default = 1
}
variable "edge_memory_in_gbs" {
type = number
default = 6
}
variable "email_ocpus" {
type = number
default = 1
}
variable "email_memory_in_gbs" {
type = number
default = 6
}
variable "edge_boot_volume_size_in_gbs" {
type = number
default = 50
}
variable "email_boot_volume_size_in_gbs" {
type = number
default = 50
}
variable "edge_display_name" {
type = string
default = "homelab-edge"
}
variable "email_display_name" {
type = string
default = "homelab-mail"
}
variable "edge_hostname_label" {
type = string
default = "homelab-edge"
}
variable "email_hostname_label" {
type = string
default = "homelab-mail"
}
variable "freeform_tags" {
type = map(string)
default = {}
}
check "foundation_inputs" {
assert {
condition = !var.enabled || (
trimspace(var.region) != "" &&
trimspace(var.tenancy_id) != "" &&
(var.create_compartment || trimspace(var.compartment_id) != "") &&
trimspace(var.admin_cidr) != "" &&
(!var.edge_enabled || (trimspace(var.edge_availability_domain) != "" && trimspace(var.edge_image_id) != "")) &&
(!var.email_enabled || (trimspace(var.email_availability_domain) != "" && trimspace(var.email_image_id) != "")) &&
trimspace(var.ssh_public_key) != ""
)
error_message = "When OCI foundation is enabled, region, tenancy_id, admin_cidr, SSH key, and image/availability-domain inputs for each enabled VM are required."
}
assert {
condition = !var.enabled || alltrue([
var.edge_ocpus > 0,
var.email_ocpus > 0,
var.edge_memory_in_gbs > 0,
var.email_memory_in_gbs > 0,
var.edge_boot_volume_size_in_gbs >= 50,
var.email_boot_volume_size_in_gbs >= 50,
])
error_message = "VM CPU and memory must be positive and boot volumes must be at least 50 GB."
}
}