Skip to content
14 providers 54 configurations
Independent reseller · not affiliated with any provider Telegram

Infrastructure

Infrastructure as code for disposable environments

If rebuilding an environment is frightening, it is not an environment - it is a pet.

Infrastructure as code for disposable environments

The point of describing infrastructure in code is not elegance. It is that you can destroy an environment on Friday and have an identical one on Monday, which changes how freely a team can experiment.

What you gain

  • Environments that are identical by construction rather than by discipline.
  • A review process for infrastructure changes, in the same place as code review.
  • A record of why something exists, in the commit history.
  • The confidence to delete things, because recreating them is a command.
  • Onboarding that means reading a repository rather than interviewing a colleague.

Structure it for reuse

  1. Write one module per logical component: network, database, service.
  2. Keep environment differences in variable files, not in duplicated code.
  3. Store state remotely, with locking, so two people cannot apply at once.
  4. Tag every resource with environment, owner and an expiry where relevant.
  5. Make destroy a first-class, tested operation, not a theoretical one.

The last point is the one teams skip. An environment that has never been destroyed and recreated is an environment you do not know you can rebuild.

Ephemeral environments per change

Once destroy works reliably, a pipeline can create an environment for each pull request, run the tests against it, and tear it down when the branch merges. Reviewers get a real URL instead of a description, and nothing accumulates.

Making per-change environments affordable
Technique Effect
Small instance sizes for review environments Cost proportional to purpose.
Shared managed database with per-branch schemas Avoids provisioning a database each time.
Automatic teardown on merge or after N days Nothing outlives its usefulness.
Seeded, anonymised fixture data Realistic without exposing real records.
A separate account for review environments Blast radius and billing both contained.

Start smaller than you think

You do not need to codify an existing estate before benefiting. Write the next new thing in code, then the one after. Importing legacy resources can happen gradually or never; the value arrives with the first environment you can confidently destroy.

Summary

Code the infrastructure, store the state properly, test destruction, and let the pipeline create environments on demand. The goal is not automation for its own sake; it is the freedom to throw things away.

Keep reading

More Cloud Insights

Next step

Find the account this article describes

Compare configurations by provider, with prices and full detail on every page.

Scroll to Top
Telegram