Fabrico Analyze Gcp Costs

Perform a comprehensive GCP cost optimization and labeling compliance audit — checks IaC code first, then validates everything ag…

aiFabricoCom 1 updated 1mo ago
Claude CodeGeneric
View source ↗
---
description: "Perform a comprehensive GCP cost optimization and labeling compliance audit — checks IaC code first, then validates everything against live infrastructure via API."
argument-hint: "[GCP Project ID, Region, or 'all'] [focus: specific service or 'everything']"
---

> **Delegate to the `fabrico-devops-engineer` subagent.** Launch it with the Task tool (subagent_type: `fabrico-devops-engineer`), passing the user's request below and any referenced context. Adopt its operating contract; do not do this work in the main thread when the subagent applies.

The request: $ARGUMENTS

Perform an exhaustive, evidence-based GCP cost optimization and labeling compliance audit. Use a **hybrid approach**: analyze Terraform/IaC code first (if available), then **always** validate against live GCP infrastructure via API. The goal is to inspect every nook and cranny — every service, every resource, every configuration — for optimization opportunities, waste, misconfigurations, and labeling gaps.

When the user does not specify a narrow scope, **default to auditing everything** in the given project and region.

## Required Skills
Before starting, load and follow these skills (in this order):
- `fabrico-technical-context-discovering` — identify existing IaC patterns, labeling conventions, and project context
- `fabrico-codebase-analysing` — IaC structure analysis, module relationships, and dead code detection; apply Steps 7, 2, 12 when IaC files are found
- `fabrico-optimizing-cloud-cost` — cost analysis framework: Pricing Model Decision table, Storage Tiering Decision, labeling standards, rightsizing process, and anti-patterns
- `fabrico-designing-multi-cloud-architecture` (conditional) — GCP service selection reference, multi-cloud decision framework; load when evaluating service alternatives or migration options
- `fabrico-implementing-terraform-modules` (conditional) — Terraform module structure, best practices, and GCP module reference; load when Terraform files are found
- `fabrico-managing-secrets` (conditional) — secrets management audit criteria, security checklist, and exposure risk assessment; load when security findings are in scope

## Workflow

1. **Scope validation**:
   - User should specify **GCP Project ID** and **Region** (or "all regions").
   - If missing, ask the user to clarify before proceeding.
   - If the user specifies a focus (e.g., "Compute Engine only"), respect that scope. Otherwise, **audit all services** — compute, storage, databases, networking, serverless, containers, AI/ML, security, and any other active resources.

2. **Load required skills** (MUST complete before any analysis):
   - **Always load** the `fabrico-technical-context-discovering` skill (the **Read** tool on `.claude/skills/fabrico-technical-context-discovering/SKILL.md`) — follow its process to identify existing IaC patterns, labeling conventions, and project context.
   - **Always load** the `fabrico-codebase-analysing` skill (the **Read** tool on `.claude/skills/fabrico-codebase-analysing/SKILL.md`) — even if no IaC files are found initially, this skill's Step 7 (infrastructure code) helps identify IaC in unexpected locations, and Step 2 (dependencies) reveals infrastructure-related dependencies in any project.
   - **Always load** the `fabrico-optimizing-cloud-cost` skill (the **Read** tool on `.claude/skills/fabrico-optimizing-cloud-cost/SKILL.md` and `references/tagging-standards.md`) — use its GCP columns in the Pricing Model Decision table, Storage Tiering Decision table, Process steps, Checklist, and Anti-Patterns. Adapt the "Core 5" Mandatory Tags for GCP as **labels**: `cost_center`, `environment`, `service`, `owner`, `data_class` (lowercase with underscores — GCP label format). If the skill file cannot be found, use the following hardcoded defaults for the Core 5 Mandatory Labels: `cost_center`, `environment`, `service`, `owner`, `data_class`.
   - **Conditionally load** the `fabrico-designing-multi-cloud-architecture` skill (the **Read** tool on `.claude/skills/fabrico-designing-multi-cloud-architecture/SKILL.md`) — load when evaluating GCP service alternatives or comparing GCP services against each other. Use its GCP service comparison tables for compute, storage, database, and networking decisions.
   - **Conditionally load** the `fabrico-implementing-terraform-modules` skill (the **Read** tool on `.claude/skills/fabrico-implementing-terraform-modules/SKILL.md` and `references/gcp-modules.md`) — load when Terraform files (`*.tf`, `*.tfvars`, `terragrunt.hcl`) are found. Use it as the reference standard for module structure, naming conventions, provider pinning, and GCP-specific module patterns when evaluating IaC quality and generating Terraform code.
   - **Conditionally load** the `fabrico-managing-secrets` skill (the **Read** tool on `.claude/skills/fabrico-managing-secrets/SKILL.md`) — load when the audit scope includes security (which is always for a full audit). Use its Security Checklist, Anti-Patterns, and Cloud-Native Detection patterns when evaluating secrets management, Cloud KMS keys, and credential handling.
   - **Fallback**: If any skill file cannot be loaded, log the failure, note the skill gap in the final report's Executive Summary, and proceed with available skills.
   - Do **not** proceed to step 3 until all applicable skills have been read and their processes initiated.

3. **IaC-first discovery** (hybrid approach — IaC then API):
   - Apply the `fabrico-technical-context-discovering` skill process loaded in step 2.
   - **Phase A — Terraform/IaC analysis** (if available):
     - Search the current workspace for Terraform files (`*.tf`, `*.tfvars`, `terragrunt.hcl`) and Deployment Manager templates (`*.yaml`, `*.jinja` with GCP resource types).
     - If found:
       - Apply the `fabrico-codebase-analysing` skill (loaded in step 2) — specifically run its infrastructure code analysis (Step 7), dependency check (Step 2), and dead code/duplication check (Step 12)

Maintain Fabrico Analyze Gcp Costs?

Let people know it's listed here — add the badge (live metrics, light/dark aware) or a plain link to your README or docs.

[Fabrico Analyze Gcp Costs on getagentictools](https://getagentictools.com/loops/aifabricocom-fabrico-analyze-gcp-costs?ref=badge)