
InfraSpec
Test your AWS infrastructure code in plain English
InfraSpec is a CLI tool for testing your Terraform AWS infrastructure code in plain English. It combines a rich library of testing patterns with a domain-specific language for testing cloud infrastructure.
Tests are written using easy-to-learn Gherkin syntax, which is suitable for both technical and non-technical team members. This approach constrasts sharply with existing tools which require significant programming expertise.
Developers can optionally use InfraSpec Virtual Cloud to rapidly test against a high-fidelity AWS emulator, without worry about incurring AWS costs or cleaning up after themselves.
Features
- 🗣️ Plain English syntax. Write tests that read like sentences, not code. InfraSpec uses easy-to-learn Gherkin syntax for defining test steps
- 👥 Team-friendly. Non-technical stakeholders can read and even author tests, improving collaboration on infrastructure requirements
- 🚀 Minimal setup. No complex frameworks to integrate. InfraSpec works with your existing Terraform configurations and AWS resources.
- 📚 Rich Grammar Library. Comes with hundreds of built-in test steps (patterns) for common scenarios (e.g. resource existence, security settings, networking rules) so you don’t have to write low-level assertions
- ⚡️ Fast feedback. Catch infrastructure issues early, before they reach production, by running these tests in CI/CD or locally as part of your workflow.
Quick start
InfaSpec can be installed using Homebrew (preferred), downloaded as a pre-built binary, or built from source.
Homebrew
- Install InfraSpec using Homebrew:
brew tap robmorgan/infraspec
brew install infraspec- Initialize a repo containing your infrastructure code:
infraspec init # creates a ./features directory if it doesn't already exist- Create your first infrastructure test:
infraspec new dynamodb.feature- Run the tests
infraspec features/dynamodb.featureIf your using VS Code or Cursor, we recommend installing the Cucumber (Gherkin) Full Support extension for syntax highlighting.
Download prebuilt binaries
Currently, the following binaries are provided:
- Mac (Apple Silicon)
- Mac (x64)
- Linux (x86_64)
- Linux (aarch64)
- Windows (win32-x64)
- Windows (ia32)
You can download them directly from the GitHub releases page .
Building from Source
InfraSpec requires at least Go 1.24.4 to build from source.
To directly install, use:
go install github.com/robmorgan/infraspec@latestOtherwise:
git clone https://github.com/robmorgan/infraspec.git
go build ./cmd/infraspecCommunity
InfraSpec was created by Rob Morgan . Follow @_rjm_ on
Twitter for future project updates.
Feel free to join the discussions on GitHub !