Just as your application, code should be covered by unit and integration tests. Infrastructure as code should have good test coverage as well. There are multiple ways to do infrastructure code tests. They are as follows:
- Test only the code, without creating a real infrastructure (with tools such as ChefSpec and rspec-puppet)
- Test a single server
- Test the complete system
We won't look at the first option to test our infrastructure in this book. For guidance on how to test the complete system (with all the cloud resources, servers, and so on), look at Chapter 7, Collaborative Infrastructure. As for this chapter, let's check one way to test a single server with Terraform and Inspec.
Inspec is a testing framework ...