hey folks. first time poster here on the forum. i’m trying to figure out how to apply some sort of broad stroke build flags on my terraform builds. right now i have 2 separate folders of terraform: one for setting up a provisioning environment for building with packer (creates some iam stuff that i can then attach to packer as it builds amis), and then a much larger environment build of the vpc, nodes, dbs, etc etc. after i build the provisioning environment, i need to then copy that iam.tf file into the environment build folder, so that it keeps the iam roles intact when i build the rest of the environment. but copying the file seems weird. cleaner code would be to reuse the same file and enable runtime flags.
so i started out with using basic boolean vars to trigger whether certain portions of my environment would build (using the resource count attribute), but i’d like to somehow use tags, or another namespace type of approach, for selectively provisioning certain elements of the environment build, so that i don’t need to use the count attribute and all the [index] syntax. that count attribute [index] syntax is just unnecessary when lots of things are single items. basically i just want to set a runtime var to true, and if it’s true, then certain portions of the environment build will be created, but without using the resource count attribute, it won’t create them.
took a look through all the docs, but couldn’t find anything to support this. maybe i’m blind, so posting this here to see if someone has a strategy that i haven’t learned yet.
thank you very much!