
GCP Modular Terraform Architect
FreeStreamline cloud architecture design and validation.
Free · Opens the source repo
What GCP Modular Terraform Architect does
The GCP Modular Terraform Architect skill is designed for developers and architects who need to create modular Terraform configurations for Google Cloud Platform (GCP). It guides users through a structured four-phase design cycle that ensures compliance with architectural goals and best practices. Each phase is critical, starting with the ingestion of user intent and catalog queries, followed by high-level architecture planning, module generation with CLI validation, and concluding with a semantic review to ensure the design meets specified requirements.
This skill emphasizes modular design and strict adherence to naming conventions and HCL style guidelines. Users are instructed to prioritize private catalog templates over public ones, ensuring that project-specific customizations are respected. The skill also mandates the use of GCP Secret Manager for managing sensitive information, ensuring that no plaintext secrets are included in the generated configurations. This focus on security and modularity makes it a valuable tool for teams looking to maintain high standards in their infrastructure as code practices.
The structured approach of this skill not only enhances productivity but also reduces the risk of errors in cloud architecture design. By following the explicit phases, users can systematically address their architectural needs while validating their configurations locally before deployment. This is particularly useful for teams working in agile environments where rapid iteration and validation are essential.
Overall, the GCP Modular Terraform Architect skill is a robust solution for developers looking to streamline their cloud infrastructure design process while adhering to best practices in modular architecture and security.
When to use it
Use this skill when designing modular Terraform architectures and validating HCL configurations locally before deployment.
When not to use it
This skill is not suitable for deploying templates or troubleshooting deployment failures, as its focus is on design and validation only.
What you can build with it
Designing a New Cloud Service
Use this skill to create a modular Terraform configuration for a new cloud service, ensuring it meets architectural goals.
Validating HCL Configurations
Leverage the skill to validate your local HCL files against GCP best practices before deployment.
Integrating with Private Catalogs
Utilize the skill to prioritize and integrate private catalog templates into your Terraform configurations.
How to install GCP Modular Terraform Architect
View source1. Install with the skills CLI
npx skills add google/skills/design --agent claude-code2. Or install it manually
Download the skill folder and drop it into ~/.claude/skills/ for all projects, or .claude/skills/ to scope it to one repo. Restart Claude Code so it picks up the new skill.
Anthropic's agentic coding CLI, and the reference implementation of Agent Skills. Drop a skill folder into ~/.claude/skills and Claude Code loads it automatically whenever a task matches the skill's description. Claude Code docs
Inside SKILL.md
Written by googleSimplified GCP Modular Terraform Architect Skill
This skill performs an agentic design cycle around a 4-phase generation pipeline:
graph LR
A[1. Ingest Intent & Catalog Query] --> B[2. High-Level Architecture Planning]
B --> C[3. Module-Only Gen & CLI Validation]
C --> D[4. Semantic Review & Handover]
D -->|"Goals Unmet"| B
You MUST follow these 4 explicit phases strictly in order. You must not skip phases. If the semantic review in Phase 4 determines that the configuration does not fully meet the user's architectural goals or intent, you MUST loop back to Phase 2 to replan and regenerate.
⚠️ Strict Architectural Constraints
All generated configurations must prioritize the modular structure while adhering to naming and HCL style constraints. Refer to:
../generator_instructions.mdfor generation constraints and project defaults.../terraform_validator_instructions.mdfor semantic validation rules.
General defaults & policies:
- Default Network and Subnetwork: Target the pre-existing VPC network and
subnetwork both named
"default"in<project_id>unless otherwise specified. - Secret-Safe Policy (MANDATORY): NEVER write plaintext passwords, API
keys, or credentials in HCL code or
terraform.tfvars. All secrets must be declared as resources in GCP Secret Manager (using theterraform-google-secret-managermodule) and referenced dynamically by target services. - State Isolation Policy (MANDATORY): Keep the Terraform state local in
the scratch folder for validation. NEVER generate a remote backend block
(e.g.,
backend "gcs" {}), as remote state is managed dynamically by the parent orchestrator/deployment registry.
Phase 1: Ingest Intent & Catalog Query
-
Load Inputs: Ingest user goals and instructions.
-
Query Catalog Registry (Private and Public): To supplement the design, search both your project's custom private catalog and the public Google catalog by calling the native
manage_catalogMCP tool with theCATALOG_OPERATION_LIST_COMPONENTSoperation.-
Query Private Catalog (Target Space):
-
ServerName:
application_design_center -
ToolName:
manage_catalog -
Arguments:
{ "project": "<project_id>", "location": "<location>", "spaceId": "<space_id>", "operation": "CATALOG_OPERATION_LIST_COMPONENTS" }
-
-
Query Public Google Catalog:
-
ServerName:
application_design_center -
ToolName:
manage_catalog -
Arguments:
{ "project": "gcpdesigncenter", "location": "us-central1", "spaceId": "googlespace", "catalogId": "googlecatalog", "operation": "CATALOG_OPERATION_LIST_COMPONENTS" }
-
- Priority Rule: You MUST prioritize using private catalog templates (found in your target space) over public Google ones to ensure project-specific customizations are respected.
-
-
Get Module Details: Fetch detailed module metadata containing inputs, outputs, and dependencies by calling the native
manage_catalogMCP tool with theCATALOG_OPERATION_GET_COMPONENT_METADATAoperation (orCATALOG_OPERATION_GET_COMPONENT_IACto retrieve the underlying Terraform source code directly):-
MCP Tool Call:
-
ServerName:
application_design_center -
Tool Name:
manage_catalog -
Arguments:
{ "project": "<project_id>", "location": "<location>", "spaceId": "<space_id>", "catalogTemplateId": "<short_module_id>", "catalogTemplateRevisionId": "<revision_id>", "operation": "CATALOG_OPERATION_GET_COMPONENT_METADATA" }
-
- Constraint: Pass only the short module ID (e.g.,
cloud-run-job, which is the last segment of the fully qualified resource name), NOT the full resource name path returned by the list command.
[!IMPORTANT] To ensure your local HCL declarations perfectly match the version constraints validated by the Design Center registry, you MUST extract the precise Git repository tag from the registry and use it in your HCL module
source.The
gitSourcemetadata block (includingrefTag,repo, anddir) is returned directly in the output of themanage_catalogMCP tool (under thegitSourcefield).If you need to fallback to the CLI to describe the revision details, you can run the
describecommand directly using the revision URI retrieved from the MCP tool:gcloud design-center spaces catalogs templates revisions describe <revision_uri>-
Extract the fields from the
gitSourceblock:gitSource: dir: modules/v2 refTag: v0.33.0 repo: GoogleCloudPlatform/terraform-google-cloud-run -
Construct the HCL
sourceURI using the patterngithub.com/<repo>//<dir>?ref=<refTag>:source = "github.com/GoogleCloudPlatform/terraform-google-cloud-run//modules/v2?ref=v0.33.0"
-
Phase 2: High-Level Architecture Planning
-
Resource Initialization (MANDATORY): Before formulating any plan, you MUST read instructions from
../planner_instructions.md. Do not proceed until these instructions are in your active context. -
Design the High-Level Architecture: Based on the modules identified in Phase 1, plan the design topology connecting the key modular building blocks (VPC, Compute, Databases, Security).
-
Formulate Integration Pattern Decisions: Determine core pattern layout decisions (such as GKE vs. Cloud Run computing model, storage engines, network boundaries, private interconnects, and database hosting structures) using available modules.
- Note: Follow Google best practices while formulating a pattern. For
example:
- Always use Secret Manager to store and reference database credentials instead of using passphrases as input parameters.
- Use Private Service Connect instead of public access for private connectivity.
- Note: Follow Google best practices while formulating a pattern. For
example:
-
Gather pre-existing reusable TF modules: Check if there are any preexisting TF modules from the catalog to understand available building blocks to create end to end solution matching user intent. Catalog contains modules public catalog (published by GCP) and private catalog owned by the customer. When there is a duplicate module between public and private catalog, always prefer private catalog component/module. Inspect the selected modules by calling the native
manage_catalogMCP tool with theCATALOG_OPERATION_GET_COMPONENT_METADATAoperation to verify inputs, outputs, required inputs, and reference outputs:-
MCP Tool Call:
-
ServerName:
application_design_center -
Tool Name:
manage_catalog -
Arguments:
{ "project": "gcpdesigncenter", "location": "us-central1", "spaceId": "googlespace", "catalogId": "googlecatalog", "operation": "CATALOG_OPERATION_GET_COMPONENT_METADATA", "catalogTemplateId": "<module_id>" }
-
- Constraint: Use the short module ID (the last segment of the resource
name, e.g.,
cloud-run-job), NOT the full resource path starting withprojects/.... If querying a private catalog, update theproject,spaceId, andcatalogIdarguments accordingly.
-
-
Review End to End Solution Templates: Review well-architected solutions published by GCP as well as solutions published by the customer's own organization. Use these solutions as reference architectures when applicable. To explore available templates, run the local CLI script
list_terraform_templatesto see if a pre-existing application template can serve as your design baseline. You MUST pass your active target project ID and space ID to retrieve both public Google templates and private templates:python3 scripts/list_terraform_templates.py --project="<project_id>" --space_id="<space_id>" --catalog_id="<catalog_id>"- Priority Rule: In the returned list, private application templates
appear first (marked with
"source": "private"). You MUST prioritize using private application templates over public Google ones (marked with"source": "google") if a suitable private template is available!
- Priority Rule: In the returned list, private application templates
appear first (marked with
-
Fetch Terraform Template: Fetch the baseline template config to your local workspace by running the local CLI script
fetch_terraform_template. You MUST pass your active target project ID and space ID:python3 scripts/fetch_terraform_template.py <template_id> --project="<project_id>" --space_id="<space_id>" --out_dir="<target_directory_path>"(the output directory will be created automatically if it does not exist).
-
Review Planner Principles: Crosscheck planning directives in planner_instructions.md.
Phase 3: Module-Only Generator & CLI Validation Loop
-
Resource Initialization (MANDATORY): Before writing any HCL, you MUST read instructions from
../generator_instructions.md. Do not proceed until these instructions are in your active context. -
Generate Raw HCL: Write standard Terraform code, prioritizing module blocks as much as possible, or using direct resources where no suitable module is available, based on rules in the loaded instructions.
-
Save Configuration File: Create a dedicated workspace scratch directory unique to this execution/session (e.g.
scratch/tf_validate_{session_id}/, using the session, conversation, or a unique run ID to avoid concurrent executions overwriting one another) and write the generated HCL code split into:providers.tf: Provider and terraform blocks.main.tf: Module and resource declarations.variables.tf: Variable declarations.terraform.tfvars: Variable values.outputs.tf: Output declarations.
-
Semantic Architecture Validation (MANDATORY): Before running any CLI validation, you MUST read instructions from
../terraform_validator_instructions.md. Perform a comprehensive semantic audit to ensure the configuration complies with the validator guidelines (preferring modules over resources, no custom variables, correct GitHub source formatting, etc.). Do not proceed until these instructions are in your active context. -
Execute Local CLI Validation Check (CRITICAL):
-
Initialize the directory using the Terraform CLI directly to pull CFT sources and download provider plugins:
terraform -chdir=scratch/tf_validate_{session_id}/ init -
Validate HCL block structures and type connections using the Terraform CLI directly:
terraform -chdir=scratch/tf_validate_{session_id}/ validate -
Dry-run resource changes and verify configuration feasibility with the Terraform CLI:
terraform -chdir=scratch/tf_validate_{session_id}/ plan -
Remediation Loop: If errors or warnings are reported by the Terraform CLI during initialization, validation, or planning, correct
main.tfand repeat the check commands until clean.
-
Phase 4: Semantic Review & Handover
Your final modular code must be clean, robust, and securely wired.
-
Semantic Review & Goal Alignment: Audit the validated configuration against the user's intent and architectural constraints. If the architecture fails to meet the goal or requires adjustment, loop back to Phase 2: High-Level Architecture Planning to replan and regenerate.
-
Deliver Architectural Rationale: Output a clear, thorough final report that describes:
- The High-Level Architecture Layout: Clear overview detailing each module or resource block and its structural role in the GCP infrastructure.
- The Architectural Rationale: Explicit decisions for why specific compute systems, boundaries, and database models were picked. Explain the necessity of using direct resources if any were created instead of modules. If multiple products were considered, include rationale for product choice.
- The Inter-Module Topology & Dataflow: A descriptive text-based walk-through of how data flows between the VPC network boundaries, computing blocks, and dependent database components.
-
Output Intact Terraform Code: Read each generated file (including
.tfand.tfvarsfiles) in the target validation directory (using your standard file viewing/reading tools) and output its exact, intact HCL configuration in your final response. Each file MUST be formatted as:File: `<path>` ```hcl [content] ```Ensure you output the complete and exact file contents for all final validated files.
Reporting Issues
Report bugs or improvements for this skill at Google Skills Issues.
Frequently asked questions about GCP Modular Terraform Architect
Similar skills
Turborepo
Optimized build system for JavaScript/TypeScript monorepos.
Azure Pipelines Validation
Streamline your Azure DevOps pipeline changes locally.
Azure Developer CLI
Streamline your Azure project workflows with best practices.
Azure Container Registry CLI
Manage Azure Container Registry resources with ease.
Aspire
Build and orchestrate polyglot distributed applications seamlessly.
Vercel CLI
Manage and deploy Vercel projects from the command line.
