Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

google-cicd-terraform

БесплатноБез исполняемых скриптовНе проверен

Architect, provision, and troubleshoot infrastructure on Google Cloud using Terraform. This skill ensures best practices like GCS backend usage and…

googleот google★ 25 380 звёзд на GitHub

Об этом скилле

Terraform GCP Skill

Usage Attribution

MUST READ: Before executing any gcloud, REST API, or MCP command, you MUST read and follow the instructions in Usage Attribution.

This skill provides expert-level guidance for architecting, deploying, and managing GCP infrastructure using Terraform.

Prerequisites

Ensure the following prerequisites are satisfied before executing live commands:

  • CLI & Billing: Install Terraform (>= 1.6.0), tflint, and the Google Cloud SDK (gcloud), and attach an active billing account to the target project.
  • Authentication & Project: Authenticate via gcloud auth login and gcloud auth application-default login (or set GOOGLE_APPLICATION_CREDENTIALS for CI service accounts), then set the project and region (e.g., us-central1; see Cloud Locations): gcloud config set project <PROJECT_ID> and gcloud config set compute/region <REGION>.
  • API Enablement & IAM: Enable required APIs (with user confirmation) via gcloud services enable cloudresourcemanager.googleapis.com serviceusage.googleapis.com iam.googleapis.com storage.googleapis.com cloudbuild.googleapis.com developerconnect.googleapis.com artifactregistry.googleapis.com run.googleapis.com container.googleapis.com, and follow least-privilege IAM roles per iam-and-security.md.

🎯 When to Use This Skill

  • Designing GCP Landing Zones (Projects, Folders, Shared VPCs).
  • Provisioning Google Cloud resources (GKE, Cloud Run, Cloud SQL, Spanner).
  • Setting up remote state management via GCS Backend.
  • Implementing IAM least-privilege via Terraform.
  • Troubleshooting terraform plan discrepancies in GCP (see troubleshooting-gcp.md).

🏗️ Core Architecture: GCS Backend & State

Always use a GCS backend for state. Local state is strictly for local prototyping and must never be committed. If local state directory is used, add it to .gitignore.

Standard Backend Configuration

terraform {
  backend "gcs" {
    # Variables (var.*) are not allowed in backend blocks; set literal values
    # or pass via: terraform init -backend-config="bucket=tf-state-<PROJECT_ID>"
    bucket = "tf-state-<PROJECT_ID>"
    prefix = "terraform/state/<ENVIRONMENT>"
  }
}

Note: The GCS bucket must have Object Versioning enabled to allow recovery from accidental state corruption or overlapping writes.

Required Provider Version

Use the Google Cloud Terraform provider version 7.20.0 or higher. This skill utilizes features (e.g., Developer Connect) introduced in Google Provider v7.20.0.

terraform {
  required_version = ">= 1.6.0"

  required_providers {
    google = {
      source  = "hashicorp/google"
      version = ">= 7.20.0"
    }
  }
}

To retrieve the latest version of the Google provider, use the following command:

curl -s https://registry.terraform.io/v1/providers/hashicorp/google | jq -r .version

🛠️ Execution Protocol (Safety First)

The Agent must follow this lifecycle for every infrastructure change to ensure idempotency and prevent production outages:

  1. Initialize (terraform init):

    • Verify backend connectivity.

    • Ensure provider plugins are downloaded and versions are locked in .terraform.lock.hcl.

  2. Validate (terraform validate & tflint):

    • Check for internal HCL consistency.

    • Run tflint with the Google plugin to catch cloud-specific deprecated fields or non-optimal configurations.

  3. Plan (terraform plan -out=tfplan):

    • Generate a speculative execution plan.

    • Mandatory Step: The Agent must summarize the plan for the user, specifically highlighting any Destroy actions.

  4. Apply (terraform apply tfplan):

    • Strict Constraint: Only execute the application after the user provides explicit manual confirmation.

🔍 Live Provider Documentation Lookup

To prevent hallucinations regarding new fields or deprecated attributes, the Agent must verify the grounded truth of the provider schema.

Schema Inspection via CLI

The primary command for retrieving the machine-readable schema of the currently initialized providers is:

$ terraform providers schema -json

🛡️ GCP-Specific Standards

  1. Resource Naming & "Main" Pattern: To maintain a clean module interface, use the main identifier for singleton resources (the primary resource the module is named after). Use underscores for identifiers and hyphens for names (see naming-conventions.md).

    resource "google_compute_network" "main" {
      name                    = "${var.prefix}-vpc"
      auto_create_subnetworks = false
    
Полный SKILL.md на GitHub

Установить google-cicd-terraform в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Без ограничений — скилл может использовать любой инструмент.

Вложенные файлы

references/attribution.mdreferences/gcp-networking-patterns.mdreferences/iam-and-security.mdreferences/naming-conventions.mdreferences/style-and-structure.mdreferences/testing-and-mocking.mdreferences/troubleshooting-gcp.md

FAQ

Что делает скилл google-cicd-terraform?

Architect, provision, and troubleshoot infrastructure on Google Cloud using Terraform. This skill ensures best practices like GCS backend usage and least-privilege IAM are followed. Enforces Google's Cloud Foundation Fabric patterns and rigorous validation protocols to ensure secure, idempotent, and scalable deployments across environments. Activate when the user requests infrastructure changes, pipeline design involving Terraform, or debugging Terraform issues. DO NOT use when deploying application code or container images directly via `gcloud` or `kubectl` without Terraform (use `google-cicd-deploy`), designing high-level CI/CD architecture before choosing an IaC tool (use `google-cicd-pipeline-design`), or managing Cloud Deploy releases and rollouts via `clouddeploy.yaml` (use `google-cicd-release-orchestration`).

Как установить скилл google-cicd-terraform?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл google-cicd-terraform запускает скрипты?

Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.

Похожие скиллы

Сравнить google-cicd-terraform с