What are recommend style attributes in Terraform code?
July 23, 2024
Just a quick recap on Terraform code style attributes:
- The proper indentation in a Terraform file is two spaces rather than a tab.
- Block meta-arguments should go at the end of a resource definition.
- All single arguments should be together in a group followed by an empty line.
- Use blank lines for clarity and logical separations in the code. It helps to keep it more readable.
- Line up equals signs when appropriate. It makes a huge difference in readability.
The basic principal is to think about readability as you write and refactor your code.
Like this article?
1
Posted in: terraform