Skip to content

Commit

Permalink
Added validation for resource prefix
Browse files Browse the repository at this point in the history
Prevents S3 bucket from rejecting names with capital letters. Addresses and closes #121
  • Loading branch information
airizarryDB committed Jan 22, 2025
1 parent b6ffcbe commit ae42400
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
5 changes: 5 additions & 0 deletions aws-gov/tf/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,11 @@ variable "region_bucket_name" {
variable "resource_prefix" {
description = "Prefix for the resource names."
type = string

validation {
condition = can(regex("^[a-z0-9-]+$", var.resource_prefix))
error_message = "Invalid resource prefix. Allowed characters are a-z, 0-9, -"
}
}

// AWS Gov Only Variables
Expand Down
5 changes: 5 additions & 0 deletions aws/tf/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -86,4 +86,9 @@ variable "region_bucket_name" {
variable "resource_prefix" {
description = "Prefix for the resource names."
type = string

validation {
condition = can(regex("^[a-z0-9-]+$", var.resource_prefix))
error_message = "Invalid resource prefix. Allowed characters are a-z, 0-9, -"
}
}

0 comments on commit ae42400

Please sign in to comment.