Validate your code with the Terraform test framework

preview_player
Показать описание

Testing is a critical part of the software development lifecycle to ensure that your code works as expected. Terraform code is no different, especially for authors publishing reusable modules for their team or organization. Terraform 1.6 brings a new Terraform test framework that allows you to validate the functionality of your configurations without impacting running infrastructure. Tests are written using familiar HashiCorp Configuration Language (HCL) syntax so you can get started quickly without having to learn a new programming language.

Terraform test is a powerful framework that helps you validate every aspect of your code’s behavior to produce high-quality, reliable modules.

0:00 - Intro
0:23 - Create a test file
0:39 - Unit tests
1:45 - Integration testing
2:56 - Running tests
3:38 - Summary and resources

#Terraform #InfrastructureAsCode #HCL

HashiCorp provides infrastructure automation software for multi-cloud environments, enabling enterprises to unlock a common cloud operating model to provision, secure, connect, and run any application on any infrastructure. HashiCorp tools Vagrant, Packer, Terraform, Vault, Consul, Nomad, Boundary, and Waypoint allow organizations to deliver applications faster by helping enterprises transition from manual processes and ITIL practices to self-service automation and DevOps practices.

Рекомендации по теме
Комментарии
Автор

This is amazing. I have been using terrarest to do something similar but glad this functionality has now been added to Terraform. Well done.

tipswithmoruf
Автор

Thanks Hashicorp, this will help us a lot to write tests for Terraform.

MrRidwanbejoz
Автор

🎉 fantastic! Congrats Terraform people!

cloudevops
Автор

Since introducing variable validation a long time ago, I didn't saw it used in any of project by any customer. Not sure this will be useful.

ADV-IT
Автор

How will this be integrated to Terraform Cloud? Does Terraform Cloud automatically run all tests or do we need to build our own CICD for this?

koodauskanava
Автор

Is it possible to create an end-to-end test using the Terraform test framework? I want to get various example end-to-end test using the Terraform test framework

devopshashi
Автор

curious to know how this is different from using go files and running terra test?

JT-ynzk
Автор

How does this work if the module files aren't at the root directory? In my example, I have a src directory that contains the actual modules at the root level with a tests directory at the same root level with tests in a different directory. It doesn't seem like the relative pathing for sourcing the module works in the same way as in pulling a module with a module block?

awworrell
Автор

Now the managers be like.. Give me the code coverage percentage of the terraform code base and it should be greater than 80%

kishanbsh
Автор

How can you test seperate modules from a testfile at "root level"? In my main.tf im reference modules and terraform test does not work properly, any tutorials on this?

reboundpt
Автор

The link for the tutorial redirects to the same page

rodolfoalbuquerque
welcome to shbcf.ru