Terraform

Modules

  • Start writing your configuration with a plan for modules.
  • Use local modules to organize and encapsulate your code.
  • Use the public Terraform Registry to find useful modules.

States

  • Backend

    • Instead of using version control, the best way to manage shared storage for state files is to use Terraform’s built-in support for remote backends.

    • A Terraform backend determines how Terraform loads and stores state.

    • The default backend is the local backend, which stores the state file on your local disk.

    • Caveats

      • In the case of AWS, because S3 bucket and DynamoDB table must be created beforehand, so it poses a chicken-and-egg problem. Separate bootstrap steps are required.
  • Workspace

Open Questions

  1. How to avoid provisioning duplicate resources?

Troubleshooting