test(network/azure): cover associate_subnet_nsgs feature flag#59
Merged
Conversation
Every other tier module's network layer has a feature_flags.tftest.hcl exercising its conditional resources (e.g. network/aws tests enable_nat_gateway/enable_flow_logs), but network/azure only had basic.tftest.hcl covering the default path. associate_subnet_nsgs gates the module's only conditional resources — the subnet/NSG associations that enforce the default-deny posture — and the disabled path (used when composing with workload tier modules) had zero test coverage. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Ja2fXdZfMuBvFATVYkZT4q
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
modules/network/azurehad onlytests/basic.tftest.hcl, covering the default (minimal-input) path. Every other tier module's network layer — notablynetwork/aws— pairsbasic.tftest.hclwith afeature_flags.tftest.hclthat exercises its conditional resources.associate_subnet_nsgs(defaulttrue) gates the module's only conditional resources: theazurerm_subnet_network_security_group_associationforlb/workload/db. These associations enforce the default-deny NSG posture described in the module's own comments, and thefalsepath (used when composing with a workload tier module that associates its own NSG) had zero test coverage.modules/network/azure/tests/feature_flags.tftest.hclwith two plan-only runs: default (true) creates exactly one association per subnet, andassociate_subnet_nsgs = falsecreates zero associations while still creating the NSG resources themselves.This is a test-only change — no production HCL, variables, or outputs are touched, so there's no blast radius on running deployments.
Test plan
terraform init -backend=falseinmodules/network/azureterraform test—3 passed, 0 failed(basic.tftest.hclpass;feature_flags.tftest.hclboth new runs pass)terraform fmt -check -diffon the new test file — cleanterraform validateinmodules/network/azure— valid🤖 Generated with Claude Code
https://claude.ai/code/session_01Ja2fXdZfMuBvFATVYkZT4q
Generated by Claude Code