Skip to content

fix: Consistent handling of cidr_blocks in *_with_ipv6_cidr_blocks helpers#354

Open
raman1236 wants to merge 1 commit into
terraform-aws-modules:masterfrom
raman1236:fix/ipv6-cidr-blocks-consistency
Open

fix: Consistent handling of cidr_blocks in *_with_ipv6_cidr_blocks helpers#354
raman1236 wants to merge 1 commit into
terraform-aws-modules:masterfrom
raman1236:fix/ipv6-cidr-blocks-consistency

Conversation

@raman1236
Copy link
Copy Markdown

Description

Fixes #352

When a user accidentally specifies cidr_blocks instead of ipv6_cidr_blocks in the *_with_ipv6_cidr_blocks helper variables, the behavior was inconsistent between ingress and egress:

Before this fix:

  • Ingress: ipv6_cidr_blocks = [] (silent no-op, rule does nothing)
  • Egress: ipv6_cidr_blocks = ["::/0"] (appears to work, but only because var.egress_ipv6_cidr_blocks defaults to ["::/0"])

Neither actually reads the user's cidr_blocks value - the egress case only works by coincidence of the default.

After this fix:

Both ingress and egress (and their computed variants) now fall back to looking up the cidr_blocks key when ipv6_cidr_blocks is not found, before falling back to the module-level default. This makes the behavior consistent and prevents silent no-op rules.

Changes

  • Added nested lookup(..., "cidr_blocks", ...) as fallback in the ipv6_cidr_blocks attribute for:
    • ingress_with_ipv6_cidr_blocks
    • computed_ingress_with_ipv6_cidr_blocks
    • egress_with_ipv6_cidr_blocks
    • computed_egress_with_ipv6_cidr_blocks

…lpers

When a user accidentally specifies cidr_blocks instead of
ipv6_cidr_blocks in ingress_with_ipv6_cidr_blocks or
egress_with_ipv6_cidr_blocks, the behavior was inconsistent:

- Ingress: silently produced ipv6_cidr_blocks = [] (no-op rule)
- Egress: appeared to work because var.egress_ipv6_cidr_blocks
  defaults to ["::/0"]

The fix adds a fallback lookup for cidr_blocks when ipv6_cidr_blocks
is not found in the rule map, making behavior consistent across both
ingress and egress helpers (and their computed variants).

Fixes terraform-aws-modules#352
@raman1236 raman1236 force-pushed the fix/ipv6-cidr-blocks-consistency branch from 6047646 to 0df7f3f Compare May 1, 2026 21:48
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.

Inconsistent handling of cidr_blocks in *_with_ipv6_cidr_blocks

1 participant