terraform-basics
Provision and manage cloud infrastructure using Infrastructure as Code. Use when creating or modifying GCP resources, managing Pub/Sub topics and subscriptions, configuring IAM bindings, deploying multi-environment infrastructure, or tracking infrastructure state. Works with GCP, Kubernetes, and remote state management.
What this skill does
# Terraform Skill
## Quick Start
Deploy Pub/Sub topics to GCP in 3 minutes:
```bash
# 1. Initialize (downloads providers, sets up backend)
terraform init
# 2. Preview changes
terraform plan
# 3. Apply
terraform apply -auto-approve
```
Terraform configuration:
```hcl
# main.tf
terraform {
required_providers {
google = {
source = "hashicorp/google"
version = "~> 5.26.0"
}
}
backend "gcs" {
prefix = "supplier-charges-hub"
bucket = "my-terraform-state" # Must exist
}
}
provider "google" {
project = "ecp-wtr-supplier-charges-${var.environment}"
region = var.region
}
resource "google_pubsub_topic" "incoming" {
name = "supplier-charges-incoming-${var.environment}"
}
```
## When to Use
- Provision cloud infrastructure (GCP resources)
- Manage infrastructure as code
- Deploy multi-environment setups
- Configure IAM bindings
- Track infrastructure state
**Triggers:**
- "Deploy infrastructure to GCP"
- "Create Pub/Sub topics with Terraform"
- "Set up remote state"
- "Configure GCP provider"
## Key Concepts
### Remote State (Required)
```hcl
terraform {
backend "gcs" {
bucket = "terraform-state-prod"
prefix = "supplier-charges-hub"
}
}
```
**Why?**
- Team collaboration (single source of truth)
- State locking (prevents concurrent modifications)
- Backup and encryption
### Provider Configuration
```hcl
terraform {
required_providers {
google = {
source = "hashicorp/google"
version = "~> 5.26.0"
}
}
}
provider "google" {
project = "my-project"
region = var.region
}
```
### Variables with Validation
```hcl
# variables.tf
variable "environment" {
type = string
default = "labs"
validation {
condition = contains(["labs", "test", "prod"], var.environment)
error_message = "Environment must be: labs, test, or prod"
}
}
```
### Resources
```hcl
# pubsub.tf
resource "google_pubsub_topic" "incoming" {
name = "supplier-charges-incoming"
message_retention_duration = "604800s" # 7 days
}
resource "google_pubsub_subscription" "incoming_sub" {
name = "supplier-charges-incoming-sub"
topic = google_pubsub_topic.incoming.name
ack_deadline_seconds = 60
dead_letter_policy {
dead_letter_topic = google_pubsub_topic.dlq.id
max_delivery_attempts = 5
}
}
```
### IAM Permissions
```hcl
# iam.tf
resource "google_pubsub_topic_iam_member" "publisher" {
topic = google_pubsub_topic.incoming.name
role = "roles/pubsub.publisher"
member = "serviceAccount:${data.google_service_account.app.email}"
}
```
### Outputs
```hcl
# outputs.tf
output "pubsub_topic_name" {
description = "Name of the Pub/Sub incoming topic"
value = google_pubsub_topic.incoming.name
}
```
## Common Commands
```bash
# Initialize
terraform init
# Preview changes
terraform plan
# Apply changes
terraform apply
# View current state
terraform state list
# Destroy infrastructure (WARNING!)
terraform destroy
# Format code
terraform fmt -recursive
# Validate syntax
terraform validate
```
## Multi-Environment Pattern
```hcl
# terraform.tfvars.labs
environment = "labs"
# terraform.tfvars.prod
environment = "prod"
```
Apply to different environments:
```bash
terraform apply -var-file="terraform.tfvars.labs"
terraform apply -var-file="terraform.tfvars.prod"
```
## Requirements
- Terraform 1.x+
- GCP credentials (via `gcloud auth application-default login`)
- GCS bucket for remote state (pre-created)
- IAM permissions in GCP (Owner or Editor)
**Installation:**
```bash
# macOS
brew install terraform
# Verify
terraform version
```
## See Also
- **Core Concepts**: Resources, Data Sources, Providers, Backends
- **Best Practices**: Naming Conventions, Variable Validation
- **Security**: Secrets Management, IAM Bindings
- **State Management**: Remote State, Locking
Related in Cloud & DevOps
appbuilder-action-scaffolder
IncludedCreate, implement, deploy, and debug Adobe Runtime actions with consistent layout, validation, and error handling. Use this skill whenever the user needs to add actions to an App Builder project, understand action structure (params, response format, web/raw actions), configure actions in the manifest, use App Builder SDKs (State, Files, Events, database), deploy and invoke actions via CLI, debug action issues, or implement patterns such as webhook receivers, custom event providers, journaling consumers, large payload redirects, action sequence pipelines, and Asset Compute workers. Also trigger when users mention serverless functions in Adobe context, action logging, IMS authentication for actions, or cron-style scheduled actions.
orchestrating-datacloud
IncludedSalesforce Data Cloud product orchestrator for connect→prepare→harmonize→segment→act workflows. Use this skill when the user needs a multi-step Data Cloud pipeline, cross-phase troubleshooting, or data space and data kit management. TRIGGER when: user needs a multi-step Data Cloud pipeline, asks to set up or troubleshoot Data Cloud across phases, manages data spaces or data kits, or wants a cross-phase sf data360 workflow. DO NOT TRIGGER when: work is isolated to a single phase (use the matching phase-specific skill), the task is STDM/session tracing/parquet telemetry (use observing-agentforce), standard CRM SOQL (use querying-soql), or Apex implementation (use generating-apex).
github-project-automation
IncludedAutomate GitHub repository setup with CI/CD workflows, issue templates, Dependabot, and CodeQL security scanning. Includes 12 production-tested workflows and prevents 18 errors: YAML syntax, action pinning, and configuration. Use when: setting up GitHub Actions CI/CD, creating issue/PR templates, enabling Dependabot or CodeQL scanning, deploying to Cloudflare Workers, implementing matrix testing, or troubleshooting YAML indentation, action version pinning, secrets syntax, runner versions, or CodeQL configuration. Keywords: github actions, github workflow, ci/cd, issue templates, pull request templates, dependabot, codeql, security scanning, yaml syntax, github automation, repository setup, workflow templates, github actions matrix, secrets management, branch protection, codeowners, github projects, continuous integration, continuous deployment, workflow syntax error, action version pinning, runner version, github context, yaml indentation error
sf-datacloud
IncludedSalesforce Data Cloud product orchestrator for connect→prepare→harmonize→segment→act workflows. TRIGGER when: user needs a multi-step Data Cloud pipeline, asks to set up or troubleshoot Data Cloud across phases, manages data spaces or data kits, or wants a cross-phase `sf data360` workflow. DO NOT TRIGGER when: work is isolated to a single phase (use the matching sf-datacloud-* skill), the task is STDM/session tracing/parquet telemetry (use sf-ai-agentforce-observability), standard CRM SOQL (use sf-soql), or Apex implementation (use sf-apex).
fabric-cli
IncludedUse this skill for Fabric.so CLI workflows with the `fabric` terminal command: diagnose/install/login, search or browse a Fabric library, save notes/links/files, create folders, ask the Fabric AI assistant, manage tasks/workspaces, generate shell completion, check subscription usage, produce JSON output, and use Fabric as persistent agent memory. Do not use for Microsoft Fabric/Azure/Power BI `fab`, Daniel Miessler's Fabric framework, Python Fabric SSH, Fabric.js, or textile/fashion fabric.
lark
IncludedLark/Feishu CLI skills: lark-cli operations for docs, markdown, sheets, base, calendar, im, mail, task, okr, drive, wiki, slides, whiteboard, apps, approval, attendance, contact, vc, minutes, event. Use when the user needs to operate Lark/Feishu resources via lark-cli, send messages, manage documents, spreadsheets, calendars, tasks, OKRs, deploy web pages, or any Feishu/Lark workspace operations.