terraform-skill
Skill này làm gì
Skill này hướng dẫn công việc về hạ tầng dưới dạng mã bằng Terraform hoặc OpenTofu. Skill dành cho lập trình viên và kỹ sư DevOps quản lý tài nguyên đám mây bằng mã.
Khi nào nên dùng
- ✓Khi bạn đang tạo một module Terraform mới hoặc sắp xếp lại một cấu hình hiện có.
- ✓Khi bạn cần thiết lập kiểm thử hoặc một pipeline CI/CD cho mã hạ tầng.
- ✓Khi bạn đang gỡ lỗi các vấn đề về state của Terraform hoặc xem xét cấu hình về bảo mật.
Liên kết skill
https://github.com/agentscope-ai/QwenPaw/blob/main/plugins/bundle/cloudpaw/skills/terraform-skill/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 xét dự án Terraform của tôi để tìm vấn đề bảo mật và gợi ý cấu trúc module.”
5 skill mới mỗi tuần. Đọc chỉ 1 phút.
Cách hoạt động
Skill giải thích cách chọn phương pháp kiểm thử, cấu trúc module, thiết lập pipeline và chạy các công cụ quét như trivy và checkov. Nó áp dụng những thực hành này khi xem xét hoặc viết cấu hình.
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 Skill for Claude
Comprehensive Terraform and OpenTofu guidance covering testing, modules, CI/CD, and production patterns. Based on terraform-best-practices.com and enterprise experience.
When to Use This Skill
Activate this skill when:
- Creating new Terraform or OpenTofu configurations or modules
- Setting up testing infrastructure for IaC code
- Deciding between testing approaches (validate, plan, frameworks)
- Structuring multi-environment deployments
- Implementing CI/CD for infrastructure-as-code
- Reviewing or refactoring existing Terraform/OpenTofu projects
- Choosing between module patterns or state management approaches
Don't use this skill for:
- Basic Terraform/OpenTofu syntax questions (Claude knows this)
- Provider-specific API reference (link to docs instead)
- Cloud platform questions unrelated to Terraform/OpenTofu
Core Principles
1. Code Structure Philosophy
Module Hierarchy:
| Type | When to Use | Scope |
|---|---|---|
| Resource Module | Single logical group of connected resources | VPC + subnets, Security group + rules |
| Infrastructure Module | Collection of resource modules for a purpose | Multiple resource modules in one region/account |
| Composition | Complete infrastructure | Spans multiple regions/accounts |
Hierarchy: Resource → Resource Module → Infrastructure Module → Composition
Directory Structure:
environments/ # Environment-specific configurations
├── prod/
├── staging/
└── dev/
modules/ # Reusable modules
├── networking/
├── compute/
└── data/
examples/ # Module usage examples (also serve as tests)
├── complete/
└── minimal/
Key principle from terraform-best-practices.com:
- Separate environments (prod, staging) from modules (reusable components)
- Use examples/ as both documentation and integration test fixtures
- Keep modules small and focused (single responsibility)
For detailed module architecture, see: Code Patterns: Module Types & Hierarchy
2. Naming Conventions
Resources:
# Good: Descriptive, contextual
resource "aws_instance" "web_server" { }
resource "aws_s3_bucket" "application_logs" { }
# Good: "this" for singleton resources (only one of that type)
resource "aws_vpc" "this" { }
resource "aws_security_group" "this" { }
# Avoid: Generic names for non-singletons
resource "aws_instance" "main" { }
resource "aws_s3_bucket" "bucket" { }
Singleton Resources:
Use "this" when your module creates only one resource of that type:
✅ DO:
resource "aws_vpc" "this" {} # Module creates one VPC
resource "aws_security_group" "this" {} # Module creates one SG
❌ DON'T use "this" for multiple resources:
resource "aws_subnet" "this" {} # If creating multiple subnets
Use descriptive names when creating multiple resources of the same type.
Variables:
# Prefix with context when needed
var.vpc_cidr_block # Not just "cidr"
var.database_instance_class # Not just "instance_class"
Files:
main.tf- Primary resourcesvariables.tf- Input variablesoutputs.tf- Output valuesversions.tf- Provider versionsdata.tf- Data sources (optional)
Testing Strategy Framework
Decision Matrix: Which Testing Approach?
| Your Situation | Recommended Approach | Tools | Cost |
|---|---|---|---|
| Quick syntax check | Static analysis | terraform validate, fmt |
Free |
| Pre-commit validation | Static + lint | validate, tflint, trivy, checkov |
Free |
| Terraform 1.6+, simple logic | Native test framework | Built-in terraform test |
Free-Low |
| Pre-1.6, or Go expertise | Integration testing | Terratest | Low-Med |
| Security/compliance focus | Policy as code | OPA, Sentinel | Free |
| Cost-sensitive workflow | Mock providers (1.7+) | Native tests + mocking | Free |
| Multi-cloud, complex | Full integration | Terratest + real infra | Med-High |
Testing Pyramid for Infrastructure
/\
/ \ End-to-End Tests (Expensive)
/____\ - Full environment deployment
/ \ - Production-like setup
/________\
/ \ Integration Tests (Moderate)
/____________\ - Module testing in isolation
/ \ - Real resources in test account
/________________\ Static Analysis (C
Câu hỏi thường gặp
Skill có dạy cú pháp Terraform cơ bản không?
Không. Skill tập trung vào kiểm thử, module, CI/CD và quyết định kiến trúc, không phải cú pháp cơ bản.
Skill có hoạt động với OpenTofu không?
Có. Skill bao gồm cả Terraform và OpenTofu.
Skill nhắc đến những công cụ bảo mật nào?
Nó nhắc đến trivy và checkov để quét mã hạ tầng tìm vấn đề bảo mật.
Chi tiết
Mô tả gốc của tác giả
Use when working with Terraform or OpenTofu - creating modules, writing tests (native test framework, Terratest), setting up CI/CD pipelines, reviewing configurations, choosing between testing approaches, debugging state issues, implementing security scanning (trivy, checkov), or making infrastructure-as-code architecture decisions
repo: agentscope-ai/QwenPaw
Độ phổ biến
- Sao GitHub
- 37k
- Vị trí xếp hạng
- #7569
- Giấy phép
- Apache-2.0
- Cập nhật
- 2/11/2026
Bình luận
- …
Thêm skill từ kho mã này
computer_use
37kGiúp agent của bạn thao tác một ứng dụng Windows hoặc macOS đang chạy bằng cách quan sát màn hình, nhấp chuột và kiểm tra từng kết quả, khi không có công cụ trực tiếp nào làm được việc.
browser
37kGiúp agent của bạn điều khiển trình duyệt web thực qua QwenPaw Browser SDK, đọc trang, thao tác trên đó và kiểm tra kết quả trước khi báo cáo thành công.
channel_message
37kGiúp agent của bạn gửi một tin nhắn một chiều đến một kênh hoặc phiên trò chuyện cụ thể, chẳng hạn thông báo khi tác vụ xong, sau khi nó đã tìm được đích đúng.
chat_with_agent
37kGiúp agent của bạn hỏi ý kiến một agent AI khác để có góc nhìn thứ hai, một kế hoạch hoặc một đánh giá, và tiếp tục cuộc trò chuyện đó với ngữ cảnh trước đó.
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.