Download this file
| 1 | variable "aws_account_id" { |
| 2 | type = string |
| 3 | validation { |
| 4 | condition = can(regex("^[0-9]{12}$", var.aws_account_id)) |
| 5 | error_message = "Expected a 12-digit AWS account ID." |
| 6 | } |
| 7 | } |
| 8 | variable "name" { |
| 9 | type = string |
| 10 | default = "carlos" |
| 11 | validation { |
| 12 | condition = can(regex("^[a-z][a-z0-9-]{1,18}[a-z0-9]$", var.name)) |
| 13 | error_message = "Use 3–20 lowercase letters, digits or hyphens, starting with a letter and ending with a letter or digit." |
| 14 | } |
| 15 | } |
| 16 | variable "release_public_key" { |
| 17 | type = string |
| 18 | validation { |
| 19 | condition = can(regex("^[A-Za-z0-9+/]{42}[AEIMQUYcgkosw048]=$", var.release_public_key)) |
| 20 | error_message = "Expected a base64 32-byte Ed25519 public key." |
| 21 | } |
| 22 | } |
| 23 | variable "apps_domain" { |
| 24 | type = string |
| 25 | validation { |
| 26 | 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)) |
| 27 | error_message = "Expected a lowercase DNS domain without a scheme or path." |
| 28 | } |
| 29 | } |
| 30 | variable "instance_type" { |
| 31 | type = string |
| 32 | default = "t4g.small" |
| 33 | validation { |
| 34 | condition = can(regex("^(t4g|m[6-9]g|c[6-9]g|r[6-9]g)\\.", var.instance_type)) |
| 35 | error_message = "Choose an ARM64 Graviton instance type." |
| 36 | } |
| 37 | } |
| 38 | variable "root_volume_gib" { |
| 39 | type = number |
| 40 | default = 20 |
| 41 | validation { |
| 42 | condition = var.root_volume_gib >= 20 && floor(var.root_volume_gib) == var.root_volume_gib |
| 43 | error_message = "Use a whole number of GiB, at least 20." |
| 44 | } |
| 45 | } |
| 46 | variable "region" { |
| 47 | type = string |
| 48 | default = "eu-west-1" |
| 49 | validation { |
| 50 | condition = can(regex("^[a-z]{2}-[a-z]+-[0-9]+$", var.region)) |
| 51 | error_message = "Expected an AWS commercial region name." |
| 52 | } |
| 53 | } |
| 54 | |