terraform-patterns
Skill này làm gì
Skill này giúp viết và xem lại code Terraform, công cụ định nghĩa hạ tầng cloud bằng file. Skill dành cho kỹ sư quản lý hạ tầng và muốn cấu hình an toàn, gọn gàng hơn.
Khi nào nên dùng
- ✓Khi bạn đang xem lại các file Terraform để tìm lỗi hoặc cấu trúc kém.
- ✓Khi bạn đang thiết kế một module Terraform có thể tái sử dụng.
- ✓Khi bạn muốn rà soát bảo mật code hạ tầng trước khi áp dụng thay đổi.
Liên kết skill
https://github.com/alirezarezvani/claude-skills/blob/main/engineering/terraform-patterns/skills/terraform-patterns/SKILL.mdSao chép rồi dán vào AI của bạn (Claude, ChatGPT hoặc Cursor) và nhờ nó làm theo hướng dẫn.
Cách dùng
Cách dễ nhất: sao chép tin nhắn và dán vào AI của bạn. AI sẽ đọc skill và làm theo hướng dẫn.
Tin nhắn có sẵn để dán
Dành cho Claude Code, Codex hoặc Cursor: chạy lệnh trong thư mục dự án của bạn và skill sẽ được cài đặt.
Tải tệp SKILL.md về và thả vào thư mục skill của agent.
Ví dụ cách nhờ AI
“Xem lại các file Terraform của tôi về vấn đề bảo mật và mẫu xấu trước khi tôi áp dụng.”
5 skill mới mỗi tuần. Đọc chỉ 1 phút.
Cách hoạt động
Skill phân tích cấu trúc module và quét cấu hình để tìm sai sót và bí mật bị lộ, rồi gợi ý cách sửa.
Nội dung kỹ thuật (SKILL.md gốc)
Lấy nguyên văn từ GitHub, do tác giả viết bằng tiếng Anh.
Terraform Patterns
Predictable infrastructure. Secure state. Modules that compose. No drift.
Opinionated Terraform workflow that turns sprawling HCL into well-structured, secure, production-grade infrastructure code. Covers module design, state management, provider patterns, security hardening, and CI/CD integration.
Not a Terraform tutorial — a set of concrete decisions about how to write infrastructure code that doesn't break at 3 AM.
Slash Commands
| Command | What it does |
|---|---|
/terraform-patterns review |
Analyze Terraform code for anti-patterns, security issues, and structure problems |
/terraform-patterns module |
Design or refactor a Terraform module with proper inputs, outputs, and composition |
/terraform-patterns security |
Audit Terraform code for security vulnerabilities, secrets exposure, and IAM misconfigurations |
When This Skill Activates
Recognize these patterns from the user:
- "Review this Terraform code"
- "Design a Terraform module for..."
- "My Terraform state is..."
- "Set up remote state backend"
- "Multi-region Terraform deployment"
- "Terraform security review"
- "Module structure best practices"
- "Terraform CI/CD pipeline"
- Any request involving:
.tffiles, HCL, Terraform modules, state management, provider configuration, infrastructure-as-code
If the user has .tf files or wants to provision infrastructure with Terraform → this skill applies.
Workflow
/terraform-patterns review — Terraform Code Review
Analyze current state
- Read all
.tffiles in the target directory - Identify module structure (flat vs nested)
- Count resources, data sources, variables, outputs
- Check naming conventions
- Read all
Apply review checklist
MODULE STRUCTURE ├── Variables have descriptions and type constraints ├── Outputs expose only what consumers need ├── Resources use consistent naming: {provider}_{type}_{purpose} ├── Locals used for computed values and DRY expressions └── No hardcoded values — everything parameterized or in locals STATE & BACKEND ├── Remote backend configured (S3, GCS, Azure Blob, Terraform Cloud) ├── State locking enabled (DynamoDB for S3, native for others) ├── State encryption at rest enabled ├── No secrets stored in state (or state access is restricted) └── Workspaces or directory isolation for environments PROVIDERS ├── Version constraints use pessimistic operator: ~> 5.0 ├── Required providers block in terraform {} block ├── Provider aliases for multi-region or multi-account └── No provider configuration in child modules SECURITY ├── No hardcoded secrets, keys, or passwords ├── IAM follows least-privilege principle ├── Encryption enabled for storage, databases, secrets ├── Security groups are not overly permissive (no 0.0.0.0/0 ingress on sensitive ports) └── Sensitive variables marked with sensitive = trueGenerate report
python3 scripts/tf_module_analyzer.py ./terraformRun security scan
python3 scripts/tf_security_scanner.py ./terraform
/terraform-patterns module — Module Design
Identify module scope
- Single responsibility: one module = one logical grouping
- Determine inputs (variables), outputs, and resource boundaries
- Decide: flat module (single directory) vs nested (calling child modules)
Apply module design checklist
STRUCTURE ├── main.tf — Primary resources ├── variables.tf — All input variables with descriptions and types ├── outputs.tf — All outputs with descriptions ├── versions.tf — terraform {} block with required_providers ├── locals.tf — Computed values and naming conventions ├── data.tf — Data sources (if any) └── README.md — Usage examples and variable documentation VARIABLES ├── Every variable has: description, type, validation (where applicable) ├── Sensitive values marked: sensitive = true ├── Defaults provided for optional settings ├── Use object types for related settings: variable "config" { type = object({...}) } └── Validate with: validation { condition = ... } OUTPUTS ├── Output IDs, ARNs, endpoints — things consumers need ├── Include description on every output ├── Mark sensitive outputs: sensitive = true └── Don't output entire resources — only specific attributes COMPOSITI
Câu hỏi thường gặp
Nó có hỗ trợ remote state không?
Có, nó bao gồm thiết lập backend remote state.
Nó có chạy terraform apply thay tôi không?
Không, nó xem lại và gợi ý thay đổi; bạn tự chạy các bước triển khai.
Nó hỗ trợ những cloud nào?
Nó bao gồm các mẫu Terraform chung, gồm thiết lập provider, IAM và các cấu hình nhiều vùng.
Chi tiết
Mô tả gốc của tác giả
Use for any Terraform module, state backend, provider setup or IaC security review, before editing .tf files. Analyzes modules with tf_module_analyzer.py and scans for misconfigurations with tf_security_scanner.py.
Độ phổ biến
- Sao GitHub
- 29k
- Vị trí xếp hạng
- #9612
- Giấy phép
- MIT
- Cập nhật
- 2/11/2026
Bình luận
- …
Thêm skill từ kho mã này
agent-launcher-orchestrator
29kGiúp agent của bạn lên kế hoạch, xây dựng, kiểm thử và lên lịch một Claude managed agent trong tài khoản riêng, từng bước một, bắt đầu từ một mục tiêu rõ ràng.
grade-iterate
29kCho phép agent của bạn chấm kết quả một managed AI agent theo bảng tiêu chí và cải thiện qua số vòng cố định, nên không bao giờ lặp vô tận.
interview
29kCho phép agent của bạn phỏng vấn bạn về ý tưởng agent AI và biến câu trả lời thành một kế hoạch xây dựng đơn giản trước khi khởi chạy bất cứ điều gì.
run-without-you
29kGiúp agent của bạn thiết lập một managed AI agent chạy theo lịch hoặc khi có sự kiện xảy ra, với thời gian cron được kiểm tra trước khi khởi chạy.
Skill tương tự
openclaw-update
394kGiúp agent của bạn cập nhật OpenClaw Gateway đang có, chọn cách cập nhật phù hợp với cách cài đặt và giữ phiên làm việc của bạn hoạt động.
diagnose-gateway
394kGiúp agent của bạn tìm hiểu vì sao OpenClaw Gateway bị lỗi bằng cách kiểm tra cài đặt, kênh và cổng mà không thay đổi gì.
crabbox-apps
394kGiúp agent của bạn mở và chạy một app trên máy đám mây tạm thời, rồi hiển thị giao diện của nó trong thanh bên của chat.