Hello, I am new to terraform and I am trying to figure out the best way to set everything up before I get in too deep. I want my directory output to be something like this:
application
|
|
|–iam
| |
| |–iam.tf
| |–variables.tf
|
|–sg
| |
| |–sg.tf
| |–variables.tf
|
|–Group_1
| |
| |–g1_iam.tfvars
| |–g1_sg.tfvars
|
|–Group_2
|
|–g2_iam.tfvars
|–g2_sg.tfvars
My goal is to be in group 1 directory, and being able to run a terraform apply where terraform uses the iam.tf or the sg.tf depending on what I need to do. I would like to do this to keep any resulting files for group 1 within its folder and so on. So far I have made all of my main.tf files dynamic. I want to be able to use one tf file for all my different groups depending on the tf files purpose. How would I run a terraform so that I can run a terraform apply from group 1 folder with iam.tfvars using iam.tf?
If you all have any recommendations on directory structure feel free. I also have workspaces for the individual groups set up.
Thank you in advance, any help is appreciated.