Section A • Architecture Overview

CARE (Cost Allocation and Resource Explanation) Architecture

FedRAMP High • DoD IL4/IL5 • Commercial

CARE is a containerized Google Cloud FinOps and Granular Billing Intelligence platform deployed on Cloud Run (Gen2), fronted by a Global External Application Load Balancer with Google Cloud Armor WAF (OWASP Top 10 preconfigured rules) and Cloud Identity-Aware Proxy (IAP). It queries your organization's BigQuery Detailed Usage Cost Export (`gcp_billing_export_resource_v1_*`) through 7 analytical FinOps views (`FOCUS v1.0`, `GKE Split Cost Allocation`, `Tagging Governance`, `Modernization KPI`, `Daily Summary`, `Resource Granular`, and `Reconciliation Assurance`) plus an append-only Immutable Daily Financial Ledger, and synthesizes executive reports, interactive SVG graphical charts, and RFC 4180 CSV exports using Gemini Enterprise (`gemini-3.8-flash` in High Thinking mode).

Interactive Browser Runner: Run ./deploy.sh --guide from your terminal to serve this guide on http://127.0.0.1:8765. Every command block below dynamically updates with your parameters and can be executed directly from this page after explicit command review.
Section B • Parameter Reference

Parameter Dictionary & How to Look Up Every Value

Use the lookup commands below (or click Auto-Detect My GCP Environment in Section C) to find your organization and billing export parameters.

Parameter Description CLI Lookup Command
ORG_ID Numeric Google Cloud Organization ID gcloud organizations list --format="table(displayName,name.basename())"
BILLING_ACCOUNT_ID Cloud Billing Account ID (`XXXXXX-XXXXXX-XXXXXX`) gcloud billing accounts list --format="table(name.basename(),displayName,open)"
BILLING_PROJECT_ID GCP Project ID where your Detailed Usage Cost BigQuery dataset lives bq ls --project_id=<PROJECT_ID>
BILLING_DATASET_ID BigQuery dataset name containing the Detailed Billing Export table bq show --format=prettyjson <BILLING_PROJECT_ID>:<DATASET_ID>
DETAILED_BILLING_TABLE Table ID starting with gcp_billing_export_resource_v1_ bq ls <BILLING_PROJECT_ID>:<DATASET_ID>
BQ_LOCATION Dataset location of your Billing Export (typically US multi-region or us-central1) bq show --format=json <BILLING_PROJECT_ID>:<DATASET_ID> | jq -r .location
PROJECT_ID Host GCP Project ID where CARE Cloud Run & analytical views are deployed (can match BILLING_PROJECT_ID or be a dedicated FinOps project) gcloud config get-value project
KMS_PROJECT_ID Dedicated Cloud KMS Vault Project ID (must be separate from PROJECT_ID for Separation of Duties) Created automatically in Step 1 if not yet present
Section C • Interactive Parameter Customizer

Configure Your Environment Parameters

Update the fields below. Every gcloud, bq, terraform, and ./deploy.sh command block across Steps 0–9 updates in real time and persists locally in your browser.

8 to 15 digits numeric ID (e.g., 123456789012) Must be an 8-15 digit numeric Organization ID.
Format: XXXXXX-XXXXXX-XXXXXX (uppercase hex) Must match format 012345-6789AB-CDEF01.
Project hosting your BigQuery Detailed Usage Cost export Must be a valid lowercase GCP project ID (6-30 chars).
BigQuery dataset name containing the export table Dataset ID may only contain letters, numbers, and underscores.
Format: gcp_billing_export_resource_v1_XXXXXX_XXXXXX_XXXXXX Must start with gcp_billing_export_resource_v1_.
Must match your Billing Export location (US or us-*)
Project for Cloud Run & CARE views (can match BILLING_PROJECT_ID) Must be a valid lowercase GCP project ID (6-30 chars).
Must be separate from PROJECT_ID (NIST SC-12 Separation of Duties) Must be a valid GCP project ID distinct from PROJECT_ID.
US region for Cloud Run, Artifact Registry & Gemini Enterprise
Select COMMERCIAL for standard orgs or FedRAMP/IL for Assured Workloads
Leave blank for Org root in COMMERCIAL, or enter Folder ID Folder ID must be numeric (8-20 digits) or empty.
Dataset created in PROJECT_ID for FOCUS & Ledger views Dataset ID must contain only letters, numbers, and underscores.
Domain for Google-managed SSL certificate on Load Balancer Enter a valid FQDN (e.g., care.internal.agency.gov).
Format: user:name@domain or group:finops@domain Must start with user:, group:, domain:, or serviceAccount:.
Receives Access Approval (AXA) alerts Enter a valid email address.
Used for Cloud Billing Budget 50%/80%/90%/100% alerts Enter a positive budget amount in USD.
Section D • Least-Privilege Bootstrap IAM

Minimum Deployer Permissions Required to Run Setup

Ensure the operator running this deployment has the following roles on the Organization / Projects, or run the self-grant block below if you are an Organization Administrator:

Grant Operator Bootstrap Roles (Optional — Run if Needed)

          
Step 0 • Pre-Flight Verification

Verify Google Cloud SDK, BigQuery CLI, Terraform & Active Identity

Confirm that gcloud, bq, terraform, and python3 are installed and authenticated.

Step 0: Check CLI Tools & Active GCP Auth

          
Step 1 • Project & Billing Linkage

Ensure CARE Host Project & Separated KMS Vault Project Exist

