feat(terraform): CIDR-sourcing module + tests + CI#2
Merged
Conversation
Adds a Terraform module at terraform/ that exposes Databricks CIDRs (per cloud, per region) as a sorted, deduplicated list. Owns CIDR sourcing only — customers write their own target resources (managed prefix lists, IP groups, storage account network rules, etc.) using whatever provider versions they already have. Keeps the module ~50 HCL lines and avoids per-target version-pin maintenance. Module features: - Inputs: cloud (validated), regions (regex-validated), source_base_url (URL mode), source_files (airgapped/vendored mode), min_cidr_count (lockout guard, default 1). - Outputs: cidrs (sorted+distinct), cidr_count, source (diagnostic). - Fail-closed: rejects empty feeds (lockout guard), non-CIDR content (HTML/JSON-by-mistake), HTTP non-200, invalid input formats. Every error message is actionable, names the bad value, points at the fix. Tests: 9 native `terraform test` runs covering happy path, multi-file union, comment/blank stripping, deduplication, input validation rejections, lockout guard (on and off), non-CIDR rejection. All use local fixtures — no network, runs in seconds. CI: .github/workflows/terraform.yml runs fmt -check, validate, and test on every PR touching terraform/. Docs: terraform/README.md (no-nonsense — quickstart, inputs/outputs tables, per-cloud examples, debugging table, pinning guidance, explicit non-goals). Root README and firewall-automation-guide GitOps section now point at the module.
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
Adds a Terraform module at
terraform/that exposes Databricks CIDRs (per cloud, per region) as a sorted, deduplicated list. The module owns CIDR sourcing only — customers write their own target resources (managed prefix lists, IP groups, storage account network rules, etc.) using whatever provider versions they already have. Keeps the module ~50 HCL lines and avoids per-target version-pin maintenance hell.Why this shape
Documented as a deliberate non-goal in
terraform/README.md.Module surface
Inputs
cloud(validated: aws/azure/gcp)regions(regex-validated lowercase+digits+hyphens)source_base_url(URL mode, default GitHub Pages)source_files(airgapped/vendored mode)min_cidr_count(lockout guard, default 1)Outputs
cidrs(sorted + distinct list)cidr_countsource(diagnostic — what was actually read)Fail-closed behaviour — every error is actionable, names the bad value, points at the fix:
cloud/ region format → input validation failsTests
9 native
terraform testruns covering: happy path, multi-file union, comment/blank stripping, deduplication, input validation rejections, lockout guard (on and off), non-CIDR rejection. All use local fixtures — no network, no cloud creds, runs in seconds.CI
.github/workflows/terraform.ymlrunsfmt -check,validate, andteston every PR that touchesterraform/.Docs
terraform/README.md— no-nonsense: quickstart, inputs/outputs tables, per-cloud examples (AWS prefix list, Azure IP Group + Storage Account, GCP Cloud SQL, airgapped vendoring), debugging table for common errors, pinning guidance, explicit non-goals. Root README and the firewall-automation-guide GitOps section now point at the module.Test plan
terraform fmt -check -recursivepassesterraform validatepassesterraform test9/9 passing locally.github/workflows/terraform.yml)v2026.05.05after merge so README's?ref=examples are validFollow-up (separate PR)
Security plumbing — SHA256SUMS manifest, signed tags, branch protection, hash verification in the module, SECURITY.md threat model.