| 1 | variable "name" { |
| 2 | validation { |
| 3 | condition = can(regex("^[a-z][a-z0-9-]{1,45}[a-z0-9]$", var.name)) |
| 4 | error_message = "Expected a lowercase resource name." |
| 5 | } |
| 6 | type = string |
| 7 | } |
| 8 | |
| 9 | variable "host_count" { |
| 10 | validation { |
| 11 | condition = var.host_count >= 1 && var.host_count <= 6 && floor(var.host_count) == var.host_count |
| 12 | error_message = "Use 1–6 hosts." |
| 13 | } |
| 14 | type = number |
| 15 | } |
| 16 | |
| 17 | variable "vpc_cidr" { |
| 18 | type = string |
| 19 | } |
| 20 | |
| 21 | variable "deployment_bucket_name" { |
| 22 | validation { |
| 23 | condition = can(regex("^[a-z0-9][a-z0-9.-]{1,61}[a-z0-9]$", var.deployment_bucket_name)) |
| 24 | error_message = "Expected an S3 bucket name." |
| 25 | } |
| 26 | type = string |
| 27 | } |
| 28 | |
| 29 | variable "deployment_bucket_arn" { |
| 30 | type = string |
| 31 | } |
| 32 | |
| 33 | variable "deployment_region" { |
| 34 | validation { |
| 35 | condition = can(regex("^[a-z]{2}-[a-z]+-[0-9]+$", var.deployment_region)) |
| 36 | error_message = "Expected an AWS region name." |
| 37 | } |
| 38 | type = string |
| 39 | } |
| 40 | |
| 41 | variable "data_bucket_name" { |
| 42 | validation { |
| 43 | condition = can(regex("^[a-z0-9][a-z0-9.-]{1,61}[a-z0-9]$", var.data_bucket_name)) |
| 44 | error_message = "Expected an S3 bucket name." |
| 45 | } |
| 46 | type = string |
| 47 | } |
| 48 | |
| 49 | variable "data_bucket_arn" { |
| 50 | type = string |
| 51 | } |
| 52 | |
| 53 | variable "placement_region" { |
| 54 | validation { |
| 55 | condition = can(regex("^[a-z][a-z0-9-]{0,31}$", var.placement_region)) |
| 56 | error_message = "Expected a lowercase placement region." |
| 57 | } |
| 58 | type = string |
| 59 | } |
| 60 | |
| 61 | variable "release_public_key" { |
| 62 | validation { |
| 63 | condition = can(regex("^[A-Za-z0-9+/]{42}[AEIMQUYcgkosw048]=$", var.release_public_key)) |
| 64 | error_message = "Expected a base64 32-byte Ed25519 public key." |
| 65 | } |
| 66 | type = string |
| 67 | } |
| 68 | |
| 69 | variable "apps_domain" { |
| 70 | validation { |
| 71 | condition = length(var.apps_domain) <= 253 && can(regex("^[a-z0-9]([a-z0-9-]*[a-z0-9])?(\\.[a-z0-9]([a-z0-9-]*[a-z0-9])?)+$", var.apps_domain)) |
| 72 | error_message = "Expected a lowercase DNS domain without a scheme or path." |
| 73 | } |
| 74 | type = string |
| 75 | } |
| 76 | |
| 77 | variable "instance_type" { |
| 78 | type = string |
| 79 | default = "t4g.small" |
| 80 | } |
| 81 | |
| 82 | variable "root_volume_gib" { |
| 83 | type = number |
| 84 | default = 20 |
| 85 | } |
| 86 | |