This repository demonstrates how to use Terraform's built-in testing framework with Terraform HCL modules.
- Terraform >= 1.6.0
- Azure subscription
- Azure CLI configured with appropriate credentials
├── storage/
│ ├── main.tf
│ ├── outputs.tf
│ └── variables.tf
├── tests/
│ └── storage.tftest.hcl
├── .gitignore
├── main.tf
└── readme.md
Located in the /storage
directory, this module manages storage resources with the following components:
main.tf
: Contains the primary storage resource configurationsoutputs.tf
: Defines the output values exposed by the modulevariables.tf
: Declares all variables used within the module
The /tests
directory contains automated tests for the module:
storage.tftest.hcl
: Test configurations for validating storage resources
main.tf
: The root module configuration file.terraform.lock.hcl
: Terraform dependency lock file.gitignore
: Specifies which files Git should ignore
- Ensure you have Terraform installed
- Clone this repository
- Initialize Terraform:
terraform init
- Run the tests:
terraform test
When contributing to this module:
- Create a new branch for your changes
- Update tests as needed
- Ensure all tests pass before submitting a pull request
- Update documentation to reflect any changes
MIT
- This is a demonstration module showcasing Terraform's testing capabilities
- The storage account name must be globally unique across Azure
- The module currently uses LRS (Locally Redundant Storage) by default