Link Search Menu Expand Document

Best Practices

  1. Terraform modules, incl. root modules, hold following files
    • versions.tf - contains the terraform block with the attributes required_version and required_providers
    • main.tf - contains the module code
    • variables.tf - contains all module variables
    • outputs.tf - contains all output objects
    • README.md - Contains at least a short description of the module, examples of usage and the description of the module generated by terraform-docs
  2. Terraform root modules hold following files
    • backend.tf - contains the terraform backend configuration (could be generated by terragrunt)
    • provider.tf - contains the configurations of the individual providers (could be generated by terragrunt)
    • versions.tf - contains the terraform block with the attributes required_version and required_providers
    • main.tf - contains the module code
    • variables.tf - contains all module variables
    • outputs.tf - contains all output objects
  3. Terraform resource names are written in snake_case
  4. Variables are always defined with type and description
  5. Outputs are always defined with value and description
  6. Terraform version and plugin versions are pinned to specific version and specifically updated