Reputation: 9368
I am going through the following video that shows how to test Terraform "azurerm" provider.
P3 - How to test infrastructure as code - Terraform/TerraTest/Golang/Azure REST API - Hands-on Demos
I am having hard time underestanding what exact value Terratest adds in the approach shown in the video.
To my simplistic view, I can easily write a relatively simple script (Bash, Python, PowerShell Core Linux , etc.) to cal Azure REST API (Azure CLI is a much simpler option) and test verift my deployed infrastructure.
Why do it need to go throough all that golang and Terratest effort that is explained in the video?
Upvotes: 1
Views: 455
Reputation: 1026
There are a couple things happening here and it is best not to conflate them.
For me a lot of this is, I am going to take the time to test it by hand, I might as well be organized and do it with code. It helps me quickly validate I am doing what I think I am trying to do through code. When it comes to IaC this is harder to do with mocks and unit tests. Easier to do in cloud through integration testing.
Upvotes: 1
Reputation: 31454
In my opinion, it depends on the different requirements. When you just need to use the REST API quickly and no other requirement, then the simplest way is best. But when you want to execute the REST API in code, here is the golang. Then this video is the example you need.
In fact, I think it's a good thing to learn the process that how does the REST API executes in the code. It makes you clearly know each step it will do. If there is something wrong, then you will know which step causes the error.
Upvotes: 0