Skip to content

test(network): add terraform test coverage for network/aws and network/azure#19

Open
dmchaledev wants to merge 1 commit into
mainfrom
claude/blissful-pascal-h2vz7p
Open

test(network): add terraform test coverage for network/aws and network/azure#19
dmchaledev wants to merge 1 commit into
mainfrom
claude/blissful-pascal-h2vz7p

Conversation

@dmchaledev

Copy link
Copy Markdown
Contributor

Summary

  • Gap found: network/aws and network/azure were the only modules without .tftest.hcl files, and were absent from the terraform-test CI job. All six tier modules (single-vm, ha-hot-hot, unlimited-scale for both clouds) had coverage; the shared network foundation did not.
  • Why it matters: A regression in CIDR layout, conditional NAT/flow-log resource counts, or subnet delegation could merge undetected. The network module is the first module most operators deploy and the one every workload tier depends on.
  • Fix: 3 new test files + 2-line CI matrix addition.

Files added

File What it tests
modules/network/aws/tests/basic.tftest.hcl Apply with only name_prefix set; asserts all 7 outputs populated and default subnet/NAT counts match az_count=2
modules/network/aws/tests/feature_flags.tftest.hcl Plan tests: enable_nat_gateway=false (zero NAT GWs + EIPs), enable_flow_logs=false (zero CW log group / IAM role / flow log), az_count=3 (three subnets per tier, three NAT GWs)
modules/network/azure/tests/basic.tftest.hcl Apply with required vars; asserts all 5 outputs populated and private_dns_zone_name is the canonical Postgres Flexible Server zone

mock_data "aws_availability_zones" (Terraform 1.7+, supported by the CI-pinned 1.9.8) supplies synthetic AZ names so slice() in the locals block resolves without real AWS credentials.

CI change

network/aws and network/azure added to the terraform-test job matrix in .github/workflows/ci.yml.

Test plan

  • terraform-test CI job passes for network/aws and network/azure
  • All existing terraform-test jobs still green (no matrix changes to them)
  • validate, tflint, wrapper-forwarding, and other existing jobs unaffected

https://claude.ai/code/session_01Q9JUkcA9TUZhWAp4FdzFWo


Generated by Claude Code

…k/azure

The network modules were the only modules without .tftest.hcl files and
were absent from the terraform-test CI job. This gap meant regressions in
CIDR logic, conditional NAT/flow-log resources, or subnet counts could
merge undetected.

Adds:
- modules/network/aws/tests/basic.tftest.hcl: apply test with mocked AZs,
  asserts all outputs populated and default subnet/NAT counts are correct
- modules/network/aws/tests/feature_flags.tftest.hcl: plan tests for
  enable_nat_gateway=false, enable_flow_logs=false, and az_count=3
- modules/network/azure/tests/basic.tftest.hcl: apply test asserting all
  five outputs populated and the Postgres private DNS zone name is canonical
- .github/workflows/ci.yml: adds network/aws and network/azure to the
  terraform-test job matrix

https://claude.ai/code/session_01Q9JUkcA9TUZhWAp4FdzFWo
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