From the course: DevOps Foundations: Infrastructure as Code
Unlock this course with a free trial
Join today to access over 25,300 courses taught by industry experts.
Testing infrastructure
From the course: DevOps Foundations: Infrastructure as Code
Testing infrastructure
You can test more of your code without having to use or make real infrastructure by using mocks, which is a testing term for code used to replicate the behavior of an external system so that you can safely run unit tests without affecting your real one. Terraform version 1.6 introduced a standard Terraform test framework, and then version 1.7 introduced a mocking framework. Using it, for example, you can ask Terraform to substitute a mock Amazon Cloud provider for the real provider. Then when you run Terraform test, it runs your code using the mock. So it doesn't need real AWS credentials or access to the cloud. Instead, Terraform pretends to make the requested resources and you can validate that your code, at least logically, works the way you want it to. This is faster and safer, but less comprehensive than using Terraform plan, which does need real AWS credentials and reaches out to the cloud to…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
-
-
(Locked)
What is infrastructure as code?3m 50s
-
(Locked)
Continuous integration for infrastructure4m 1s
-
(Locked)
Testing infrastructure2m 31s
-
(Locked)
Works on my machine4m 20s
-
(Locked)
You write it, you run it3m 25s
-
(Locked)
Automate all the things2m 59s
-
(Locked)
CI for my IaC5m 8s
-
(Locked)
The GitOps model3m 48s
-
(Locked)
Security and compliance as code6m 35s
-
(Locked)
Using AI to create your IaC9m 58s
-
(Locked)
-