Skip to content

test(network/azure): cover associate_subnet_nsgs feature flag#59

Merged
dmchaledev merged 1 commit into
mainfrom
claude/blissful-pascal-rk3ua1
Jul 19, 2026
Merged

test(network/azure): cover associate_subnet_nsgs feature flag#59
dmchaledev merged 1 commit into
mainfrom
claude/blissful-pascal-rk3ua1

Conversation

@dmchaledev

Copy link
Copy Markdown
Contributor

Summary

  • modules/network/azure had only tests/basic.tftest.hcl, covering the default (minimal-input) path. Every other tier module's network layer — notably network/aws — pairs basic.tftest.hcl with a feature_flags.tftest.hcl that exercises its conditional resources.
  • associate_subnet_nsgs (default true) gates the module's only conditional resources: the azurerm_subnet_network_security_group_association for lb/workload/db. These associations enforce the default-deny NSG posture described in the module's own comments, and the false path (used when composing with a workload tier module that associates its own NSG) had zero test coverage.
  • Added modules/network/azure/tests/feature_flags.tftest.hcl with two plan-only runs: default (true) creates exactly one association per subnet, and associate_subnet_nsgs = false creates 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=false in modules/network/azure
  • terraform test3 passed, 0 failed (basic.tftest.hcl pass; feature_flags.tftest.hcl both new runs pass)
  • terraform fmt -check -diff on the new test file — clean
  • terraform validate in modules/network/azure — valid

🤖 Generated with Claude Code

https://claude.ai/code/session_01Ja2fXdZfMuBvFATVYkZT4q


Generated by Claude Code

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
@dmchaledev
dmchaledev merged commit 633dee8 into main Jul 19, 2026
47 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants