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

129 lines
3.3 KiB
HCL

variable "enabled" {
description = "Create the learning email VM. Keep false until all OCI inputs are set."
type = bool
default = false
}
variable "region" {
description = "OCI region, normally supplied by TF_VAR_email_region or OCI_REGION."
type = string
default = ""
}
variable "oci_config_profile" {
description = "OCI CLI config profile used by the provider."
type = string
default = "DEFAULT"
}
variable "compartment_id" {
description = "OCI compartment OCID for the VM."
type = string
default = ""
}
variable "availability_domain" {
description = "OCI availability domain name."
type = string
default = ""
}
variable "subnet_id" {
description = "Existing public subnet OCID for the VM VNIC."
type = string
default = ""
}
variable "image_id" {
description = "ARM64 or x86 image OCID compatible with the selected shape."
type = string
default = "ocid1.image.oc1.iad.aaaaaaaarmp53tuhdoepsh4breobvmbdbq7gbmhosdogknb34xidkfi6hxjq"
}
variable "ssh_public_key" {
description = "Public SSH key installed in the VM."
type = string
default = ""
sensitive = true
}
variable "shape" {
description = "OCI shape. VM.Standard.A1.Flex is free-tier eligible when capacity is available."
type = string
default = "VM.Standard.E2.1.Micro"
}
variable "ocpus" {
description = "Number of OCPUs. Keep within the free-tier allowance."
type = number
default = 1
}
variable "memory_in_gbs" {
description = "Memory in GB. Keep within the free-tier allowance."
type = number
default = 1
}
variable "boot_volume_size_in_gbs" {
description = "Boot volume size in GB."
type = number
default = 50
}
variable "display_name" {
type = string
default = "homelab-mail"
}
variable "hostname_label" {
type = string
default = "homelab-mail"
}
variable "assign_public_ip" {
description = "Assign an ephemeral public IP to the VM VNIC. Reserve a static IP before production mail use."
type = bool
default = true
}
variable "nsg_ids" {
description = "Existing OCI Network Security Group OCIDs. Keep mail ingress closed until DNS/PTR are ready."
type = list(string)
default = []
}
variable "domain" {
description = "Future mail domain, recorded in outputs only until explicitly configured."
type = string
default = ""
}
variable "freeform_tags" {
type = map(string)
default = {}
}
locals {
required_inputs = {
compartment_id = var.compartment_id
availability_domain = var.availability_domain
subnet_id = var.subnet_id
image_id = var.image_id
ssh_public_key = var.ssh_public_key
region = var.region
}
}
check "email_vm_inputs" {
assert {
condition = !var.enabled || alltrue([for value in values(local.required_inputs) : trimspace(value) != ""])
error_message = "When email VM creation is enabled, region, compartment_id, availability_domain, subnet_id, image_id, and ssh_public_key are required."
}
assert {
condition = var.ocpus > 0 && var.memory_in_gbs > 0 && var.boot_volume_size_in_gbs >= 50
error_message = "ocpus and memory_in_gbs must be positive and boot_volume_size_in_gbs must be at least 50."
}
}