11variable "name" {
22 description = " Name of the application"
33 type = string
4+ default = " vulne-soldier-compliance-remediate"
45}
56
67variable "aws_region" {
78 description = " AWS region where the resources will be created"
89 type = string
10+ default = " us-east-1"
911}
1012
1113variable "environment" {
1214 description = " Name of the environment"
1315 type = string
16+ default = " dev"
1417}
1518
1619variable "account_id" {
1720 description = " AWS account ID"
1821 type = string
22+ validation {
23+ condition = can (regex (" ^[0-9]{12}$" , var. account_id ))
24+ error_message = " The account_id must be a 12-digit number."
25+ }
1926}
2027
2128variable "lambda_log_group" {
@@ -26,7 +33,10 @@ variable "lambda_log_group" {
2633variable "lambda_zip" {
2734 description = " File location of the lambda zip file for remediation."
2835 type = string
29- default = null
36+ validation {
37+ condition = can (regex (" ^.+\\ .zip$" , var. lambda_zip ))
38+ error_message = " The lambda_zip must be a path to a zip file."
39+ }
3040}
3141
3242variable "remediation_options" {
@@ -47,4 +57,12 @@ variable "remediation_options" {
4757 vulnerability_severities = " CRITICAL, HIGH"
4858 override_findings_for_target_instances_ids = null
4959 }
60+ validation {
61+ condition = contains ([" NoReboot" , " RebootIfNeeded" ], var. remediation_options . reboot_option )
62+ error_message = " The reboot_option must be either NoReboot or RebootIfNeeded."
63+ }
64+ validation {
65+ condition = can (regex (" ^([A-Z]+, )*[A-Z]+$" , var. remediation_options . vulnerability_severities ))
66+ error_message = " The vulnerability_severities must be a comma-separated list of severities in uppercase."
67+ }
5068}
0 commit comments