nested-maps

benniemosher/nested-maps/terraform

Terraform Module HCL TERRAFORM

A small Terraform module to build a nested map for for_each resource declarations

Install
module "nested-maps" {
source = "benniemosher/nested-maps/terraform"
version = "0.0.1"
}
plain text: /constructs/tfmod-benniemosher-nested-maps-terraform/install.txt
⭐ Source on GitHub 📦 Registry page
README

terraform-nested-maps A small Terraform module to build a nested map to use withfor_each resource declarations. I wanted to condence 100+ lines of remote data sources to pull in resources, and I wanted to utilize the new for_each feature. This could easily go in one file and not be a module, but this allows me to use the same method for things like vpc_peering_connections. I wanted to use this module method because it now gives me really neat names like aws_security_group.this['cms-dev']. This makes it pretty easy to move and refactor these as they still have the same name: ``bash tf plan > plan.tfplan cat plan.tfplan | grep "destroyed" # creates output like data.aws_security_group.cms-dev cat plan.tfplan | grep "created" # creates output like data.aws_security_group.this["cms-dev"] ` You

Inputs (2)
NameTypeDescriptionDefault
mapmap(string)A map of resource names and element names required
replacemap(object({ string_find A map of information for string replacement required
Outputs (1)
map — A map to use in a for_each loop
Details
FrameworkTerraform Module
LanguageHCL
Version0.0.1
Cloud TERRAFORM
★ Stars3
Forks1
Total downloads780
Inputs2
Outputs1
LicenseMIT
Namespacebenniemosher
Updated