Azure / Azure-Verified-Modules

Azure Verified Modules (AVM) is an initiative to consolidate and set the standards for what a good Infrastructure-as-Code module looks like. Modules will then align to these standards, across languages (Bicep, Terraform etc.) and will then be classified as AVMs and available from their respective language specific registries.
https://aka.ms/AVM
MIT License
354 stars 83 forks source link

[Question/Feedback]: Terraform Variable Validation #942

Open kevball2 opened 6 months ago

kevball2 commented 6 months ago

Check for previous/existing GitHub issues

Description

Wanted to start a discussion around testing in terraform AVM modules. l started investigating the TF testing framework and creating some unit tests around variable validation.

Looking at the style guide there is not a lot of defined information yet around what kinds of unit tests we should be looking to create. I started with testing our variable validations to ensure that there was coverage if a validation changed. This lead to the creation of many more tests than I expected. For just the resource group name there were 5 tests to confirm various potential values. All these tests still need to run during the plan phase which would be when the built in TF validation will run.

This brought up several questions:

Hoping for some feedback on what others are doing and any future plans for testing in general.

microsoft-github-policy-service[bot] commented 6 months ago

[!IMPORTANT] The "Needs: Triage :mag:" label must be removed once the triage process is complete!

[!TIP] For additional guidance on how to triage this issue/PR, see the AVM Issue Triage documentation.

[!NOTE] This label was added as per ITA06.

matebarabas commented 5 months ago

@Azure/avm-core-team-technical-terraform, can you please take a look at this inquiry? Thanks!