From d60edbb6d29996a727d2ebb22858391dfd040aef Mon Sep 17 00:00:00 2001 From: root Date: Thu, 5 Dec 2019 14:52:23 +0200 Subject: [PATCH] Implemented LzHash --- .../.terrahub.yml | 9 +++++++-- .../landing_zone_config_config_rule/.terrahub.yml | 12 +++++++++--- .../.terrahub.yml | 8 ++++++-- components/landing_zone_eip/.terrahub.yml | 14 ++++++++++---- components/landing_zone_gateway_cgw/.terrahub.yml | 7 +++++-- components/landing_zone_gateway_nat/.terrahub.yml | 10 +++++++--- components/landing_zone_gateway_tgw/.terrahub.yml | 7 +++++-- components/landing_zone_gateway_vgw/.terrahub.yml | 7 +++++-- components/landing_zone_network_acl/.terrahub.yml | 7 +++++-- components/landing_zone_route/.terrahub.yml | 4 ++-- components/landing_zone_route_nat/.terrahub.yml | 4 ++-- .../.terrahub.yml | 4 ++-- .../landing_zone_route_table_tgw/.terrahub.yml | 8 ++++++-- components/landing_zone_route_vgw/.terrahub.yml | 8 ++++---- .../.terrahub.yml | 6 +++++- components/landing_zone_sns_topic/.terrahub.yml | 6 +++++- .../landing_zone_ssm_activation/.terrahub.yml | 6 +++++- .../.terrahub.yml | 4 ++-- components/landing_zone_ssm_document/.terrahub.yml | 12 +++++++++--- .../.terrahub.yml | 9 +++++++-- .../landing_zone_ssm_parameter/.terrahub.yml | 6 +++++- .../landing_zone_ssm_patch_baseline/.terrahub.yml | 9 +++++++-- .../landing_zone_tgw_route_table/.terrahub.yml | 9 +++++++-- .../landing_zone_tgw_vpc_attachment/.terrahub.yml | 9 +++++++-- .../.terrahub.yml | 10 +++++++--- .../.terrahub.yml | 4 ++-- 26 files changed, 143 insertions(+), 56 deletions(-) diff --git a/components/landing_zone_config_aggregate_authorization/.terrahub.yml b/components/landing_zone_config_aggregate_authorization/.terrahub.yml index a077cca..d19e8b9 100644 --- a/components/landing_zone_config_aggregate_authorization/.terrahub.yml +++ b/components/landing_zone_config_aggregate_authorization/.terrahub.yml @@ -22,7 +22,11 @@ component: split("|", local.elements_landing_zone_config_configuration_aggregator_map["config_${count.index}"]["regions"]) tags: >- - local.elements_landing_zone_config_configuration_aggregator_tags_map["config_${count.index}"] + merge(local.elements_landing_zone_config_configuration_aggregator_tags_map["config_${count.index}"], + map("LzHash", sha1("${tfvar.terrahub["project"]["code"]} + ${tfvar.terrahub["component"]["name"]} + ${tfvar.terrahub["landing_zone_providers"]["0"]} + ${local.elements_landing_zone_config_configuration_aggregator_map["config_${count.index}"]["name"]}"))) output: arns: value: >- @@ -31,5 +35,6 @@ component: value: >- { for config_configuration_aggregator in aws_config_configuration_aggregator.landing_zone_config_configuration_aggregator.*: - config_configuration_aggregator.tags["Name"] => + lookup(config_configuration_aggregator.tags, "LzHash", + config_configuration_aggregator.arn) => config_configuration_aggregator.arn } diff --git a/components/landing_zone_config_config_rule/.terrahub.yml b/components/landing_zone_config_config_rule/.terrahub.yml index f84a5f3..cf2411d 100644 --- a/components/landing_zone_config_config_rule/.terrahub.yml +++ b/components/landing_zone_config_config_rule/.terrahub.yml @@ -22,7 +22,11 @@ component: source_identifier: >- local.elements_landing_zone_config_config_rule_map["config_${count.index}"]["source_identifier"] tags: >- - local.elements_landing_zone_config_config_rule_tags_map["config_${count.index}"] + merge(local.elements_landing_zone_config_config_rule_tags_map["config_${count.index}"], + map("LzHash", sha1("${tfvar.terrahub["project"]["code"]} + ${tfvar.terrahub["component"]["name"]} + ${tfvar.terrahub["landing_zone_providers"]["0"]} + ${local.elements_landing_zone_config_config_rule_map["config_${count.index}"]["name"]}"))) output: arns: value: aws_config_config_rule.landing_zone_config_config_rule.*.arn @@ -32,9 +36,11 @@ component: value: >- { for config_config_rule in aws_config_config_rule.landing_zone_config_config_rule.*: - config_config_rule.tags["Name"] => config_config_rule.arn } + lookup(config_config_rule.tags, "LzHash", config_config_rule.arn) => + config_config_rule.arn } landing_zone_config_config_rule_rule_ids: value: >- { for config_config_rule in aws_config_config_rule.landing_zone_config_config_rule.*: - config_config_rule.tags["Name"] => config_config_rule.rule_id } + lookup(config_config_rule.tags, "LzHash", config_config_rule.arn) => + config_config_rule.rule_id } diff --git a/components/landing_zone_config_configuration_aggregator/.terrahub.yml b/components/landing_zone_config_configuration_aggregator/.terrahub.yml index 842e7df..df1aadb 100644 --- a/components/landing_zone_config_configuration_aggregator/.terrahub.yml +++ b/components/landing_zone_config_configuration_aggregator/.terrahub.yml @@ -13,7 +13,10 @@ component: account_id: 'var.${tfvar.terrahub["landing_zone_providers"]["0"]}_account_id' region: 'var.${tfvar.terrahub["landing_zone_providers"]["0"]}_region' tags: >- - local.elements_config_aggregate_authorization_tags_map["config_${count.index}"] + merge(local.elements_config_aggregate_authorization_tags_map["config_${count.index}"], + map("LzHash", sha1("${tfvar.terrahub["project"]["code"]} + ${tfvar.terrahub["component"]["name"]} + ${tfvar.terrahub["landing_zone_providers"]["0"]} ${count.index}"))) output: arns: value: >- @@ -22,5 +25,6 @@ component: value: >- { for config_aggregate_authorization in aws_config_aggregate_authorization.landing_zone_config_aggregate_authorization.*: - config_aggregate_authorization.tags["Name"] => + lookup(config_aggregate_authorization.tags, "LzHash", + config_aggregate_authorization.id) => config_aggregate_authorization.arn } diff --git a/components/landing_zone_eip/.terrahub.yml b/components/landing_zone_eip/.terrahub.yml index fcc385b..c3e9687 100644 --- a/components/landing_zone_eip/.terrahub.yml +++ b/components/landing_zone_eip/.terrahub.yml @@ -12,7 +12,11 @@ component: provider: 'aws.${tfvar.terrahub["landing_zone_providers"]["0"]}' count: >- length(var.${tfvar.terrahub["landing_zone_providers"]["0"]}_provider["landing_zone_eip_resource"]) - tags: 'local.elements_landing_zone_eip_tags_map["config_${count.index}"]' + tags: >- + merge(local.elements_landing_zone_eip_tags_map["config_${count.index}"], + map("LzHash", sha1("${tfvar.terrahub["project"]["code"]} + ${tfvar.terrahub["component"]["name"]} + ${tfvar.terrahub["landing_zone_providers"]["0"]} ${count.index}"))) vpc: 'local.elements_landing_zone_eip_map["config_${count.index}"]["vpc"]' output: ids: @@ -22,8 +26,10 @@ component: public_ips: value: aws_eip.landing_zone_eip.*.public_ip landing_zone_eip_ids: - value: '{ for eip in aws_eip.landing_zone_eip.*: eip.tags["Name"] => eip.id }' + value: >- + { for eip in aws_eip.landing_zone_eip.*: lookup(eip.tags, "LzHash", + eip.id) => eip.id } landing_zone_eip_public_ips: value: >- - { for eip in aws_eip.landing_zone_eip.*: eip.tags["Name"] => - eip.public_ip } + { for eip in aws_eip.landing_zone_eip.*: lookup(eip.tags, "LzHash", + eip.id) => eip.public_ip } diff --git a/components/landing_zone_gateway_cgw/.terrahub.yml b/components/landing_zone_gateway_cgw/.terrahub.yml index f9d35bc..ffec1b6 100644 --- a/components/landing_zone_gateway_cgw/.terrahub.yml +++ b/components/landing_zone_gateway_cgw/.terrahub.yml @@ -21,7 +21,10 @@ component: type: >- local.elements_landing_zone_gateway_cgw_map["config_${count.index}"]["type"] tags: >- - local.elements_landing_zone_gateway_cgw_tags_map["config_${count.index}"] + merge(local.elements_landing_zone_gateway_cgw_tags_map["config_${count.index}"], + map("LzHash", sha1("${tfvar.terrahub["project"]["code"]} + ${tfvar.terrahub["component"]["name"]} + ${tfvar.terrahub["landing_zone_providers"]["0"]} ${count.index}"))) output: ids: value: aws_customer_gateway.landing_zone_gateway_cgw.*.id @@ -30,4 +33,4 @@ component: landing_zone_gateway_cgw_ids: value: >- { for gateway_cgw in aws_customer_gateway.landing_zone_gateway_cgw.*: - gateway_cgw.tags["Name"] => gateway_cgw.id } + lookup(gateway_cgw.tags, "LzHash", gateway_cgw.id) => gateway_cgw.id } diff --git a/components/landing_zone_gateway_nat/.terrahub.yml b/components/landing_zone_gateway_nat/.terrahub.yml index 8471039..f2e64b5 100644 --- a/components/landing_zone_gateway_nat/.terrahub.yml +++ b/components/landing_zone_gateway_nat/.terrahub.yml @@ -45,7 +45,10 @@ component: allocation_id: 'element(data.aws_eip.eip_selected.*.id, count.index)' subnet_id: 'element(data.aws_subnet.subnet_selected.*.id, count.index)' tags: >- - local.elements_landing_zone_gateway_nat_tags_map["config_${count.index}"] + merge(local.elements_landing_zone_gateway_nat_tags_map["config_${count.index}"], + map("LzHash", sha1("${tfvar.terrahub["project"]["code"]} + ${tfvar.terrahub["component"]["name"]} + ${tfvar.terrahub["landing_zone_providers"]["0"]} ${count.index}"))) output: ids: value: aws_nat_gateway.landing_zone_gateway_nat.*.id @@ -56,8 +59,9 @@ component: landing_zone_gateway_nat_ids: value: >- { for gateway_nat in aws_nat_gateway.landing_zone_gateway_nat.*: - gateway_nat.tags["Name"] => gateway_nat.id } + lookup(gateway_nat.tags, "LzHash", gateway_nat.id) => gateway_nat.id } landing_zone_gateway_nat_network_interface_ids: value: >- { for gateway_nat in aws_nat_gateway.landing_zone_gateway_nat.*: - gateway_nat.tags["Name"] => gateway_nat.network_interface_id } + lookup(gateway_nat.tags, "LzHash", gateway_nat.id) => + gateway_nat.network_interface_id } diff --git a/components/landing_zone_gateway_tgw/.terrahub.yml b/components/landing_zone_gateway_tgw/.terrahub.yml index 786e3fa..1f6b9a4 100644 --- a/components/landing_zone_gateway_tgw/.terrahub.yml +++ b/components/landing_zone_gateway_tgw/.terrahub.yml @@ -29,7 +29,10 @@ component: vpn_ecmp_support: >- local.elements_landing_zone_gateway_tgw_map["config_${count.index}"]["vpn_ecmp_support"] tags: >- - local.elements_landing_zone_gateway_tgw_tags_map["config_${count.index}"] + merge(local.elements_landing_zone_gateway_tgw_tags_map["config_${count.index}"], + map("LzHash", sha1("${tfvar.terrahub["project"]["code"]} + ${tfvar.terrahub["component"]["name"]} + ${tfvar.terrahub["landing_zone_providers"]["0"]} ${count.index}"))) output: ids: value: aws_ec2_transit_gateway.landing_zone_gateway_tgw.*.id @@ -39,4 +42,4 @@ component: value: >- { for gateway_tgw in aws_ec2_transit_gateway.landing_zone_gateway_tgw.*: - gateway_tgw.tags["Name"] => gateway_tgw.id } + lookup(gateway_tgw.tags, "LzHash", gateway_tgw.id) => gateway_tgw.id } diff --git a/components/landing_zone_gateway_vgw/.terrahub.yml b/components/landing_zone_gateway_vgw/.terrahub.yml index 4dedad9..beac165 100644 --- a/components/landing_zone_gateway_vgw/.terrahub.yml +++ b/components/landing_zone_gateway_vgw/.terrahub.yml @@ -28,7 +28,10 @@ component: availability_zone: >- local.elements_landing_zone_gateway_vgw_map["config_${count.index}"]["availability_zone"] tags: >- - local.elements_landing_zone_gateway_vgw_tags_map["config_${count.index}"] + merge(local.elements_landing_zone_gateway_vgw_tags_map["config_${count.index}"], + map("LzHash", sha1("${tfvar.terrahub["project"]["code"]} + ${tfvar.terrahub["component"]["name"]} + ${tfvar.terrahub["landing_zone_providers"]["0"]} ${count.index}"))) output: ids: value: aws_vpn_gateway.landing_zone_gateway_vgw.*.id @@ -37,4 +40,4 @@ component: landing_zone_gateway_vgw_ids: value: >- { for gateway_vgw in aws_vpn_gateway.landing_zone_gateway_vgw.*: - gateway_vgw.tags["Name"] => gateway_vgw.id } + lookup(gateway_vgw.tags, "LzHash", gateway_vgw.id) => gateway_vgw.id } diff --git a/components/landing_zone_network_acl/.terrahub.yml b/components/landing_zone_network_acl/.terrahub.yml index 9ab6ec0..f68806f 100644 --- a/components/landing_zone_network_acl/.terrahub.yml +++ b/components/landing_zone_network_acl/.terrahub.yml @@ -39,7 +39,10 @@ component: length(var.${tfvar.terrahub["landing_zone_providers"]["0"]}_provider["landing_zone_network_acl_resource"]) vpc_id: 'element(data.aws_vpc.vpc_selected.*.id, count.index)' tags: >- - local.elements_landing_zone_network_acl_tags_map["config_${count.index}"] + merge(local.elements_landing_zone_network_acl_tags_map["config_${count.index}"], + map("LzHash", sha1("${tfvar.terrahub["project"]["code"]} + ${tfvar.terrahub["component"]["name"]} + ${tfvar.terrahub["landing_zone_providers"]["0"]} ${count.index}"))) subnet_ids: >- slice(data.aws_subnet.subnet_selected.*.id, local.elements_landing_zone_network_acl_map["config_${count.index}"]["subnets_from_index"], @@ -52,4 +55,4 @@ component: landing_zone_network_acl_ids: value: >- { for network_acl in aws_network_acl.landing_zone_network_acl.*: - network_acl.tags["Name"] => network_acl.id } + lookup(network_acl.tags, "LzHash", network_acl.id) => network_acl.id } diff --git a/components/landing_zone_route/.terrahub.yml b/components/landing_zone_route/.terrahub.yml index fddc06d..1a8d540 100644 --- a/components/landing_zone_route/.terrahub.yml +++ b/components/landing_zone_route/.terrahub.yml @@ -25,10 +25,10 @@ component: length(var.${tfvar.terrahub["landing_zone_providers"]["0"]}_provider["landing_zone_route_table_data"]) vpc_id: 'element(data.aws_vpc.vpc_selected.*.id, count.index)' filter: - name: 'tag:Name' + name: 'tag:LzHash' values: - >- - local.elements_landing_zone_route_table_data_map["config_${count.index}"]["name"] + local.elements_landing_zone_route_table_data_map["config_${count.index}"]["LzHash"] resource: aws_route: landing_zone_route: diff --git a/components/landing_zone_route_nat/.terrahub.yml b/components/landing_zone_route_nat/.terrahub.yml index 62456c9..7deb8d5 100644 --- a/components/landing_zone_route_nat/.terrahub.yml +++ b/components/landing_zone_route_nat/.terrahub.yml @@ -33,7 +33,7 @@ component: - >- local.elements_landing_zone_route_table_data_map["config_${count.index}"]["LzHash"] aws_nat_gateway: - aws_nat_gateway: + aws_nat_gateway_selected: provider: 'aws.${tfvar.terrahub["landing_zone_providers"]["0"]}' count: >- length(var.${tfvar.terrahub["landing_zone_providers"]["0"]}_provider["landing_zone_gateway_nat_data"]) @@ -53,7 +53,7 @@ component: destination_cidr_block: >- local.elements_landing_zone_route_nat_map["config_${count.index}"]["destination_cidr_block"] nat_gateway_id: >- - element(distinct(data.aws_nat_gateway.aws_nat_gateway.*.id), + element(data.aws_nat_gateway.aws_nat_gateway_selected.*.id, count.index) output: ids: diff --git a/components/landing_zone_route_table_association/.terrahub.yml b/components/landing_zone_route_table_association/.terrahub.yml index f0399a7..da7ff76 100644 --- a/components/landing_zone_route_table_association/.terrahub.yml +++ b/components/landing_zone_route_table_association/.terrahub.yml @@ -34,10 +34,10 @@ component: length(var.${tfvar.terrahub["landing_zone_providers"]["0"]}_provider["landing_zone_route_table_data"]) vpc_id: 'element(data.aws_vpc.vpc_selected.*.id, count.index)' filter: - - name: 'tag:Name' + - name: 'tag:LzHash' values: - >- - local.elements_landing_zone_route_table_data_map["config_${count.index}"]["filter_tag_name"] + local.elements_landing_zone_route_table_data_map["config_${count.index}"]["LzHash"] - name: association.main values: - >- diff --git a/components/landing_zone_route_table_tgw/.terrahub.yml b/components/landing_zone_route_table_tgw/.terrahub.yml index 99c7e8b..1f544be 100644 --- a/components/landing_zone_route_table_tgw/.terrahub.yml +++ b/components/landing_zone_route_table_tgw/.terrahub.yml @@ -29,7 +29,10 @@ component: element(data.aws_ec2_transit_gateway.gateway_tgw_selected.*.id, count.index) tags: >- - local.elements_landing_zone_route_table_tgw_tags_map["config_${count.index}"] + merge(local.elements_landing_zone_route_table_tgw_tags_map["config_${count.index}"], + map("LzHash", sha1("${tfvar.terrahub["project"]["code"]} + ${tfvar.terrahub["component"]["name"]} + ${tfvar.terrahub["landing_zone_providers"]["0"]} ${count.index}"))) output: ids: value: aws_route_table.landing_zone_route_table_tgw.*.id @@ -39,4 +42,5 @@ component: value: >- { for route_table_tgw in aws_route_table.landing_zone_route_table_tgw.*: - route_table_tgw.tags["Name"] => route_table_tgw.id } + lookup(route_table_tgw.tags, "LzHash", route_table_tgw.id) => + route_table_tgw.id } diff --git a/components/landing_zone_route_vgw/.terrahub.yml b/components/landing_zone_route_vgw/.terrahub.yml index 9b7db60..fda33da 100644 --- a/components/landing_zone_route_vgw/.terrahub.yml +++ b/components/landing_zone_route_vgw/.terrahub.yml @@ -28,10 +28,10 @@ component: length(var.${tfvar.terrahub["landing_zone_providers"]["0"]}_provider["landing_zone_route_table_data"]) vpc_id: 'element(data.aws_vpc.vpc_selected.*.id, count.index)' filter: - name: 'tag:Name' + name: 'tag:LzHash' values: - >- - local.elements_landing_zone_route_table_data_map["config_${count.index}"]["name"] + local.elements_landing_zone_route_table_data_map["config_${count.index}"]["LzHash"] aws_vpn_gateway: aws_vpn_gateway: provider: 'aws.${tfvar.terrahub["landing_zone_providers"]["0"]}' @@ -39,10 +39,10 @@ component: length(var.${tfvar.terrahub["landing_zone_providers"]["0"]}_provider["landing_zone_gateway_vgw_data"]) attached_vpc_id: 'element(data.aws_vpc.vpc_selected.*.id, count.index)' filter: - - name: 'tag:Name' + - name: 'tag:LzHash' values: - >- - local.elements_landing_zone_gateway_vgw_data_map["config_${count.index}"]["name"] + local.elements_landing_zone_gateway_vgw_data_map["config_${count.index}"]["LzHash"] resource: aws_route: landing_zone_route_vgw: diff --git a/components/landing_zone_secretsmanager_secret/.terrahub.yml b/components/landing_zone_secretsmanager_secret/.terrahub.yml index 440a54a..f206283 100644 --- a/components/landing_zone_secretsmanager_secret/.terrahub.yml +++ b/components/landing_zone_secretsmanager_secret/.terrahub.yml @@ -19,7 +19,11 @@ component: recovery_window_in_days: >- local.elements_landing_zone_secretsmanager_secret_map["config_${count.index}"]["recovery_window_in_days"] tags: >- - local.elements_landing_zone_secretsmanager_secret_tags_map["config_${count.index}"] + merge(local.elements_landing_zone_secretsmanager_secret_tags_map["config_${count.index}"], + map("LzHash", sha1("${tfvar.terrahub["project"]["code"]} + ${tfvar.terrahub["component"]["name"]} + ${tfvar.terrahub["landing_zone_providers"]["0"]} + ${local.elements_landing_zone_secretsmanager_secret_map["config_${count.index}"]["name"]}"))) output: ids: value: aws_secretsmanager_secret.landing_zone_secretsmanager_secret.*.id diff --git a/components/landing_zone_sns_topic/.terrahub.yml b/components/landing_zone_sns_topic/.terrahub.yml index ec5bda9..15e9a14 100644 --- a/components/landing_zone_sns_topic/.terrahub.yml +++ b/components/landing_zone_sns_topic/.terrahub.yml @@ -71,7 +71,11 @@ component: sqs_failure_feedback_role_arn: >- local.elements_landing_zone_sns_topic_map["config_${count.index}"]["sqs_failure_feedback_role_arn"] tags: >- - local.elements_landing_zone_sns_topic_tags_map["config_${count.index}"] + merge(local.elements_landing_zone_sns_topic_tags_map["config_${count.index}"], + map("LzHash", sha1("${tfvar.terrahub["project"]["code"]} + ${tfvar.terrahub["component"]["name"]} + ${tfvar.terrahub["landing_zone_providers"]["0"]} + ${local.elements_landing_zone_sns_topic_map["config_${count.index}"]["name"]}"))) output: ids: value: aws_sns_topic.landing_zone_sns_topic.*.id diff --git a/components/landing_zone_ssm_activation/.terrahub.yml b/components/landing_zone_ssm_activation/.terrahub.yml index 672f382..322a414 100644 --- a/components/landing_zone_ssm_activation/.terrahub.yml +++ b/components/landing_zone_ssm_activation/.terrahub.yml @@ -24,7 +24,11 @@ component: registration_limit: >- local.elements_landing_zone_ssm_activation_map["config_${count.index}"]["registration_limit"] tags: >- - local.elements_landing_zone_ssm_activation_tags_map["config_${count.index}"] + merge(local.elements_landing_zone_ssm_activation_tags_map["config_${count.index}"], + map("LzHash", sha1("${tfvar.terrahub["project"]["code"]} + ${tfvar.terrahub["component"]["name"]} + ${tfvar.terrahub["landing_zone_providers"]["0"]} + ${local.elements_landing_zone_ssm_activation_map["config_${count.index}"]["name"]}"))) output: ids: value: aws_ssm_activation.landing_zone_ssm_activation.*.id diff --git a/components/landing_zone_ssm_association_by_instance_id/.terrahub.yml b/components/landing_zone_ssm_association_by_instance_id/.terrahub.yml index f6fc734..c8224a5 100644 --- a/components/landing_zone_ssm_association_by_instance_id/.terrahub.yml +++ b/components/landing_zone_ssm_association_by_instance_id/.terrahub.yml @@ -15,10 +15,10 @@ component: count: >- length(var.${tfvar.terrahub["landing_zone_providers"]["0"]}_provider["landing_zone_instance_data"]) filter: - name: 'tag:Name' + name: 'tag:LzHash' values: - >- - local.elements_landing_zone_instance_data_map["config_${count.index}"]["name"] + local.elements_landing_zone_instance_data_map["config_${count.index}"]["LzHash"] resource: aws_ssm_association: landing_zone_ssm_association_by_instance_id: diff --git a/components/landing_zone_ssm_document/.terrahub.yml b/components/landing_zone_ssm_document/.terrahub.yml index 9df777c..814e65c 100644 --- a/components/landing_zone_ssm_document/.terrahub.yml +++ b/components/landing_zone_ssm_document/.terrahub.yml @@ -26,7 +26,11 @@ component: account_ids: >- local.elements_landing_zone_ssm_document_map["config_${count.index}"]["permissions_account_ids"] tags: >- - local.elements_landing_zone_ssm_document_tags_map["config_${count.index}"] + merge(local.elements_landing_zone_ssm_document_tags_map["config_${count.index}"], + map("LzHash", sha1("${tfvar.terrahub["project"]["code"]} + ${tfvar.terrahub["component"]["name"]} + ${tfvar.terrahub["landing_zone_providers"]["0"]} + ${local.elements_landing_zone_ssm_document_map["config_${count.index}"]["name"]}"))) output: created_dates: value: aws_ssm_document.landing_zone_ssm_document.*.created_date @@ -53,8 +57,10 @@ component: landing_zone_ssm_document_created_dates: value: >- { for ssm_document in aws_ssm_document.landing_zone_ssm_document.*: - ssm_document.tags["Name"] => ssm_document.created_date } + lookup(ssm_document.tags, "LzHash", ssm_document.hash) => + ssm_document.created_date } landing_zone_ssm_document_hashes: value: >- { for ssm_document in aws_ssm_document.landing_zone_ssm_document.*: - ssm_document.tags["Name"] => ssm_document.hash } + lookup(ssm_document.tags, "LzHash", ssm_document.hash) => + ssm_document.hash } diff --git a/components/landing_zone_ssm_maintenance_window/.terrahub.yml b/components/landing_zone_ssm_maintenance_window/.terrahub.yml index 38ec212..1c38c8c 100644 --- a/components/landing_zone_ssm_maintenance_window/.terrahub.yml +++ b/components/landing_zone_ssm_maintenance_window/.terrahub.yml @@ -31,7 +31,11 @@ component: start_date: >- local.elements_landing_zone_ssm_maintenance_window_map["config_${count.index}"]["start_date"] tags: >- - local.elements_landing_zone_ssm_maintenance_window_tags_map["config_${count.index}"] + merge(local.elements_landing_zone_ssm_maintenance_window_tags_map["config_${count.index}"], + map("LzHash", sha1("${tfvar.terrahub["project"]["code"]} + ${tfvar.terrahub["component"]["name"]} + ${tfvar.terrahub["landing_zone_providers"]["0"]} + ${local.elements_landing_zone_ssm_maintenance_window_map["config_${count.index}"]["name"]}"))) output: ids: value: aws_ssm_maintenance_window.landing_zone_ssm_maintenance_window.*.id @@ -41,4 +45,5 @@ component: value: >- { for ssm_maintenance_window in aws_ssm_maintenance_window.landing_zone_ssm_maintenance_window.*: - ssm_maintenance_window.tags["Name"] => ssm_maintenance_window.id } + lookup(ssm_maintenance_window.tags, "LzHash", + ssm_maintenance_window.id) => ssm_maintenance_window.id } diff --git a/components/landing_zone_ssm_parameter/.terrahub.yml b/components/landing_zone_ssm_parameter/.terrahub.yml index 44eab51..810e7b8 100644 --- a/components/landing_zone_ssm_parameter/.terrahub.yml +++ b/components/landing_zone_ssm_parameter/.terrahub.yml @@ -29,7 +29,11 @@ component: allowed_pattern: >- local.elements_landing_zone_ssm_parameter_map["config_${count.index}"]["allowed_pattern"] tags: >- - local.elements_landing_zone_ssm_parameter_tags_map["config_${count.index}"] + merge(local.elements_landing_zone_ssm_parameter_tags_map["config_${count.index}"], + map("LzHash", sha1("${tfvar.terrahub["project"]["code"]} + ${tfvar.terrahub["component"]["name"]} + ${tfvar.terrahub["landing_zone_providers"]["0"]} + ${local.elements_landing_zone_ssm_parameter_map["config_${count.index}"]["name"]}"))) output: arns: value: aws_ssm_parameter.landing_zone_ssm_parameter.*.arn diff --git a/components/landing_zone_ssm_patch_baseline/.terrahub.yml b/components/landing_zone_ssm_patch_baseline/.terrahub.yml index 12339ce..2cb134d 100644 --- a/components/landing_zone_ssm_patch_baseline/.terrahub.yml +++ b/components/landing_zone_ssm_patch_baseline/.terrahub.yml @@ -46,7 +46,11 @@ component: enable_non_security: >- local.elements_landing_zone_ssm_patch_baseline_map["config_${count.index}"]["enable_non_security_1"] tags: >- - local.elements_landing_zone_ssm_patch_baseline_tags_map["config_${count.index}"] + merge(local.elements_landing_zone_ssm_patch_baseline_tags_map["config_${count.index}"], + map("LzHash", sha1("${tfvar.terrahub["project"]["code"]} + ${tfvar.terrahub["component"]["name"]} + ${tfvar.terrahub["landing_zone_providers"]["0"]} + ${local.elements_landing_zone_ssm_patch_baseline_map["config_${count.index}"]["name"]}"))) output: ids: value: aws_ssm_patch_baseline.landing_zone_ssm_patch_baseline.*.id @@ -54,4 +58,5 @@ component: value: >- { for ssm_patch_baseline in aws_ssm_patch_baseline.landing_zone_ssm_patch_baseline.*: - ssm_patch_baseline.name => ssm_patch_baseline.id } + lookup(ssm_patch_baseline.tags, "LzHash", ssm_patch_baseline.id) => + ssm_patch_baseline.id } diff --git a/components/landing_zone_tgw_route_table/.terrahub.yml b/components/landing_zone_tgw_route_table/.terrahub.yml index 4ebd2c1..e8de2bf 100644 --- a/components/landing_zone_tgw_route_table/.terrahub.yml +++ b/components/landing_zone_tgw_route_table/.terrahub.yml @@ -28,7 +28,11 @@ component: transit_gateway_id: >- element(data.aws_ec2_transit_gateway.gateway_tgw_selected.*.id, count.index) - tags: 'local.elements_landing_zone_route_table_map["config_${count.index}"]' + tags: >- + merge(local.elements_landing_zone_route_table_map["config_${count.index}"], + map("LzHash", sha1("${tfvar.terrahub["project"]["code"]} + ${tfvar.terrahub["component"]["name"]} + ${tfvar.terrahub["landing_zone_providers"]["0"]} ${count.index}"))) output: ids: value: aws_ec2_transit_gateway_route_table.landing_zone_tgw_route_table.*.id @@ -38,4 +42,5 @@ component: value: >- { for tgw_route_table in aws_ec2_transit_gateway_route_table.landing_zone_tgw_route_table.*: - tgw_route_table.tags["Name"] => tgw_route_table.id } + lookup(tgw_route_table.tags, "LzHash", tgw_route_table.id) => + tgw_route_table.id } diff --git a/components/landing_zone_tgw_vpc_attachment/.terrahub.yml b/components/landing_zone_tgw_vpc_attachment/.terrahub.yml index 588a5b3..98f5762 100644 --- a/components/landing_zone_tgw_vpc_attachment/.terrahub.yml +++ b/components/landing_zone_tgw_vpc_attachment/.terrahub.yml @@ -60,7 +60,11 @@ component: local.elements_landing_zone_tgw_map["config_${count.index}"]["dns_support"] ipv6_support: >- local.elements_landing_zone_tgw_map["config_${count.index}"]["ipv6_support"] - tags: 'local.elements_landing_zone_tgw_tags_map["config_${count.index}"]' + tags: >- + merge(local.elements_landing_zone_tgw_tags_map["config_${count.index}"], + map("LzHash", sha1("${tfvar.terrahub["project"]["code"]} + ${tfvar.terrahub["component"]["name"]} + ${tfvar.terrahub["landing_zone_providers"]["0"]} ${count.index}"))) transit_gateway_default_route_table_association: >- local.elements_landing_zone_tgw_map["config_${count.index}"]["transit_gateway_default_route_table_association"] transit_gateway_default_route_table_propagation: >- @@ -76,4 +80,5 @@ component: value: >- { for tgw_vpc_attachment in aws_ec2_transit_gateway_vpc_attachment.landing_zone_tgw_vpc_attachment.*: - tgw_vpc_attachment.tags["Name"] => tgw_vpc_attachment.id } + lookup(tgw_vpc_attachment.tags, "LzHash", tgw_vpc_attachment.id) => + tgw_vpc_attachment.id } diff --git a/components/landing_zone_tgw_vpc_attachment_accepter/.terrahub.yml b/components/landing_zone_tgw_vpc_attachment_accepter/.terrahub.yml index 20927a6..b78dfa6 100644 --- a/components/landing_zone_tgw_vpc_attachment_accepter/.terrahub.yml +++ b/components/landing_zone_tgw_vpc_attachment_accepter/.terrahub.yml @@ -35,7 +35,11 @@ component: transit_gateway_attachment_id: >- element(data.aws_ec2_transit_gateway_vpc_attachment.tgw_vpc_selected.*.id, count.index) - tags: 'local.elements_landing_zone_tgw_tags_map["config_${count.index}"]' + tags: >- + merge(local.elements_landing_zone_tgw_tags_map["config_${count.index}"], + map("LzHash", sha1("${tfvar.terrahub["project"]["code"]} + ${tfvar.terrahub["component"]["name"]} + ${tfvar.terrahub["landing_zone_providers"]["0"]} ${count.index}"))) transit_gateway_default_route_table_association: >- local.elements_landing_zone_tgw_map["config_${count.index}"]["transit_gateway_default_route_table_association"] transit_gateway_default_route_table_propagation: >- @@ -51,5 +55,5 @@ component: value: >- { for tgw_vpc_attachment_accepter in aws_ec2_transit_gateway_vpc_attachment_accepter.landing_zone_tgw_vpc_attachment_accepter.*: - tgw_vpc_attachment_accepter.tags["Name"] => - tgw_vpc_attachment_accepter.id } + lookup(tgw_vpc_attachment_accepter.tags, "LzHash", + tgw_vpc_attachment_accepter.id) => tgw_vpc_attachment_accepter.id } diff --git a/components/landing_zone_vpc_endpoint_gateway/.terrahub.yml b/components/landing_zone_vpc_endpoint_gateway/.terrahub.yml index ec19dd7..c40df17 100644 --- a/components/landing_zone_vpc_endpoint_gateway/.terrahub.yml +++ b/components/landing_zone_vpc_endpoint_gateway/.terrahub.yml @@ -64,5 +64,5 @@ component: value: >- { for vpc_endpoint_gateway in aws_vpc_endpoint.landing_zone_vpc_endpoint_gateway.*: - lookup(vpc_endpoint_gateway.tags, "LzHash", vpc_endpoint_gateway.id) => - vpc_endpoint_gateway.id } + lookup(vpc_endpoint_gateway.tags, "LzHash", vpc_endpoint_gateway.id) + => vpc_endpoint_gateway.id }