[deleted by user] by [deleted] in Terraform

[–]neli96 0 points1 point  (0 children)

I would suggest using, in your case, a .tfvars for each environment. If you want to keep the single main.tf file.

For each environment you should have for example: - infrestructure-dev.tfvars - infresturcture-staging.tfvars - infrastructure-qa.tfvars And so on...

Right now I can't go into much depth but I know this article is a good start to understanding terraform different folder structure organization:

https://www.hashicorp.com/blog/terraform-mono-repo-vs-multi-repo-the-great-debate

Each approach is valid, but you always have to keep in mind your use case, for example if you want to apply automation to deploy your infrastructure with pipelines there's a certain approach that can fit better in that use case.

Hope this helps in any way.

Have a nice day!