From 80ce6dd9a23ff12c81f407e43d760e6268834888 Mon Sep 17 00:00:00 2001 From: "juvenal.diaz" Date: Fri, 23 Oct 2026 18:27:15 -0600 Subject: [PATCH] fix: constrain OCI foundation to free tier micro VMs --- bootstrap/email/README.md | 5 ++--- bootstrap/email/variables.tf | 6 +++--- bootstrap/oci/README.md | 2 ++ bootstrap/oci/variables.tf | 23 +++++++++++++++++------ 4 files changed, 24 insertions(+), 12 deletions(-) diff --git a/bootstrap/email/README.md b/bootstrap/email/README.md index abb786c..00c61fd 100644 --- a/bootstrap/email/README.md +++ b/bootstrap/email/README.md @@ -5,9 +5,8 @@ inside an existing compartment and subnet; it does not install a mail server, change DNS, or open SMTP ports. Keep `enabled=false` until the OCI image, network, and SSH inputs are known. -The default `VM.Standard.A1.Flex` shape is suitable for an ARM64 Ampere image -and may fit OCI Always Free capacity. Capacity is not guaranteed, so override -the shape and image when needed. +The default `VM.Standard.E2.1.Micro` shape and Canonical Ubuntu 24.04 Minimal +image are intended for OCI Always Free capacity in `us-ashburn-1`. Example on the Debian pipeline host: diff --git a/bootstrap/email/variables.tf b/bootstrap/email/variables.tf index 4446618..5e7ebc2 100644 --- a/bootstrap/email/variables.tf +++ b/bootstrap/email/variables.tf @@ -37,7 +37,7 @@ variable "subnet_id" { variable "image_id" { description = "ARM64 or x86 image OCID compatible with the selected shape." type = string - default = "" + default = "ocid1.image.oc1.iad.aaaaaaaarmp53tuhdoepsh4breobvmbdbq7gbmhosdogknb34xidkfi6hxjq" } variable "ssh_public_key" { @@ -50,7 +50,7 @@ variable "ssh_public_key" { variable "shape" { description = "OCI shape. VM.Standard.A1.Flex is free-tier eligible when capacity is available." type = string - default = "VM.Standard.A1.Flex" + default = "VM.Standard.E2.1.Micro" } variable "ocpus" { @@ -62,7 +62,7 @@ variable "ocpus" { variable "memory_in_gbs" { description = "Memory in GB. Keep within the free-tier allowance." type = number - default = 6 + default = 1 } variable "boot_volume_size_in_gbs" { diff --git a/bootstrap/oci/README.md b/bootstrap/oci/README.md index 8e78faa..4f396d1 100644 --- a/bootstrap/oci/README.md +++ b/bootstrap/oci/README.md @@ -21,6 +21,8 @@ and writes the config with restrictive permissions. It never sends the private key to the API or stores it in Git. Run `./jeannie oci-auth check` after the public key has been uploaded. +The defaults use the Always Free `VM.Standard.E2.1.Micro` shape and the +Canonical Ubuntu 24.04 Minimal image in `us-ashburn-1` supplied for this lab. At minimum, set `LAB_OCI_FOUNDATION_ENABLED=true`, `LAB_OCI_REGION`, `LAB_OCI_TENANCY_ID`, `LAB_OCI_ADMIN_CIDR`, `LAB_OCI_SSH_PUBLIC_KEY`, and the image and availability-domain variables for both VMs. Use diff --git a/bootstrap/oci/variables.tf b/bootstrap/oci/variables.tf index 2ef2daa..02753b7 100644 --- a/bootstrap/oci/variables.tf +++ b/bootstrap/oci/variables.tf @@ -96,13 +96,13 @@ variable "email_availability_domain" { variable "edge_image_id" { description = "OCI image OCID compatible with edge_shape." type = string - default = "" + default = "ocid1.image.oc1.iad.aaaaaaaarmp53tuhdoepsh4breobvmbdbq7gbmhosdogknb34xidkfi6hxjq" } variable "email_image_id" { description = "OCI image OCID compatible with email_shape." type = string - default = "" + default = "ocid1.image.oc1.iad.aaaaaaaarmp53tuhdoepsh4breobvmbdbq7gbmhosdogknb34xidkfi6hxjq" } variable "ssh_public_key" { @@ -113,12 +113,12 @@ variable "ssh_public_key" { variable "edge_shape" { type = string - default = "VM.Standard.A1.Flex" + default = "VM.Standard.E2.1.Micro" } variable "email_shape" { type = string - default = "VM.Standard.A1.Flex" + default = "VM.Standard.E2.1.Micro" } variable "edge_ocpus" { @@ -128,7 +128,7 @@ variable "edge_ocpus" { variable "edge_memory_in_gbs" { type = number - default = 6 + default = 1 } variable "email_ocpus" { @@ -138,7 +138,7 @@ variable "email_ocpus" { variable "email_memory_in_gbs" { type = number - default = 6 + default = 1 } variable "edge_boot_volume_size_in_gbs" { @@ -201,4 +201,15 @@ check "foundation_inputs" { ]) error_message = "VM CPU and memory must be positive and boot volumes must be at least 50 GB." } + + assert { + condition = !var.enabled || ( + (!var.edge_enabled || var.edge_shape == "VM.Standard.E2.1.Micro") && + (!var.email_enabled || var.email_shape == "VM.Standard.E2.1.Micro") && + (var.edge_enabled ? var.edge_ocpus : 0) + (var.email_enabled ? var.email_ocpus : 0) <= 2 && + (var.edge_enabled ? var.edge_memory_in_gbs : 0) + (var.email_enabled ? var.email_memory_in_gbs : 0) <= 2 && + (var.edge_enabled ? var.edge_boot_volume_size_in_gbs : 0) + (var.email_enabled ? var.email_boot_volume_size_in_gbs : 0) <= 200 + ) + error_message = "The foundation is restricted to OCI Always Free VM.Standard.E2.1.Micro instances, at most 2 total OCPUs, 2 GB total memory, and 200 GB total boot volumes." + } }