Skip to content
This repository was archived by the owner on Nov 26, 2024. It is now read-only.

Add experimental validation #1

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions variables.tf
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
variable "project_slug" {
type = string
description = "A slugified name, used to label AWS resources."
validation {
// Ensures that the slug does not start or end with a period or dash
// Ensures that the overall slug is no longer than 52 characters, which allows this to be used
// for the assetstore bucket name (the overall bucket name must be less than 63 characters)
condition = can(regex("^[a-z0-9]+[a-z0-9.-]{0,50}[a-z0-9]+$", var.project_slug))
error_message = "The project_slug value may contain only lowercase letters, numbers, periods, and dashes."
}
}

variable "ec2_instance_type" {
Expand All @@ -12,6 +19,10 @@ variable "ec2_ami" {
type = string
default = "ami-0ac80df6eff0e70b5"
description = "The base AMI ID for the server."
validation {
condition = can(regex("^ami-", var.ec2_ami))
error_message = "The ec2_ami value must be a valid AMI id, starting with \"ami-\"."
}
}
variable "ssh_public_key" {
type = string
Expand Down