diff --git a/examples/aws/installation/dsf_single_account_deployment/main.tf b/examples/aws/installation/dsf_single_account_deployment/main.tf index 010f5293..e6457801 100644 --- a/examples/aws/installation/dsf_single_account_deployment/main.tf +++ b/examples/aws/installation/dsf_single_account_deployment/main.tf @@ -11,8 +11,7 @@ locals { deployment_name_salted = join("-", [var.deployment_name, module.globals.salt]) password = var.password != null ? var.password : module.globals.random_password workstation_cidr = var.workstation_cidr != null ? var.workstation_cidr : local.workstation_cidr_24 - additional_tags = var.additional_tags != null ? { for item in var.additional_tags : split("=", item)[0] => split("=", item)[1] } : {} - tags = merge(module.globals.tags, { "deployment_name" = local.deployment_name_salted }, local.additional_tags) + tags = merge(module.globals.tags, var.additional_tags, { "deployment_name" = local.deployment_name_salted }) hub_main_private_key_file_path = var.hub_main_key_pair != null ? var.hub_main_key_pair.private_key_file_path : module.key_pair_hub_main[0].private_key_file_path hub_main_public_key_name = var.hub_main_key_pair != null ? var.hub_main_key_pair.public_key_name : module.key_pair_hub_main[0].key_pair.key_pair_name diff --git a/examples/aws/installation/dsf_single_account_deployment/variables.tf b/examples/aws/installation/dsf_single_account_deployment/variables.tf index 032c245f..9da9da08 100644 --- a/examples/aws/installation/dsf_single_account_deployment/variables.tf +++ b/examples/aws/installation/dsf_single_account_deployment/variables.tf @@ -1,3 +1,9 @@ +variable "additional_tags" { + description = "A map of tags to add to all resources" + type = map(string) + default = {} +} + variable "deployment_name" { type = string default = "imperva-dsf" @@ -19,18 +25,6 @@ variable "aws_region_2" { description = "The second AWS region for the deployed resources (e.g us-east-2)" } -variable "additional_tags" { - type = list(string) - default = [] - description = "Additional tags to add to the DSFKit resources. Put tags in the following format - Key: Name. For example - [\"Key1=Name1\", \"Key2=Name2\"]" - validation { - condition = alltrue([ - for tag_pair in var.additional_tags : can(regex("^([a-zA-Z0-9+\\-_.:/@]+)=([a-zA-Z0-9+\\-_.:/]+)$", tag_pair)) - ]) - error_message = "Invalid tag format. All values must be in the format of 'key=value', where 'key' is a valid AWS tag name and 'value' is a valid AWS tag value. Note that the '=' character is not allowed in either the key or the value." - } -} - variable "enable_sonar" { type = bool default = true diff --git a/examples/aws/installation/sonar_multi_account_deployment/main.tf b/examples/aws/installation/sonar_multi_account_deployment/main.tf index f4c26cba..7913de5a 100644 --- a/examples/aws/installation/sonar_multi_account_deployment/main.tf +++ b/examples/aws/installation/sonar_multi_account_deployment/main.tf @@ -10,8 +10,7 @@ locals { password = var.password != null ? var.password : module.globals.random_password workstation_cidr = var.workstation_cidr != null ? var.workstation_cidr : local.workstation_cidr_24 tarball_location = var.tarball_location != null ? var.tarball_location : module.globals.tarball_location - additional_tags = var.additional_tags != null ? { for item in var.additional_tags : split("=", item)[0] => split("=", item)[1] } : {} - tags = merge(module.globals.tags, { "deployment_name" = local.deployment_name_salted }, local.additional_tags) + tags = merge(module.globals.tags, var.additional_tags, { "deployment_name" = local.deployment_name_salted }) should_create_hub_main_key_pair = var.hub_main_key_pair == null ? true : false should_create_hub_dr_key_pair = var.hub_dr_key_pair == null ? true : false should_create_gw_main_key_pair = var.gw_main_key_pair == null ? true : false diff --git a/examples/aws/installation/sonar_multi_account_deployment/variables.tf b/examples/aws/installation/sonar_multi_account_deployment/variables.tf index b7525464..c8ba2255 100644 --- a/examples/aws/installation/sonar_multi_account_deployment/variables.tf +++ b/examples/aws/installation/sonar_multi_account_deployment/variables.tf @@ -1,3 +1,9 @@ +variable "additional_tags" { + description = "A map of tags to add to all resources" + type = map(string) + default = {} +} + variable "deployment_name" { type = string default = "imperva-dsf" @@ -44,18 +50,6 @@ variable "aws_region_gw_dr" { description = "AWS region for the DR Agentless gateway (e.g us-east-1)" } -variable "additional_tags" { - type = list(string) - default = [] - description = "Additional tags to add to the DSFKit resources. Put tags in the following format - Key: Name. For example - [\"Key1=Name1\", \"Key2=Name2\"]" - validation { - condition = alltrue([ - for tag_pair in var.additional_tags : can(regex("^([a-zA-Z0-9+\\-_.:/@]+)=([a-zA-Z0-9+\\-_.:/]+)$", tag_pair)) - ]) - error_message = "Invalid tag format. All values must be in the format of 'key=value', where 'key' is a valid AWS tag name and 'value' is a valid AWS tag value. Note that the '=' character is not allowed in either the key or the value." - } -} - variable "subnet_hub_main" { type = string description = "AWS subnet id for the main DSF Hub (e.g subnet-xxxxxxxxxxxxxxxxx)" diff --git a/examples/aws/installation/sonar_single_account_deployment/main.tf b/examples/aws/installation/sonar_single_account_deployment/main.tf index 86701e48..1f0d7d50 100644 --- a/examples/aws/installation/sonar_single_account_deployment/main.tf +++ b/examples/aws/installation/sonar_single_account_deployment/main.tf @@ -21,8 +21,7 @@ locals { password = var.password != null ? var.password : module.globals.random_password workstation_cidr = var.workstation_cidr != null ? var.workstation_cidr : local.workstation_cidr_24 tarball_location = var.tarball_location != null ? var.tarball_location : module.globals.tarball_location - additional_tags = var.additional_tags != null ? { for item in var.additional_tags : split("=", item)[0] => split("=", item)[1] } : {} - tags = merge(module.globals.tags, { "deployment_name" = local.deployment_name_salted }, local.additional_tags) + tags = merge(module.globals.tags, var.additional_tags, { "deployment_name" = local.deployment_name_salted }) should_create_hub_key_pair = var.hub_key_pair == null ? true : false should_create_gw_key_pair = var.gw_key_pair == null ? true : false } diff --git a/examples/aws/installation/sonar_single_account_deployment/variables.tf b/examples/aws/installation/sonar_single_account_deployment/variables.tf index 2c55cda6..df86781b 100644 --- a/examples/aws/installation/sonar_single_account_deployment/variables.tf +++ b/examples/aws/installation/sonar_single_account_deployment/variables.tf @@ -1,3 +1,9 @@ +variable "additional_tags" { + description = "A map of tags to add to all resources" + type = map(string) + default = {} +} + variable "deployment_name" { type = string default = "imperva-dsf" @@ -24,18 +30,6 @@ variable "sonar_version" { } } -variable "additional_tags" { - type = list(string) - default = [] - description = "Additional tags to add to the DSFKit resources. Put tags in the following format - Key: Name. For example - [\"Key1=Name1\", \"Key2=Name2\"]" - validation { - condition = alltrue([ - for tag_pair in var.additional_tags : can(regex("^([a-zA-Z0-9+\\-_.:/@]+)=([a-zA-Z0-9+\\-_.:/]+)$", tag_pair)) - ]) - error_message = "Invalid tag format. All values must be in the format of 'key=value', where 'key' is a valid AWS tag name and 'value' is a valid AWS tag value. Note that the '=' character is not allowed in either the key or the value." - } -} - variable "tarball_location" { type = object({ s3_bucket = string diff --git a/examples/aws/poc/dsf_deployment/main.tf b/examples/aws/poc/dsf_deployment/main.tf index 49de0371..67c62042 100644 --- a/examples/aws/poc/dsf_deployment/main.tf +++ b/examples/aws/poc/dsf_deployment/main.tf @@ -31,6 +31,6 @@ locals { deployment_name_salted = join("-", [var.deployment_name, module.globals.salt]) password = var.password != null ? var.password : module.globals.random_password workstation_cidr = var.workstation_cidr != null ? var.workstation_cidr : local.workstation_cidr_24 - tags = merge(module.globals.tags, var.tags, { "deployment_name" = local.deployment_name_salted }) + tags = merge(module.globals.tags, var.additional_tags, { "deployment_name" = local.deployment_name_salted }) private_key_file_path = module.key_pair.private_key_file_path } diff --git a/examples/aws/poc/dsf_deployment/variables.tf b/examples/aws/poc/dsf_deployment/variables.tf index 8e755ae5..93a56fb0 100644 --- a/examples/aws/poc/dsf_deployment/variables.tf +++ b/examples/aws/poc/dsf_deployment/variables.tf @@ -1,4 +1,4 @@ -variable "tags" { +variable "additional_tags" { description = "A map of tags to add to all resources" type = map(string) default = {} diff --git a/examples/aws/poc/sonar_basic_deployment/main.tf b/examples/aws/poc/sonar_basic_deployment/main.tf index e7859124..ad334d08 100644 --- a/examples/aws/poc/sonar_basic_deployment/main.tf +++ b/examples/aws/poc/sonar_basic_deployment/main.tf @@ -37,7 +37,7 @@ locals { password = var.password != null ? var.password : module.globals.random_password workstation_cidr = var.workstation_cidr != null ? var.workstation_cidr : local.workstation_cidr_24 tarball_location = module.globals.tarball_location - tags = merge(module.globals.tags, { "deployment_name" = local.deployment_name_salted }) + tags = merge(module.globals.tags, var.additional_tags,{ "deployment_name" = local.deployment_name_salted }) hub_subnet_id = var.subnet_ids != null ? var.subnet_ids.hub_subnet_id : module.vpc[0].public_subnets[0] gw_subnet_id = var.subnet_ids != null ? var.subnet_ids.gw_subnet_id : module.vpc[0].private_subnets[0] db_subnet_ids = var.subnet_ids != null ? var.subnet_ids.db_subnet_ids : module.vpc[0].public_subnets diff --git a/examples/aws/poc/sonar_basic_deployment/variables.tf b/examples/aws/poc/sonar_basic_deployment/variables.tf index 2451fdab..91c732c3 100644 --- a/examples/aws/poc/sonar_basic_deployment/variables.tf +++ b/examples/aws/poc/sonar_basic_deployment/variables.tf @@ -1,3 +1,9 @@ +variable "additional_tags" { + description = "A map of tags to add to all resources" + type = map(string) + default = {} +} + variable "deployment_name" { type = string default = "imperva-dsf" diff --git a/examples/aws/poc/sonar_hadr_deployment/main.tf b/examples/aws/poc/sonar_hadr_deployment/main.tf index 90c300e9..ce5aac81 100644 --- a/examples/aws/poc/sonar_hadr_deployment/main.tf +++ b/examples/aws/poc/sonar_hadr_deployment/main.tf @@ -35,7 +35,7 @@ locals { password = var.password != null ? var.password : module.globals.random_password workstation_cidr = var.workstation_cidr != null ? var.workstation_cidr : local.workstation_cidr_24 tarball_location = var.tarball_location != null ? var.tarball_location : module.globals.tarball_location - tags = merge(module.globals.tags, { "deployment_name" = local.deployment_name_salted }) + tags = merge(module.globals.tags, var.additional_tags, { "deployment_name" = local.deployment_name_salted }) main_hub_subnet_id = var.subnet_ids != null ? var.subnet_ids.main_hub_subnet_id : module.vpc[0].public_subnets[0] dr_hub_subnet_id = var.subnet_ids != null ? var.subnet_ids.dr_hub_subnet_id : module.vpc[0].public_subnets[1] main_gws_subnet_id = var.subnet_ids != null ? var.subnet_ids.main_gws_subnet_id : module.vpc[0].private_subnets[0] diff --git a/examples/aws/poc/sonar_hadr_deployment/variables.tf b/examples/aws/poc/sonar_hadr_deployment/variables.tf index 00f96419..7ac8bd37 100644 --- a/examples/aws/poc/sonar_hadr_deployment/variables.tf +++ b/examples/aws/poc/sonar_hadr_deployment/variables.tf @@ -1,3 +1,9 @@ +variable "additional_tags" { + description = "A map of tags to add to all resources" + type = map(string) + default = {} +} + variable "deployment_name" { type = string default = "imperva-dsf"