variables.pkr.hcl 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. // Input variables for the 3x-ui golden-image build.
  2. // See README.md for usage. Override with -var / -var-file or env (PKR_VAR_*).
  3. variable "xui_version" {
  4. type = string
  5. description = "3x-ui release tag to install, e.g. v3.3.1. 'latest' resolves the newest GitHub release at build time."
  6. default = "latest"
  7. }
  8. variable "xui_arch" {
  9. type = string
  10. description = "CPU architecture to build for: amd64 or arm64."
  11. default = "amd64"
  12. validation {
  13. condition = contains(["amd64", "arm64"], var.xui_arch)
  14. error_message = "The xui_arch value must be 'amd64' or 'arm64'."
  15. }
  16. }
  17. variable "ubuntu_version" {
  18. type = string
  19. description = "Ubuntu LTS version label, used only for image naming/tags."
  20. default = "24.04"
  21. }
  22. // --- amazon-ebs (AMI) ---------------------------------------------------------
  23. variable "region" {
  24. type = string
  25. description = "AWS region the AMI is built in."
  26. default = "eu-central-1"
  27. }
  28. variable "instance_type" {
  29. type = string
  30. description = "EC2 instance type used to build the AMI. Must match xui_arch (e.g. t3.small for amd64, t4g.small for arm64/Graviton)."
  31. default = "t3.small"
  32. }
  33. variable "ami_name_prefix" {
  34. type = string
  35. description = "Prefix for the produced AMI name."
  36. default = "3x-ui"
  37. }
  38. variable "source_ami_filter_name" {
  39. type = string
  40. description = "Override for the Canonical Ubuntu base AMI name filter. Empty ⇒ derived from xui_arch (latest patched 24.04 LTS for that arch)."
  41. default = ""
  42. }
  43. variable "ssh_username" {
  44. type = string
  45. description = "Default SSH user on the base Ubuntu cloud image."
  46. default = "ubuntu"
  47. }
  48. // --- qemu (qcow2 / raw) -------------------------------------------------------
  49. variable "qemu_iso_url" {
  50. type = string
  51. description = "Override for the Ubuntu cloud image used as the qemu base disk. Empty ⇒ derived from xui_arch (amd64/arm64 cloud image)."
  52. default = ""
  53. }
  54. variable "qemu_iso_checksum" {
  55. type = string
  56. description = "Checksum for the qemu base disk. 'file:<SHA256SUMS url>' auto-fetches; 'none' skips verification."
  57. default = "file:https://cloud-images.ubuntu.com/releases/24.04/release/SHA256SUMS"
  58. }
  59. variable "qemu_accelerator" {
  60. type = string
  61. description = "QEMU accelerator: 'kvm' when /dev/kvm is available, else 'tcg' (slow software emulation)."
  62. default = "kvm"
  63. }
  64. variable "qemu_headless" {
  65. type = bool
  66. description = "Run QEMU without a display (required on CI runners)."
  67. default = true
  68. }
  69. variable "qemu_build_password" {
  70. type = string
  71. description = "Temporary password injected via cloud-init for Packer's build-time SSH. Locked/removed before the image is finalized."
  72. default = "packer-build-temp-pw"
  73. sensitive = true
  74. }
  75. # --- qemu arm64-only knobs (ignored for amd64) -------------------------------
  76. variable "qemu_cpu" {
  77. type = string
  78. description = "QEMU -cpu model for arm64 builds: 'host' with KVM on an arm64 host, 'max' for TCG emulation."
  79. default = "host"
  80. }
  81. variable "qemu_efi_code" {
  82. type = string
  83. description = "Path to the arm64 UEFI code firmware (AAVMF). Only used when xui_arch=arm64."
  84. default = "/usr/share/AAVMF/AAVMF_CODE.fd"
  85. }
  86. variable "qemu_efi_vars" {
  87. type = string
  88. description = "Path to the arm64 UEFI vars firmware template (AAVMF). Only used when xui_arch=arm64."
  89. default = "/usr/share/AAVMF/AAVMF_VARS.fd"
  90. }