NashTech Blog

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

Table of Contents

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

Picture of Aditya Kumar Singh

Aditya Kumar Singh

Test Automation Consultant

Leave a Comment

Your email address will not be published. Required fields are marked *

Suggested Article

Scroll to Top