terraform

Provision cloud and Kubernetes infrastructure with Terraform modules, state backends, and plan/apply workflows.

3|1|Updated Nov 19, 2025
One-click install
npx skills add https://github.com/lukaskellerstein/claude-my-marketplace --skill terraform-lukaskellerstein
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: terraform
Source: https://github.com/lukaskellerstein/claude-my-marketplace/tree/main/plugins/infra-plugin/skills/terraform
Command: npx skills add https://github.com/lukaskellerstein/claude-my-marketplace --skill terraform-lukaskellerstein

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Writing production-grade Terraform configurations from scratch is error-prone: teams struggle with remote state setup, module structure, GCP resource patterns, and safe CI/CD automation. This Skill provides canonical HCL patterns and operational guidance so infrastructure is provisioned consistently and safely. ## Core Features & Use Cases - HCL Fundamentals: Canonical provider pinning, variables with validation, outputs, locals, and data sources. - State & Modules: GCS remote state with locking, state operations (mv/rm/import), and a complete reusable GKE cluster module example. - GCP Resource Patterns: Ready-to-adapt stanzas for VPC networking, IAM service accounts, and Cloud SQL with environment-conditional sizing. - Advanced Patterns & CI/CD: for_each, dynamic blocks, lifecycle rules, plus a GitHub Actions workflow using workload identity federation for plan-on-PR and apply-on-merge. - Use Case: You need to stand up a GKE cluster with a VPC, least-privilege node service account, and remote state. Load the relevant reference files to get working module, networking, and backend configurations, then wire them into a GitHub Actions pipeline. ## Quick Start Ask the assistant to help you write a Terraform configuration for a GKE cluster with remote state in GCS and a GitHub Actions pipeline that plans on pull requests.

Frequently Asked Questions about terraform

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I set up Terraform remote state with GCS?▼

Configure a gcs backend block in backend.tf pointing to a state bucket with a per-environment prefix. Create the bucket with gsutil, enable versioning, and the GCS backend provides state locking automatically; use terraform force-unlock only for stale locks.

How do I create a reusable Terraform module for a GKE cluster?▼

A module is a directory with main.tf, variables.tf, and outputs.tf. Define the google_container_cluster and node pool resources with input variables, expose endpoint and CA certificate as sensitive outputs, then consume it with a module block from each environment directory.

How do I run Terraform in GitHub Actions securely?▼

Use workload identity federation with the google-github-actions/auth step instead of service account keys. A typical workflow runs terraform plan on pull requests with the plan posted as a comment, and terraform apply only on merges to main.

When should I use for_each versus count in Terraform?▼

Use for_each with a set or map when creating one resource per element, since resources are tracked by key and survive reordering. Use count with a ternary condition for simple on/off resources, such as creating a static IP only in production.

How do I import existing GCP resources into Terraform state?▼

Run terraform import with the resource address and provider-specific ID, such as projects/PROJECT/locations/REGION/clusters/CLUSTER for a GKE cluster. On Terraform 1.5+, use terraform plan -generate-config-out to generate matching configuration automatically.

Why does my Terraform run fail with a state lock error?▼

A lock error means another run holds the state lock or a previous run crashed leaving a stale lock. Verify no active run exists, then use terraform force-unlock with the lock ID shown in the error message.