Testing Terraform code with Go and Terratest

Towards high-quality infrastructure-as-code part 1

A muddy quarry with vehicle tracks
Photo by Ivan Bandura on Unsplash


High-level description of a testable IaC


├── src
│ └── main.tf
└── test
└── spec_test.go
$ az login
$ az account set — subscription "My-test-subscription"
# -t is for installing test dependencies; -v is for verbose output
$ go get -t -v ./...
$ go test -timeout 30m -parallel 10


Founder and Software Engineer at Unicoeding. I help organizations sorting out their cloud and data infrastructure. You can find us at www.unicoeding.com.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store