From 1ee09d2c1a7973d82ab87a3d478c0655e97f18e9 Mon Sep 17 00:00:00 2001 From: Luis Amaral <3392839+luiscamaral@users.noreply.github.com> Date: Tue, 28 Mar 2023 01:48:09 -0600 Subject: [PATCH] Lsa/resource name length i#118 (#135) * Validation added to cluster_name variable * Update ref to eks-cluster-with-vpc on v4.13.1 (#121) * Added cluster_name validation with message (#118) * Error message typo fixed to follow the standards. * Adding requested new line at the end --- examples/eks-cluster-with-vpc/variables.tf | 6 ++++++ modules/eks-monitoring/dashboards/cluster.json | 2 +- modules/eks-monitoring/dashboards/namespace-workloads.json | 2 +- modules/eks-monitoring/dashboards/workloads.json | 2 +- 4 files changed, 9 insertions(+), 3 deletions(-) diff --git a/examples/eks-cluster-with-vpc/variables.tf b/examples/eks-cluster-with-vpc/variables.tf index 23329cb..bb93d3c 100644 --- a/examples/eks-cluster-with-vpc/variables.tf +++ b/examples/eks-cluster-with-vpc/variables.tf @@ -2,6 +2,12 @@ variable "cluster_name" { description = "Name of cluster - used by Terratest for e2e test automation" type = string default = "" + + validation { + # cluster name is used as prefix on eks_blueprint module and cannot be >25 characters + condition = can(regex("^[a-zA-Z][-a-zA-Z0-9]{3,24}$", var.cluster_name)) + error_message = "Cluster name is used as a prefix-name for other resources. Max size is 25 chars and must satisfy regular expression pattern: '[a-zA-Z][-a-zA-Z0-9]{3,19}'." + } } variable "aws_region" { description = "AWS Region" diff --git a/modules/eks-monitoring/dashboards/cluster.json b/modules/eks-monitoring/dashboards/cluster.json index ae16330..af88e93 100644 --- a/modules/eks-monitoring/dashboards/cluster.json +++ b/modules/eks-monitoring/dashboards/cluster.json @@ -2999,4 +2999,4 @@ "uid": "efa86fd1d0c121a26444b636a3f509a8", "version": 23, "weekStart": "" -} \ No newline at end of file +} diff --git a/modules/eks-monitoring/dashboards/namespace-workloads.json b/modules/eks-monitoring/dashboards/namespace-workloads.json index b69d7a5..a1a1732 100644 --- a/modules/eks-monitoring/dashboards/namespace-workloads.json +++ b/modules/eks-monitoring/dashboards/namespace-workloads.json @@ -2657,4 +2657,4 @@ "uid": "a87fb0d919ec0ea5f6543124e16c42a5", "version": 2, "weekStart": "" -} \ No newline at end of file +} diff --git a/modules/eks-monitoring/dashboards/workloads.json b/modules/eks-monitoring/dashboards/workloads.json index 040e260..f50402c 100644 --- a/modules/eks-monitoring/dashboards/workloads.json +++ b/modules/eks-monitoring/dashboards/workloads.json @@ -2265,4 +2265,4 @@ "uid": "a164a7f0339f99e89cea5cb47e9be617", "version": 7, "weekStart": "" -} \ No newline at end of file +}