aboutsummaryrefslogtreecommitdiffstats
path: root/openbsd-image/variables.pkr.hcl
blob: e8340a9c102b5104c28f1a5531bed770c4cccc8f (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
variable "version" {
  type        = string
  description = "Version of OpenBSD to build"
  validation {
    condition     = can(regex("^\\d\\.\\d$", var.version))
    error_message = "The version must be a single-digit followed by a period followed by another single digit."
  }
}

variable "arch" {
  type    = string
  validation {
    condition     = contains(["amd64", "arm64"], var.arch)
    error_message = "The arch must be one of: amd64, arm64."
  }
}

variable "admin_user" {
  type        = string
  description = "Username of the admin user on the VM"
  default     = "admin"
}

variable "ssh_key" {
  type        = string
  description = "Public SSH key to associate with the admin user for login"
}

variable "mirror" {
  type        = string
  description = "URL basename for where to download the OpenBSD ISO."
  default     = "https://cdn.openbsd.org"
  validation {
    condition     = can(regex("^(https?)://", var.mirror)) && !endswith(var.mirror, "/")
    error_message = "URL must start with http(s):// and must not have a trailing slash."
  }
}

variable "hostname" {
  type        = string
  description = "Hostname for the VM"
  default     = "openbsd-vm"
}

variable "cpus" {
  type        = number
  description = "CPUs to allocate to the VM while building the ISO"
  default     = 2
}

variable "memory" {
  type        = number
  description = "Memory to allocate to the VM in MB while building the ISO"
  default     = 4096
}

variable "disk_size" {
  type        = number
  description = "Size of the disk in GB while building the ISO"
  default     = 16
}