From 6522317c5097ee49aee3c1c8926f72c6bd054e51 Mon Sep 17 00:00:00 2001 From: rossrollin <43017026+rossrollin@users.noreply.github.com> Date: Mon, 1 Nov 2021 14:11:17 +0000 Subject: [PATCH] fix: add validation to distribution_bucket_name variable (#1356) Co-authored-by: Ross Williams --- 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