用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
直接命令不会经过审查 Prompt;运行前请先检查来源。
npx skills add https://github.com/parsoFish/forge --skill terraform-iac命令会保持在同一行。复制前请横向滚动并检查完整内容。
想先保存到本地?可下载 SkillsMP 当前能够提供的文件。
Layered Trunk branching strategy for multi-agent development — worktree isolation, dependency layers, Ship/Show/Ask merge classification.
HTML5 Canvas game development patterns — game loop, rendering, input, state management, and Vite/Vitest tooling.
Docker Compose patterns for multi-container automation — health checks, networking, volumes, and service orchestration.
基于 SOC 职业分类
正在显示 SKILL.md
| name | terraform-iac |
| category | infrastructure |
| description | Terraform IaC patterns — module structure, state management, GitHub provider, and GitWeave-style org control. |
terraform/
├── main.tf # Root module — provider config, module calls
├── variables.tf # Input variables with descriptions and validation
├── outputs.tf # Exported values for other modules/consumers
├── versions.tf # Required providers and Terraform version constraint
├── terraform.tfvars # ← GITIGNORED — actual values
├── terraform.tfvars.example # ← Checked in — masked template
├── modules/
│ ├── github-repos/ # Repository configuration
│ │ ├── main.tf
│ │ ├── variables.tf
│ │ └── outputs.tf
│ ├── github-teams/ # Team membership and permissions
│ └── github-branch-protection/ # Branch protection rules
└── environments/
├── prod/ # Production org config
│ ├── main.tf # Calls modules with prod values
│ └── backend.tf # Remote state config
└── staging/
terraform {
required_providers {
github = {
source = "integrations/github"
version = "~> 6.0"
}
}
}
provider "github" {
owner = var.github_org
token = var.github_token # From TF_VAR_github_token env var
}
# variables.tf
variable "github_token" {
type = string
sensitive = true
description = "GitHub PAT with admin:org scope"
}
variable "github_org" {
type = string
description = "GitHub organization name"
validation {
condition = can(regex("^[a-zA-Z0-9-]+$", var.github_org))
error_message = "Organization name must be alphanumeric with hyphens."
}
}
variable "repos" {
type = map(object({
description = string
visibility = optional(string, "private")
default_branch = optional(string, "main")
topics = optional(list(string), [])
has_issues = optional(bool, true)
has_wiki = optional(bool, false)
template = optional(string, null)
}))
description = "Map of repository configurations"
}
# terraform.tfvars.example — copy to terraform.tfvars and fill in values
github_org = "your-org-name"
github_token = "ghp_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
repos = {
"example-repo" = {
description = "Example repository"
visibility = "private"
topics = ["example"]
}
}
Local state only — no paid remote backends (S3, GCS, Terraform Cloud) until explicitly changed.
# No backend block needed — Terraform defaults to local state.
# State files live in the working directory as terraform.tfstate.
Ensure .terraform/ and *.tfstate* are gitignored. Local state is the right choice for solo/personal projects — remote backends add cost and complexity that isn't justified yet.
When the decision to move to remote state is made, options include S3+DynamoDB, GCS, or Terraform Cloud — but that's a future decision, not a default.
resource "github_repository" "repo" {
for_each = var.repos
name = each.key
description = each.value.description
visibility = each.value.visibility
has_issues = each.value.has_issues
# Prevent accidental deletion
archive_on_destroy = true
}
resource "github_branch_protection" "main" {
for_each = var.repos
repository_id = github_repository.repo[each.key].node_id
pattern = "main"
required_pull_request_reviews {
required_approving_review_count = 1
dismiss_stale_reviews = true
}
required_status_checks {
strict = true
contexts = ["ci/build", "ci/test"]
}
enforce_admins = false # Allow admin bypass for automation
}
# Initialize (downloads providers)
terraform init
# Validate config syntax
terraform validate
# Preview changes
terraform plan -out=tfplan
# Apply (always from a saved plan)
terraform apply tfplan
# Import existing resources
terraform import 'github_repository.repo["existing-repo"]' existing-repo
# State inspection
terraform state list
terraform state show 'github_repository.repo["my-repo"]'
terraform apply on these resources requires explicit human approval)When a project needs to validate how it would run in the cloud, prefer:
terraform plan without apply) for IaC validationOnly provision real paid cloud resources when explicitly approved and with clear cost bounds.
.tf files (use TF_VAR_* env vars or .tfvars)terraform.tfvars and *.tfstate* are gitignoredsensitive = true~> not >=)archive_on_destroy = true on critical resources