From 27dd8c73dd005d6fdf4bf5fdcdb63e56e12efc01 Mon Sep 17 00:00:00 2001 From: Ross Williams Date: Fri, 29 Oct 2021 17:15:50 +0100 Subject: [PATCH] feat: add validation to distribution_bucket_name variable --- modules/runner-binaries-syncer/variables.tf | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/modules/runner-binaries-syncer/variables.tf b/modules/runner-binaries-syncer/variables.tf index d2daafec3f..b4320ee531 100644 --- a/modules/runner-binaries-syncer/variables.tf +++ b/modules/runner-binaries-syncer/variables.tf @@ -17,8 +17,13 @@ variable "environment" { variable "distribution_bucket_name" { description = "Bucket for storing the action runner distribution." type = string + + # Make sure the bucket name only contains legal characters + validation { + error_message = "Only lowercase alphanumeric characters and hyphens allowed in the bucket name." + condition = can(regex("^[a-z0-9-]*$", var.distribution_bucket_name)) + } } - variable "lambda_schedule_expression" { description = "Scheduler expression for action runner binary syncer." type = string