Test-Driven Development (TDD) for Infrastructure

Learn how to adapt TDD to deploying and configuring infrastructure.


Test-driven development (TDD) is a method for developing software where the tests are written before the application code. The functional code of the application is the written and modified until the tests pass. This ensures new software is relatively stable from the outset and encourages developers to only write code that is absolutely necessary. The code is cleaner and tests can also be used to help write documentation in parallel with development.

What if operators—the developers of infrastructure code—could also use TDD to make sure they had a clean infrastructure pool with nothing uneccessary provisioned? That's what HashiCorp developer advocate Rosemary Wang will demonstrate in this O'Reilly Velocity session.

You will learn

  • The benefits to writing infrastructure tests before provisioning and implementation
  • How TDD can be adapted to deploying and configuring infrastructure
  • Details on how different infrastructure resources could change how you approach TDD
  • What the limits are when applying TDD to infrastructure, and dives into some
  • How TDD for infrastructure can help address security concerns


  • Experience implementing infrastructure as code
  • Knowledge of cloud native infrastructure, testing, and types of testing

Additional resources

More resources like this one

  • 3/15/2023
  • Presentation

Advanced Terraform techniques

  • 2/3/2023
  • Case Study

Automating Multi-Cloud, Multi-Region Vault for Teams and Landing Zones

  • 2/1/2023
  • Case Study

Should My Team Really Need to Know Terraform?

  • 1/20/2023
  • Case Study

Packaging security in Terraform modules