DEV Community

Discussion on: Best way to make infrastructure by Terraform

iilness2 profile image
  1. What could be the best practice to set up terraform structure? For me, structure will give others who see your code a better understanding of the way you thinking when trying to solve the problem. So if you shared this project with your team/others, clearer is better.

One of my favorite of the terraform Structure is from Charity. She create the article here:

the way how she explains the problem, the process, the way how she looks at that article gives me some idea of how I create Terraform projects.

  1. Dividing modules into specific submodules is recommended?
    Depends on how big your projects and how granular you want. If you only work for small services/small projects maybe not too much submodule will be better. Since too much modules/submodules will be more hard maintaining it later

  2. Is it good to use terraform for invoking Lambda or serverless is the better solution?
    Depends again. If your terraform is part of big projects for maintaining your whole environments, I think it a bit of risk if you want to use terraform for invoke Lambda. Since one error/problem will risk your state.