Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
T

tdd-infrastructure

> 编程语言
Open source

Some examples of Test-Driven Development for Infrastructure

199 stars0 likes0 views
WebsiteGitHub

About

Some examples of Test-Driven Development for Infrastructure

tdd-infrastructure

Examples for Test-Driven Development (TDD) of infrastructure.

Each directory has its own README and Makefile documenting how to run the tests and build the infrastructure associated with the example.

  • tf-aws-ec2: A TDD example created for 2019 O'Reilly Velocity
  • tf-aws-s3: A TDD example created for this blog post
  • tf-azure-network: A TDD example create for the Perth Hashicorp User Group

Refer to the Makefile in each directory for how to build the tests.

Useful References

Test-Driven Development

Generally, you can write your own testing framework with any language, focusing on testing the state or definition of infrastructure. For unit or contract (state) testing, tests will involve checking JSON or YAML configuration. Most infrastructure as code frameworks will already have acceptance tests to ensure the infrastructure resources are created properly.

  • Introduction to Test-Driven Development

Server Testing Tools

  • Goss
  • Inspec
  • Test-Kitchen
    • kitchen-ec2

Terraform Specific

Unit / Contract Testing

Below are frameworks that check for configuration that might lead to upstream problems (not caught by Terraform plan). For example, database username must be 16 characters.

  • terraform-linters/tflint

The tools below are mostly presented as policy as code frameworks but can be used for unit or contract (state) testing infrastructure.

  • instrumenta/conftest
  • Open Policy Agent
  • Terraform Sentinel (not OSS)

BDD Frameworks

Thanks to @petems for discovering these!

  • xchapter7x/clarity
  • eerkunt/terraform-compliance
  • elmundio87/terraform-validate

End-to-End Frameworks

These are frameworks that create the infrastructure, execute a set of tests, and (optionally) destroys the infrastructure.

  • gruntwork-io/terratest
  • newcontext-oss/kitchen-terraform

Policy as Code (with Security Scanning)

Some of these frameworks include built-in policies for various providers, others must be extended.

Built-In Policies
  • liamg/tfsec
  • accurics/terrascan
  • bridgecrew/checkov
  • Terraform Sentinel (not OSS)
  • fugue/regula: policies you can run via Open Policy Agent
  • Forseti Terraform-Validator (not OSS)
Write Your Own
  • instrumenta/conftest
  • Open Policy Agent
  • Terraform Sentinel (not OSS)

Infrastructure Mocking

Use with caution. Mocks aren't always updated with latest API or configuration.

  • localstack for AWS
  • GCP Emulator: emulates specific services on GCP. Mostly for application-related use.

Kubernetes

  • vmware-tanzu/sonobuoy
  • Open Policy Agent
  • Helm unittest
  • Helm test

Issues· 0 open

View all issuesOpen on GitHub

No open issues yet, or sync has not completed.

> Tags

Ruby

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedSep 18, 2026
Category编程语言
PricingOpen source

> Related tools

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言