Skip to content

robmorgan/infraspec

Repository files navigation

InfraSpec Logo
InfraSpec

✅ Test your Terraform AWS infrastructure in plain English, no code required.

About

Write tests for Terraform AWS infrastructure in plain English, without writing a single line of code. InfraSpec combines a vast library of common testing patterns with a domain-specific language for testing infrastructure.

Tests are written using easy to learn Gherkin syntax, which is suitable for both technical and non-technical team members.

Quick Start

Here's how easy it is to test a Terraform S3 bucket configuration:

Feature: S3 Bucket Creation
  As a DevOps Engineer
  I want to create an S3 bucket with guardrails
  So that I can store my data securely

  Scenario: Create an S3 bucket with a name
    Given I have a Terraform configuration in "./s3-bucket"
    And I set variable "bucket_name" to "my-bucket"
    When I run Terraform apply
    Then the S3 bucket "my-bucket" should exist
    And the S3 bucket "my-bucket" should have a versioning configuration
    And the S3 bucket "my-bucket" should have a public access block
    And the S3 bucket "my-bucket" should have a server access logging configuration
    And the S3 bucket "my-bucket" should have a encryption configuration

InfraSpec automatically translates your natural language specifications into executable infrastructure tests.

Warning

This project is still in heavy development and is likely to change!

✨ Features

  • 🗣️ Plain English syntax - Write tests that read like documentation.
  • 👥 Team-friendly - Non-technical stakeholders can contribute and review.
  • 🚀 Zero setup - Works with your existing Terraform AWS configurations.
  • 📚 Rich test library - Hundreds of pre-built testing patterns for common scenarios.
  • Fast feedback - Catch infrastructure issues before they reach production.

🔍 What can you test?

🏗️ Terraform

  • Resource configurations and relationships
  • Security policies and compliance
  • Cost optimization rules
  • Multi-environment consistency

☁️ AWS

  • DynamoDB tables
  • RDS DB instances
  • S3 bucket configurations

🌐 HTTP

  • HTTP(s) Endpoints
  • Form Data
  • File Uploads

🛠️ Getting Started

  1. Install InfraSpec using Homebrew:
brew tap robmorgan/infraspec
brew install infraspec

Or if you have Go installed, you can install InfraSpec using:

go install github.com/robmorgan/infraspec@latest
  1. Initialize a repo containing your infrastructure code:
infraspec init # creates a ./features directory if it doesn't already exist
  1. Create your first infrastructure test:
infraspec new dynamodb.feature
  1. Run the tests
infraspec features/dynamodb.feature

Tip

If your using VS Code, we recommend installing the Cucumber (Gherkin) Full Support extension for syntax highlighting.

🎯 Roadmap & Status

At the moment, only a subset of AWS infrastructure is supported, but over time we hope to support more products and services.

Product Description Status
API Gateway Not Implemented
DynamoDB Partially Supported
ElastiCache Not Implemented
RDS Partially Supported
RDS Aurora Not Implemented
S3 Partially Supported

You can view the full roadmap here.

📦 Contributions

Contributions are welcome! Please open an issue or submit a pull request. Please note, that this project is still in it's infancy and many internal APIs are likely to change.

Note: Our tests use LocalStack, which emulates the AWS APIs, in order to save both time and money.

📄 License

Apache License 2.0

About

✅ InfraSpec is a tool for testing your AWS infrastructure in plain English, no code required.

Resources

License

Contributing

Stars

Watchers

Forks

Packages

No packages published

Contributors 3

  •  
  •  
  •