CARE enforces Separation of Duties (NIST SC-12 / FedRAMP High): encryption keys live in {{kms_project_id}} while Cloud Run and analytical views live in {{project_id}}. If {{project_id}} already exists (for example, when co-locating CARE inside your existing Billing Export project {{billing_project_id}}), this command safely skips creating it and only creates or links what is missing.

Step 1: Create/Verify Host Project & KMS Vault Project + Link Billing

          
Step 2 • Billing Export Verification & Terraform Vars

Verify Detailed Billing Export Dataset & Generate terraform/care.auto.tfvars

This step verifies that {{billing_project_id}}:{{billing_dataset_id}}.{{detailed_billing_table}} exists, confirms its dataset location ({{bq_location}}), and writes terraform/care.auto.tfvars.

Step 2: Verify BigQuery Export Table & Write terraform/care.auto.tfvars

          
Step 3 • KMS Separation of Duties

Enable Core APIs & Provision Google-Managed Service Identities

Before Terraform binds cross-project HSM Customer-Managed Encryption Keys (CMEK) in {{kms_project_id}}, the Google-managed service agents for BigQuery, Artifact Registry, Cloud Run, Pub/Sub, Logging, Gemini Enterprise, and Access Approval must exist in {{project_id}}.

Step 3: Enable APIs & Initialize Service Agents

          
Step 4 • Identity-Aware Proxy & Zero-Trust Perimeter

Verify Cloud IAP Brand & Access Context Manager Policy

CARE protects its external HTTPS endpoint behind Cloud Identity-Aware Proxy (IAP) and Google Cloud Armor WAF, granting access strictly to {{iap_authorized_member}}.

Step 4: List OAuth Brand & Access Context Manager Policy

          
Step 5 • Container Supply Chain & Artifact Registry

Provision Artifact Registry & Build Immutable Container Digest

Note: ./deploy.sh in Step 6 automatically runs this step for you unless --skip-build is passed. You can also run it independently here to build and push the CARE container image to your CMEK-encrypted Artifact Registry repository in {{region}} and pin its @sha256 digest.

Step 5: Build Container Image & Pin @sha256 Digest

          
Step 6 • Full Automated Bootstrap

Execute ./deploy.sh to Provision the Complete CARE Stack

Runs the full end-to-end deployment: validates US Data Residency and KMS Separation of Duties, verifies the location of {{billing_project_id}}:{{billing_dataset_id}}, builds and pins the container image digest, and provisions all 7 CARE BigQuery FinOps views, the append-only care_immutable_daily_ledger table, Cloud Run v2 service, Cloud Armor WAF, and Global External HTTPS Load Balancer.

Step 6A: Dry-Run Validation (Terraform Plan & Pre-Checks)

          
Step 6B: Live Production Deployment (./deploy.sh)

          
Step 7 • DNS Cutover & TLS Provisioning

Retrieve Load Balancer Anycast IP & Check Managed SSL Status

Point an DNS A record for {{care_domain_name}} to the Global External Load Balancer IP address below. Once DNS propagates, Google Cloud automatically activates the managed TLS 1.3 certificate.

Step 7: Retrieve Load Balancer VIP & Check TLS Certificate Status

          
Section P • Live Deployment Outputs

CARE FinOps Portal URLs & Provisioned BigQuery Views

Click Fetch Live Outputs from Terraform after running Step 6 to populate the live endpoints and resources below.

Output Resource Value / Endpoint
External HTTPS Portal URL (Cloud IAP + Cloud Armor) https://care-finops.internal.agency.gov
Global Load Balancer Anycast IPv4 VIP Run Step 6 / Click Fetch Live Outputs
Cloud Run v2 Internal Service URI Run Step 6 / Click Fetch Live Outputs
CARE Analytical Views Dataset care-finops-prod.care_finops_views
Immutable Daily Financial Ledger Table care-finops-prod.care_finops_views.care_immutable_daily_ledger
Step 8 • Post-Deployment Assurance

End-to-End Verification Suite (BigQuery Views, Ledger, Cloud Run & Gemini)

Run the verification tests below to validate your CARE deployment end-to-end against your real Detailed Billing Export data.

Test 8.1 — Verify All 7 CARE Analytical Views & Immutable Daily Ledger Table in BigQuery
Test 8.1: List Provisioned CARE BigQuery Views & Ledger Table

              
Test 8.2 — Query FOCUS v1.0 View (`v_care_focus_v1`) Against Customer Detailed Billing Export
Test 8.2: Run Sample FinOps Query Against v_care_focus_v1

              
Test 8.3 — Trigger Initial Backfill of Immutable Daily Financial Ledger (`care_immutable_daily_ledger`)
Test 8.3: Backfill Locked Historical Days into care_immutable_daily_ledger

              
Test 8.4 — Verify Cloud Run Service Health (`/api/v1/health`) via Authenticated Proxy
Test 8.4: Check CARE Cloud Run Service Status & Health Endpoint

              
Step 9 • Safe Teardown & Reset

Tear Down CARE Infrastructure (Never Modifies Your Billing Export Data)

Billing Export Protection Guarantee: ./teardown.sh only removes CARE resources (Cloud Run, Load Balancer, and the {{care_dataset_id}} views dataset). Your raw Detailed Billing Export dataset ({{billing_project_id}}:{{billing_dataset_id}}) is strictly read-only and is never modified or deleted.
Step 9: Run Safe CARE Teardown (./teardown.sh)