diff --git a/.bumpversion.cfg b/.bumpversion.cfg index fab32b7..09fd8af 100644 --- a/.bumpversion.cfg +++ b/.bumpversion.cfg @@ -1,5 +1,5 @@ [bumpversion] -current_version = 1.0.0 +current_version = 1.0.1 commit = True message = Bumps version to {new_version} tag = False diff --git a/CHANGELOG.md b/CHANGELOG.md index 6723aaf..7b335fc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,14 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/) and this project adheres to [Semantic Versioning](http://semver.org/). +### [1.0.1] (https://github.com/plus3it/terraform-aws-tardigrade-account-alternate-contacts/releases/tag/1.0.1) + +**Released**: 2024.11.27 + +**Summary**: + +* Adds variable validation + ### [1.0.0] (https://github.com/plus3it/terraform-aws-tardigrade-account-alternate-contacts/releases/tag/1.0.0) **Released**: 2023.02.09 diff --git a/variables.tf b/variables.tf index c490bfe..915c5bc 100644 --- a/variables.tf +++ b/variables.tf @@ -19,4 +19,38 @@ variable "account_alternate_contacts" { phone_number = string })) }) + validation { + condition = alltrue([ + for type in var.account_alternate_contacts : + length(type.name) >= 1 && + length(type.name) <= 64 + ]) + error_message = "Invalid value for Name (must be between 1 and 64 characters)" + } + validation { + condition = alltrue([ + for type in var.account_alternate_contacts : + length(type.title) >= 1 && + length(type.title) <= 50 + ]) + error_message = "Invalid value for Title (must be between 1 and 50 characters)" + } + validation { + condition = alltrue([ + for type in var.account_alternate_contacts : + length(type.email_address) >= 1 && + length(type.email_address) <= 254 && + can(regex("^[\\s]*[\\w+=.#|!&-]+@[\\w.-]+\\.[\\w]+[\\s]*$", type.email_address)) + ]) + error_message = "Invalid value for email address (must be between 1 and 50 characters and correct syntax)" + } + validation { + condition = alltrue([ + for type in var.account_alternate_contacts : + length(type.phone_number) >= 1 && + length(type.phone_number) <= 25 && + can(regex("^[\\s0-9()+-]+$", type.phone_number)) + ]) + error_message = "Invalid value for phone number (must be between 1 and 50 characters and correct syntax)" + } }