Build AMIs on temporary EC2 builders
This commit is contained in:
+55
-23
@@ -7,22 +7,18 @@ variable "aws_region" {
|
||||
variable "name" {
|
||||
type = string
|
||||
default = "nixos-zfs-ec2"
|
||||
description = "Name prefix for the published AMI."
|
||||
description = "Name prefix for builder resources and the published AMI."
|
||||
}
|
||||
|
||||
variable "architecture" {
|
||||
variable "system" {
|
||||
type = string
|
||||
description = "AMI architecture, such as arm64 or x86_64."
|
||||
}
|
||||
default = "aarch64-linux"
|
||||
description = "Target NixOS system for the AMI."
|
||||
|
||||
variable "root_snapshot_id" {
|
||||
type = string
|
||||
description = "Snapshot ID for the bootable NixOS root volume."
|
||||
}
|
||||
|
||||
variable "nix_snapshot_id" {
|
||||
type = string
|
||||
description = "Snapshot ID for the preseeded ZFS /nix volume."
|
||||
validation {
|
||||
condition = contains(["aarch64-linux", "x86_64-linux"], var.system)
|
||||
error_message = "system must be aarch64-linux or x86_64-linux."
|
||||
}
|
||||
}
|
||||
|
||||
variable "input_hash" {
|
||||
@@ -40,32 +36,68 @@ variable "flake_lock_rev" {
|
||||
description = "Revision or hash representing flake.lock inputs."
|
||||
}
|
||||
|
||||
variable "nixos_system_closure" {
|
||||
variable "builder_instance_type" {
|
||||
type = string
|
||||
default = ""
|
||||
description = "NixOS system closure path used to build the root image."
|
||||
default = "t4g.large"
|
||||
description = "Temporary EC2 instance type used to build and seed the AMI."
|
||||
}
|
||||
|
||||
variable "root_device_name" {
|
||||
variable "vpc_id" {
|
||||
type = string
|
||||
default = "/dev/xvda"
|
||||
description = "Root block device name used for AMI registration."
|
||||
default = null
|
||||
description = "VPC ID. Defaults to the account default VPC."
|
||||
}
|
||||
|
||||
variable "nix_device_name" {
|
||||
variable "subnet_id" {
|
||||
type = string
|
||||
default = "/dev/sdf"
|
||||
description = "AMI block device name for the /nix EBS snapshot. Runtime imports by ZFS pool identity, not this device name."
|
||||
default = null
|
||||
description = "Subnet ID. Defaults to the first subnet in the selected/default VPC."
|
||||
}
|
||||
|
||||
variable "base_nixos_ami_id" {
|
||||
type = string
|
||||
default = null
|
||||
description = "Base NixOS AMI used only for the temporary builder. If null, OpenTofu searches for a recent NixOS AMI."
|
||||
}
|
||||
|
||||
variable "base_nixos_ami_owners" {
|
||||
type = list(string)
|
||||
default = ["427812963091"]
|
||||
description = "AWS account IDs to search for base NixOS AMIs."
|
||||
}
|
||||
|
||||
variable "base_nixos_ami_name_pattern" {
|
||||
type = string
|
||||
default = null
|
||||
description = "Base NixOS AMI name filter."
|
||||
}
|
||||
|
||||
variable "root_volume_size_gb" {
|
||||
type = number
|
||||
default = 30
|
||||
description = "Root EBS volume size."
|
||||
description = "Temporary builder root EBS volume size. This becomes the final AMI root snapshot size."
|
||||
}
|
||||
|
||||
variable "nix_volume_size_gb" {
|
||||
type = number
|
||||
default = 50
|
||||
description = "/nix EBS volume size."
|
||||
description = "Temporary /nix EBS volume size. This becomes the final AMI /nix snapshot size."
|
||||
}
|
||||
|
||||
variable "nix_pool" {
|
||||
type = string
|
||||
default = "nixos-zfs-nix"
|
||||
description = "ZFS pool name for the AMI-provided /nix volume."
|
||||
}
|
||||
|
||||
variable "nix_device_name" {
|
||||
type = string
|
||||
default = "/dev/sdf"
|
||||
description = "EC2 block device name for the AMI /nix volume. NixOS imports by ZFS pool identity, not this device name."
|
||||
}
|
||||
|
||||
variable "ssh_public_key" {
|
||||
type = string
|
||||
default = null
|
||||
description = "Optional SSH public key for debugging the temporary builder."
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user