Interview Prep/Terraform/Repository Structure, Environments and Module Strategy

How do you build preview (ephemeral) environments?

IntermediateProductionRepository Structure, Environments and Module Strategy
Answer

A pipeline creates a workspace or state key named after the PR (pr-123), applies a slim variant of the stack with auto-expire tags, comments the URL on the PR and runs destroy on PR close, plus a nightly janitor that deletes anything older than N days. Cost controls and quotas matter or leaks pile up.

All Terraform questions Roadmap: Terraform in production

More on Repository Structure, Environments and Module Strategy