5 unique types of code snippet examples for Azure with respect to Terratest compliance testing

woman using a computer
Reading Time: 2 minutes

Virtual Machine Scale Sets:

The following code snippet can be used to create and verify Virtual Machine Scale Sets in Azure with Terratest:

Virtual Network Peering:

The following code snippet can be used to create and verify Virtual Network Peering in Azure with Terratest:

Storage Accounts:

The following code snippet can be used to create and verify Storage Accounts in Azure with Terratest:

Azure Function App:

The following code snippet can be used to create and verify Azure Function App in Azure with Terratest:


Application Gateway

The following code snippet can be used to create and verify Application Gateway in Azure with Terratest:





This code creates and verifies an Azure Application Gateway using Terraform and Terratest. The Terraform configuration for the Application Gateway can be found in the ../terraform/application_gateway directory. The VerifyApplicationGateway function from the azure module is used to verify that the Application Gateway was successfully created and is functioning as expected. The function takes in the name of the resource group and the name of the Application Gateway as parameters, and returns an error if there are any issues with the resource group or Application Gateway. The defer statement ensures that the Azure resources created during the test are destroyed at the end of the test run.

Overall, Terratest Compliance is a powerful tool for ensuring compliance in infrastructure code. Its ability to define compliance tests using code, along with its integration with Terratest, makes it a valuable addition to any developer’s toolkit.


For more details get in touch with Rahul Miglani at Rahul.Miglani@NashTechglobal.com

Written by 

Rahul Miglani is Vice President at Knoldus and heads the DevOps Practice. He is a DevOps evangelist with a keen focus to build deep relationships with senior technical individuals as well as pre-sales from customers all over the globe to enable them to be DevOps and cloud advocates and help them achieve their automation journey. He also acts as a technical liaison between customers, service engineering teams, and the DevOps community as a whole. Rahul works with customers with the goal of making them solid references on the Cloud container services platforms and also participates as a thought leader in the docker, Kubernetes, container, cloud, and DevOps community. His proficiency includes rich experience in highly optimized, highly available architectural decision-making with an inclination towards logging, monitoring, security, governance, and visualization.

Discover more from Knoldus Blogs

Subscribe now to keep reading and get access to the full archive.

Continue reading