fix: constrain OCI foundation to free tier micro VMs
This commit is contained in:
parent
9f42e29d02
commit
80ce6dd9a2
|
|
@ -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:
|
||||
|
||||
|
|
|
|||
|
|
@ -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" {
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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."
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue