Skip to content

refactor(terraform): modernize customer data platform guide infrastructure - #273

Merged
iht merged 4 commits into
GoogleCloudPlatform:mainfrom
iht:feature/cdp-terraform-revamp
Sep 7, 2026
Merged

refactor(terraform): modernize customer data platform guide infrastructure#273
iht merged 4 commits into
GoogleCloudPlatform:mainfrom
iht:feature/cdp-terraform-revamp

Conversation

@iht

@iht iht commented Sep 7, 2026

Copy link
Copy Markdown
Member

Description

Modernizes the Customer Data Platform (CDP) solution guide infrastructure and pipeline scripts according to the architectural patterns, security guardrails, and quality checklist specified in terraform/TERRAFORM_REVAMP_GUIDE.md and AGENTS.md.

Key Changes

  1. Infrastructure Modernization (terraform/cdp/):

    • Removed legacy organizational and monolithic foundation resources (module.google_cloud_project, module.vpc_network, module.firewall_rules, module.regional_nat).
    • Pruned obsolete variables (billing_account, organization, project_create, internet_access, network_prefix).
    • Added standardized variables: subnetwork, bucket_name, service_account_name (default: cdp-dataflow-sa), create_bucket, destroy_all_resources, bq_dataset, and bq_table.
    • Enabled required Google Cloud APIs natively via google_project_service (dataflow, cloudbuild, artifactregistry, pubsub, bigquery, monitoring, storage).
    • Configured dedicated Dataflow worker service account (cdp-dataflow-sa) with least-privilege IAM roles.
    • Added automated subnetwork IAM (roles/compute.networkUser) for workers when a subnetwork is configured.
    • Declared destination BigQuery table (google_bigquery_table.unified_data) in Terraform with schema matching unified_table.json and lifecycle tied to var.destroy_all_resources.
    • Updated local_file.variables_script to generate pipelines/cdp/scripts/00_set_environment.sh.
  2. Pipeline Runner Scripts (pipelines/cdp/scripts/):

    • Refactored runner scripts into single-responsibility, modular scripts:
      • 01_build_and_push_container.sh: Dedicated container build script using Cloud Build.
      • 02_run_dataflow.sh: Dedicated Dataflow job launcher enforcing --no_use_public_ips and dynamic subnetwork argument injection ($SUBNET_OPT).
    • Deleted legacy scripts (run.sh, 01_cloudbuild_and_push_container.sh, 02_run_dataflow_job.sh).
    • Added .gitignore to ignore the generated 00_set_environment.sh.
    • Enhanced generate_transaction_data.py to support environment variables, CLI arguments, and automatic fallback to local sample data.
  3. Documentation & Skill Registries:

    • Updated terraform/cdp/README.md, pipelines/cdp/README.md, and use_cases/CDP.md.
    • Updated .agents/skills/use-case-deployment/SKILL.md, terraform/AGENTS.md, and root AGENTS.md.
    • Marked CDP as (Done) in terraform/TERRAFORM_REVAMP_GUIDE.md.

Verification

  • terraform fmt -check passed cleanly.
  • terraform init -backend=false -upgrade succeeded with provider lock resolution.
  • terraform validate passed (Success! The configuration is valid.).
  • bash -n *.sh passed for all scripts in pipelines/cdp/scripts/.
  • python3 -m py_compile passed for generate_transaction_data.py.

- Remove monolithic project and VPC networking resources in favor of assuming pre-existing project and networking infrastructure.
- Prune legacy variables (billing_account, organization, project_create, internet_access, network_prefix) and add standardized variables (subnetwork, bucket_name, service_account_name, create_bucket, destroy_all_resources, bq_dataset, bq_table).
- Enable required Google Cloud APIs natively via google_project_service.
- Standardize dedicated Dataflow worker service account (cdp-dataflow-sa) with least-privilege IAM roles.
- Automate subnetwork IAM (roles/compute.networkUser) for workers when subnetwork is configured.
- Provision BigQuery destination table (unified_data) declaratively in Terraform.
- Configure local_file.variables_script to generate 00_set_environment.sh.
- Refactor pipeline runner scripts into single-responsibility modular scripts: 01_build_and_push_container.sh and 02_run_dataflow.sh (with private IP enforcement and dynamic subnetwork options); delete legacy run.sh.
- Update generate_transaction_data.py to use environment variables and CLI arguments with fallback to local sample data.
- Update documentation, use case guides, and agent deployment skills.
Comment thread terraform/cdp/main.tf
Comment thread .agents/skills/use-case-deployment/SKILL.md Outdated
@iht
iht merged commit e251533 into GoogleCloudPlatform:main Sep 7, 2026
12 checks passed
@iht
iht deleted the feature/cdp-terraform-revamp branch September 7, 2026 14:55
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.

1 participant