All skills
google avatar

/application-design-center-design-deploy

@becc4b8
by googlegoogle/skills21k stars
1,698

Processes GCP infrastructure design and deployment workflows within Application Design Center (ADC). Use when: - Designing GCP infrastructure with Terraform. - Validating local HCL. - Performing best-practice plan scans. - Importing templates to Application Design Center (ADC). - Deploying templates. - Troubleshooting deployment failures. Boundaries: - Only use for GCP-specific cloud infrastructure. - Only use for Terraform coding within the ADC context.

Use this Skill: https://skilld.dev/gh/google/skills/application-design-center-design-deploy

This session only. Nothing lands on disk.

referencesgenerator_instructions.md

≈2.1k tokens on demand. Your agent reads this file only when SKILL.md points to it.

Generator & Code Builder CLI Instructions

You generate raw Terraform configurations, prioritizing module declarations as much as possible or using direct resources where modules are unavailable or insufficient, ensuring a fully static, well-architected production layout.


1. Strict HCL and Resource Constraints

  • Module Preference over Direct Resources: Prioritize using approved modules from the registry or templates as much as possible. Direct resource blocks are allowed ONLY when no approved module is available or to complement modular configurations where direct resource definition is necessary.
  • Match Input Code Style: If the user provides existing HCL/Terraform code as part of their prompt or input files, prioritize matching their style and structure exactly. Do not rewrite their code to use modules unless explicitly requested.
  • Enforce Pinned GitHub Source Format: Under all circumstances, all module block source declarations MUST use their Git/GitHub repository source path (e.g., github.com/... with https:// prefix removed) instead of the Terraform Registry format.
  • Mandatory Version Pinning (CRITICAL): The Git source URI MUST always contain the ref tag (e.g., ?ref=vX.Y.Z). This tag MUST be exactly the same as the refTag declared in the gitSource metadata of the corresponding component resource in the Design Center registry. You MUST query the component's active revision metadata (using gcloud alpha design-center spaces catalogs templates revisions describe) to extract the exact refTag (e.g., v0.33.0) and construct the pinned source path. For example, use "github.com/GoogleCloudPlatform/terraform-google-cloud-run//modules/v2?ref=v0.33.0" instead of a version-less path.
  • Use Configurable Variables: Parameterize your configuration using variable blocks for environment-specific values (like project ID, region, resource names). Define these variables in variables.tf and provide default values in terraform.tfvars.
  • Allowed Standard HCL Blocks: Standard terraform, provider, variable, and output blocks are fully allowed.
    • DO use output blocks to expose key references (endpoints, connection names).
    • MUST DO: You MUST include standard terraform (declaring required providers like hashicorp/google with a minimum version query) and provider "google" blocks configured with appropriate defaults (such as targeting project "test-cf-1" and region "us-central1"). Failing to include these configuration definitions will break the hermetic local validation routine (terraform init/validate/plan) performed in Phase 3.
  • NO Complex HCL Logic: Do NOT use iteration syntax (for_each, count), conditional ternary logic, or locals blocks unless explicitly required. Keep structures flat and declarative.

2. Project Context

  • Target Project ID: Always assume that the target GCP project context is established. The default project ID is "test-cf-1". When parameterizing input fields or passing a project ID to any modules, use "test-cf-1" directly, unless the user explicitly specifies a different project ID.
  • Static Project Definitions: Do not dynamically fetch or lookup the project ID; use "test-cf-1" statically in module inputs or provider definitions.

3. Inter-Module Bindings & Syntax

  • Parameter Wiring: Pass output parameters from one active module to another to establish bindings:

    module "my_service" {
      source       = "github.com/GoogleCloudPlatform/terraform-google-cloud-run//modules/v2"
      vpc_network  = module.my_network.network_name
      db_connector = module.my_database.instance_connection_name
    }
  • Never Hardcode Linked Configurations: Links between layers (e.g., subnets, databases, IAM service accounts) must always reference their exporter module outputs, unless referencing pre-existing resources like the pre-established network and subnetwork both named "default".

  • Resource attributes: If a direct resource is really necessary, configure the resource parameters correctly using attributes supported by the GCP provider.


4. Local Terraform Validation Routine (CRITICAL)

You MUST write the code to a local file and test its syntactic correctness directly using the Terraform CLI:

  1. Create a Validation Folder: Create a unique temporary workspace directory inside the user's active workspace (e.g., scratch/tf_validate_<session_id>/, where <session_id> is a unique run, conversation, or session ID) to guarantee concurrent executions do not overwrite one another.

  2. Save the Configuration: Save your raw configuration split into standard files in scratch/tf_validate_<session_id>/:

    • providers.tf: Provider and terraform blocks.
    • main.tf: Module and resource declarations.
    • variables.tf: Variable declarations.
    • terraform.tfvars: Variable values.
    • outputs.tf: Output declarations.
  3. Initialize the Directory: Initialize the catalog source modules and core google providers by running terraform init inside that directory:

    terraform -chdir=scratch/tf_validate_<session_id>/ init
  4. Run Validation: Run terraform validate to ensure all inputs, connections, and block values map correctly:

    terraform -chdir=scratch/tf_validate_<session_id>/ validate
  5. Generate Execution Plan: Run terraform plan to dry-run resource changes and verify configuration feasibility:

    terraform -chdir=scratch/tf_validate_<session_id>/ plan
    • If any of the CLI commands print failures, errors, or configuration mismatches during initialization, validation, or planning, modify main.tf to resolve them and repeat.

5. Architecture-Aware Parameterization

  • Architecture-Aware Parameterization: Configure module parameters to align with specified architectural requirements instead of relying on minimalist, single-instance defaults. For example, if a high-availability database setup is requested, ensure you configure the module with appropriate parameters (e.g., multiple read replicas for a MySQL instance, multi-zone/regional failover, etc.).

6. Unique Module Instance Naming (CRITICAL)

To prevent naming conflicts (e.g., 409 Conflict) when deploying multiple instances or redeploying after a failed run:

  • Parameterize Module Naming Inputs: Always expose the key name-identifying inputs of your modules (e.g., the name parameter in the database or secret modules, the service_name in the Cloud Run module) as variables in variables.tf.
  • Use Unique Defaults: In terraform.tfvars (or as default values in variables.tf), do not use generic static names. Instead, append a random 5-character alphanumeric suffix to the value (e.g., webapp-db-a1b2c, webapp-frontend-x7y9z, db-password-f3g4h).
  • Avoid Hardcoding in Modules: Never hardcode these naming inputs directly inside the module blocks in main.tf. Always reference the corresponding variable (e.g., name = var.db_instance_name).

7. Architecture Layout Review

After local validation commands pass cleanly, perform a final architectural verification check:

  1. Link Integrity: Perform a comprehensive audit to ensure all module or resource interface mappings connect cleanly.
  2. Constraint Integrity: Verify that the configuration prioritizes modules as much as possible, using direct resources only when a suitable module is unavailable or to complement modular structures where direct resource definition is necessary.

Source: SKILL.md on GitHub

No alerts10d3 checks · Risk SAFE
  • Gen Agent Trust Hub10d

    This skill facilitates the design and deployment of GCP infrastructure using Terraform and Google Application Design Center. It incorporates security best practices such as mandatory secret management and local state isolation. External operations are restricted to trusted official repositories and Google Cloud services.

  • Socket10d

    No alerts

  • Snyk10d

    Risk: LOW · No issues

Signed by skilld at becc4b8. This ties the file your Agent reads to that commit on GitHub. It does not review the instructions.

Last checked against GitHub yesterday.

Activeupdated 2 weeks ago
Other metadata
metadata
{
  "version": "1.0.0",
  "publisher": "google",
  "category": "CloudInfrastructure"
}

README badge

README badge for google/skills/application-design-center-design-deploy