This repository is dedicated to performing unit tests on Terraform infrastructure code using the "Terraform Testing Framework." Unit tests are essential to verify that your Terraform code functions as expected, ensuring stability and correctness in your infrastructure deployments.
The primary purpose of this repository is to provide a platform for writing and running unit tests for Terraform configurations. These tests help catch errors, ensure compliance with infrastructure standards, and validate the functionality of your Terraform code.
This repository utilizes the "Terraform Testing Framework" to define and execute tests for Terraform configurations. The testing workflow is set up using GitHub Actions, which allows you to automate the testing process. The testing framework is configured to run tests whenever code changes are pushed to this repository.
Before running tests in this repository, ensure that you have set up the necessary secrets in your GitHub repository. The following secrets are required:
ARM_CLIENT_ID
: The Azure Active Directory (Azure AD) application client ID.ARM_SUBSCRIPTION_ID
: The Azure subscription ID.ARM_TENANT_ID
: The Azure AD tenant ID.ARM_CLIENT_SECRET
: The client secret associated with the Azure AD application.
The testing workflow consists of the following steps:
- Checkout: This step checks out the code from the repository.
- Setup Terraform: It sets up the required version of Terraform.
- Terraform Init: Initializes Terraform without configuring a backend for testing purposes.
- Terraform Validate: Validates the Terraform code for syntactical correctness.
- Terraform Format: Formats the Terraform code to adhere to the coding style.
- Terraform Test: Executes unit tests using the Terraform Testing Framework.
Feel free to contribute to this repository by adding more unit tests or improving the testing framework. Your contributions can help enhance the reliability of Terraform configurations and promote best practices in infrastructure as code.
This repository is licensed under the MIT License. You are free to use, modify, and distribute the code as per the terms of the license.
Happy Testing! 🚀