Skip to content

feat: harden gcp-with-psc-exfiltration-protection module and example#231

Open
micheledaddetta-databricks wants to merge 1 commit into
mainfrom
issue-165/gcp-psc-exfiltration-hardening
Open

feat: harden gcp-with-psc-exfiltration-protection module and example#231
micheledaddetta-databricks wants to merge 1 commit into
mainfrom
issue-165/gcp-psc-exfiltration-hardening

Conversation

@micheledaddetta-databricks

@micheledaddetta-databricks micheledaddetta-databricks commented Mar 26, 2026

Copy link
Copy Markdown
Collaborator

Summary

Closes #165

Hardens the existing gcp-with-psc-exfiltration-protection module and example to align with repo conventions:

  • Add validation blocks for databricks_account_id (UUID), google_region (PSC-supported regions enum), prefix (naming pattern), hive_metastore_ip (IPv4), and all CIDR variables
  • Fix psc_subnet_cidr description (was incorrectly "CIDR for Spoke VPC")
  • Expand module outputs from 2 to 10: VPC IDs, subnet IDs, network ID, and PSC endpoint IPs
  • Add required_version >= 1.9.0 to both module and example
  • Remove provider version pins (these are templates, not production modules)
  • Organize variables with section comments
  • Add .claude/ and CLAUDE.md to .gitignore

Test plan

  • terraform fmt -check -recursive passes on changed files
  • terraform validate passes on the module (requires provider init)
  • Verify validation blocks reject invalid inputs (bad UUID, unsupported region, invalid CIDR)
  • Verify new outputs are accessible from the example via module.gcp_with_data_exfiltration_protection.*

…165)

Add validation blocks, expand outputs, fix descriptions, and add
required Terraform version for the GCP PSC exfiltration protection
module and its matching example.

- Add validation blocks for account ID (UUID), region (PSC-supported),
  prefix (naming pattern), hive metastore IP (IPv4), and CIDRs
- Fix psc_subnet_cidr description (was incorrectly "CIDR for Spoke VPC")
- Expand module outputs from 2 to 10 (VPC IDs, subnet IDs, PSC IPs)
- Add required_version >= 1.9.0 to both module and example
- Remove provider version pins (templates, not production modules)
- Add .claude/ and CLAUDE.md to .gitignore
- Organize variables with section comments

Co-authored-by: Isaac

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Hardens the existing gcp-with-psc-exfiltration-protection Terraform module and its example by adding input validations, expanding outputs, and aligning version/provider constraints and ignore rules with the repository’s template conventions.

Changes:

  • Added variable validation for account ID, region, naming prefix, hive metastore IP, and CIDR inputs (module + example).
  • Expanded module outputs to expose key network identifiers and PSC endpoint IPs.
  • Standardized Terraform required_version and removed provider version pins; updated .gitignore to exclude Claude tooling files.

Reviewed changes

Copilot reviewed 5 out of 6 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
modules/gcp-with-psc-exfiltration-protection/variables.tf Adds variable organization + validation blocks for core inputs.
modules/gcp-with-psc-exfiltration-protection/terraform.tf Sets required_version >= 1.9.0 and keeps providers unpinned.
modules/gcp-with-psc-exfiltration-protection/outputs.tf Adds outputs for VPC/subnet/network IDs and PSC endpoint IPs.
examples/gcp-with-psc-exfiltration-protection/variables.tf Mirrors module validations and reorganizes variable sections.
examples/gcp-with-psc-exfiltration-protection/terraform.tf Sets required_version >= 1.9.0 and removes provider version pins.
.gitignore Ignores .claude/ and CLAUDE.md.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

description = "Databricks Account ID"

validation {
condition = can(regex("^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$", var.databricks_account_id))
description = "IP address of the regional default Hive Metastore"

validation {
condition = can(regex("^\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}$", var.hive_metastore_ip))
description = "Databricks Account ID"

validation {
condition = can(regex("^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$", var.databricks_account_id))
description = "IP address of the regional default Hive Metastore"

validation {
condition = can(regex("^\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}$", var.hive_metastore_ip))
@alexott

alexott commented Jun 16, 2026

Copy link
Copy Markdown
Collaborator
  • [P1] Restore provider constraints in the example. The PR removes the databricks and google version constraints from examples/gcp-with-psc-exfiltration-protection/terraform.tf, and this repo does not commit Terraform lock files. On a fresh init of this branch Terraform selected databricks 1.117.0 and google 7.35.0 instead of the previously documented/tested databricks >=1.81.1 and google 6.17.0. That makes the example drift to whatever the registry latest is and can break users without any repo change. Please keep explicit constraints in the root example, or otherwise add an intentional lock/compatibility story.

  • [P2] Regenerate the terraform-docs README blocks for the changed module and example. The PR adds required_version >= 1.9.0, changes input descriptions, and adds several module outputs, but modules/gcp-with-psc-exfiltration-protection/README.md still says No requirements and only lists workspace_id/workspace_url outputs. examples/gcp-with-psc-exfiltration-protection/README.md also still documents the removed provider requirements and old input descriptions. Running terraform-docs markdown table on both directories produces updates, so the generated docs are currently stale.

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.

Add an equivalent of adb-with-private-links-exfiltration-protection to GCP

3 participants