google-cicd-terraform
БесплатноБез исполняемых скриптовНе проверенArchitect, provision, and troubleshoot infrastructure on Google Cloud using Terraform. This skill ensures best practices like GCS backend usage and…
от 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 loginandgcloud auth application-default login(or setGOOGLE_APPLICATION_CREDENTIALSfor CI service accounts), then set the project and region (e.g.,us-central1; see Cloud Locations):gcloud config set project <PROJECT_ID>andgcloud 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 plandiscrepancies 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:
Initialize (
terraform init):Verify backend connectivity.
Ensure provider plugins are downloaded and versions are locked in
.terraform.lock.hcl.
Validate (
terraform validate&tflint):Check for internal HCL consistency.
Run
tflintwith the Google plugin to catch cloud-specific deprecated fields or non-optimal configurations.
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.
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
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
Установить google-cicd-terraform в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
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), без исполняемых скриптов.
Похожие скиллы
mcp-builder
Guide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when…
от Anthropicclaude-api
Reference for the Claude API / Anthropic SDK — model ids, pricing, params, streaming, tool use, MCP, agents, caching, token counting, model migration. TRIGGER…
от Anthropicalgorithmic-art
Creating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code…
от Anthropicmcp-integration
This skill should be used when the user asks to "add MCP server", "integrate MCP", "configure MCP in plugin", "use .mcp.json", "set up Model Context…
от Anthropic