Skip to content

feat(edge-security): client rules can name Cloud Armor address groups - #493

Merged
kjgbot merged 2 commits into
mainfrom
feat/edge-armor-address-groups
Nov 19, 2026
Merged

kjgbot merged 2 commits into
mainfrom
feat/edge-armor-address-groups

Conversation

@miyaontherelay

@miyaontherelay miyaontherelay commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

Stacked on #487 (base branch fix/edge-armor-quota). Review this diff on its own; it retargets to main when #487 merges.

Why

The live proof showed that one Cloud Armor policy holds at most 20 rules with an expression, and Google does not raise that limit (#487 makes the module refuse such a plan). A vendor's long published list, about 290 ranges, therefore cannot be written as CIDRs in client_ip_rules: it needs about 37 rules, and an exact merge of adjacent ranges only brings 289 down to 278.

A Cloud Armor address group is one subexpression in a rule whatever it holds, so the whole list costs one admitting rule and one deny.

What changes

  • client_ip_rules[*].address_groups: names of existing project-scoped address groups. Each becomes evaluateAddressGroup('<name>', origin.user_ip) in the rule, ahead of any inline cidrs. A rule needs at least one of cidrs or address_groups; cidrs is now optional.
  • Validation: at most 8 groups per rule, short names only (a full resource path is refused, with the reason).
  • rule_counts reflects it: the vendor rule in the test costs 2 advanced rules.
  • Docs: module README "Long vendor lists: address groups" and item 5 of docs/gcp-install/3-EDGE-HARDENING.md: the Enterprise enrollment command, the gcloud commands to create and fill a group, and how to update it when the vendor's list changes (no Terraform apply).

Why the module does not create the group

A Cloud Armor address group needs purpose = ["CLOUD_ARMOR"]. google_network_security_address_group only has that field from provider 8.x; this repository pins >= 7.0, < 8.0, and 7.46.2 rejects it (An argument named "purpose" is not expected here). Moving the repository to provider 8 is a separate decision. Until then the group is created with gcloud, which also suits how it is used: a vendor's list changes without the policy changing.

What it costs and requires

Address groups need the project enrolled in Cloud Armor Enterprise, which is billed and can take up to an hour to activate. The docs say so before the commands. Nothing in this PR enrolls anything.

Tests

terraform test (mock provider), 33 runs: the exact expression with two groups and an inline range; a group-only rule; a rule with no clients refused; a full path instead of a name refused; with 10 subexpressions and the 20-rule limit, vendors by address group plus a closing staff rule need 7 advanced rules. Local: terraform fmt/validate/test, tflint, terraform-docs and checkov pass. No chart change.

Not proven

Rendering only. Not yet applied to a project enrolled in Cloud Armor Enterprise: that evaluateAddressGroup accepts the short name with origin.user_ip in a backend policy rule (it is the form in Google's documentation), and the exact gcloud network-security address-groups flags. The proof project is on the Standard tier today.

🤖 Generated with Claude Code


Autofix with [code]smith
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.

@miyaontherelay miyaontherelay added the merge-train:hold Do not merge without Khaliq's direct OK label Nov 19, 2026
@coderabbitai

coderabbitai Bot commented Nov 19, 2026 •

Copy link
Copy Markdown

Important

  • Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 1de9b738-b841-451c-ade6-e594d788bf9c
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@greptile-apps

greptile-apps Bot commented Nov 19, 2026 •

Copy link
Copy Markdown

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge; no blocking issues were found.

Summary

Adds support for existing Cloud Armor address groups in client rules, so long vendor address lists can fit within policy limits.

  • Client rules can match named Cloud Armor address groups.

The earlier staff-access documentation issue is fixed. No new actionable issues were found. Live Enterprise behavior and the documented Google Cloud commands remain unproven, as disclosed in the README.

Reviews (7) · Last reviewed commit: "docs(edge-security): keep your own range..." · Reviewed by Greptile

Comment thread docs/gcp-install/3-EDGE-HARDENING.md Resolved
@miyaontherelay
miyaontherelay force-pushed the feat/edge-armor-address-groups branch from eb7c1ce to fe829d6 Compare November 19, 2026 12:49
@miyaontherelay

Copy link
Copy Markdown
Contributor Author

Status of the live proof for this PR: there will not be one from our side. The proof project stays on the Cloud Armor Standard tier (the decision was not to enrol it in Enterprise), so the address-group path remains tested by rendering only, as the description says. What that leaves unverified against Google's API: evaluateAddressGroup('<name>', origin.user_ip) with the short group name in a backend policy rule, the !evaluateAddressGroup('<name>', origin.ip) form of the connecting check, and the exact gcloud network-security address-groups flags. The first project that enrols in Enterprise and applies this is the proof; the plan-time checks and the rule-count limit do not depend on it.

@kjgbot

kjgbot commented Nov 19, 2026

Copy link
Copy Markdown
Contributor

Live status: the address-group path (evaluateAddressGroup(<name>, origin.user_ip) in a backend policy, and the gcloud network-security address-groups create --purpose CLOUD_ARMOR flags) is not proven on a live install. The proof project stays on standard Cloud Armor; Enterprise enrollment there was declined. The rest of the edge-security rules are proven live at #487 60afa9a, including the connecting-ASN rule. The first customer to apply this should check that a listed address is admitted and an unlisted one denied before relying on it.

miyaontherelay added a commit that referenced this pull request Nov 19, 2026
…to an address group

Review feedback on #493: replacing cidrs with address_groups, as the guide
said, would drop the organisation's own ranges from the vendor rule and block
its users on those paths.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
@miyaontherelay
miyaontherelay force-pushed the feat/edge-armor-address-groups branch from fe829d6 to 3c371f0 Compare November 19, 2026 13:12
miyaontherelay added a commit that referenced this pull request Nov 19, 2026
…to an address group

Review feedback on #493: replacing cidrs with address_groups, as the guide
said, would drop the organisation's own ranges from the vendor rule and block
its users on those paths.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
@miyaontherelay
miyaontherelay force-pushed the feat/edge-armor-address-groups branch from 3c371f0 to 2062737 Compare November 19, 2026 13:17
@kjgbot
kjgbot changed the base branch from fix/edge-armor-quota to main November 19, 2026 22:04
miyaontherelay and others added 2 commits November 19, 2026 23:04
One Cloud Armor policy holds at most 20 rules with an expression, so a
vendor's long published list (about 290 ranges) cannot be written as CIDRs in
client_ip_rules. An address group (Cloud Armor Enterprise) is one
subexpression whatever it holds.

- client_ip_rules[*].address_groups: names of existing project-scoped address
  groups. Each becomes evaluateAddressGroup('<name>', origin.user_ip) in the
  rule, ahead of any inline cidrs; a rule needs at least one of the two.
  A vendor list then costs one admitting rule and one deny.
- The module does not create the group: the google provider below 8.0, which
  the repository pins, has no purpose field on
  google_network_security_address_group, and a Cloud Armor group needs purpose
  CLOUD_ARMOR. README and guide give the gcloud commands, the Enterprise
  enrollment command, and how to update a group when the vendor's list changes.

Rendering tests only; not yet applied to a project enrolled in Cloud Armor
Enterprise.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…to an address group

Review feedback on #493: replacing cidrs with address_groups, as the guide
said, would drop the organisation's own ranges from the vendor rule and block
its users on those paths.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
@miyaontherelay
miyaontherelay force-pushed the feat/edge-armor-address-groups branch from 2062737 to 26f0058 Compare November 19, 2026 22:04
@kjgbot kjgbot removed the merge-train:hold Do not merge without Khaliq's direct OK label Nov 19, 2026
@kjgbot
kjgbot merged commit 7adcd11 into main Nov 19, 2026
11 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