본문으로 건너뛰기
Skillpedia
배포 및 클라우드 (DevOps)37k · #7569

terraform-skill

하는 일

이 스킬은 Terraform 또는 OpenTofu를 이용한 코드형 인프라 작업을 안내합니다. 코드로 클라우드 자원을 관리하는 개발자와 DevOps 엔지니어를 위한 스킬입니다.

사용하는 경우

  • ✓새 Terraform 모듈을 만들거나 기존 설정을 다시 구성할 때.
  • ✓인프라 코드에 대한 테스트나 CI/CD 파이프라인을 설정해야 할 때.
  • ✓Terraform 상태 문제를 디버깅하거나 보안 관점에서 설정을 검토하는 경우.

스킬 링크

https://github.com/agentscope-ai/QwenPaw/blob/main/plugins/bundle/cloudpaw/skills/terraform-skill/SKILL.md

복사해서 AI(Claude, ChatGPT, Cursor)에 붙여넣고 지침을 따르도록 요청하세요.

사용 방법

가장 쉬운 방법입니다. 메시지를 복사해 AI에 붙여넣으세요. AI가 스킬을 읽고 지침을 따릅니다.

바로 붙여넣을 수 있는 메시지

Use this skill to help me: https://github.com/agentscope-ai/QwenPaw/blob/main/plugins/bundle/cloudpaw/skills/terraform-skill/SKILL.md Read the SKILL.md file at that link and follow its instructions for my task.
AI가 이런 스킬을 알아서 찾아 쓰길 원하시나요?무료 Skillpedia MCP를 설치하세요. 한 줄이면 작업마다 스킬 15,000+개 중에서 검색합니다.1분 만에 설치 →

AI에게 요청하는 예시

“제 Terraform 프로젝트의 보안 문제를 검토하고 모듈 구조를 제안해 주세요.”

매주 새 스킬 5개. 읽는 데 1분.

작동 방식

스킬은 테스트 방법 선택, 모듈 구성, 파이프라인 설정, trivy와 checkov 같은 점검 도구 실행 방법을 설명합니다. 설정을 검토하거나 작성할 때 이 방법들을 적용합니다.

기술 내용 (원본 SKILL.md)

작성자의 영어 원문을 GitHub에서 그대로 가져왔습니다.

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 resources
  • variables.tf - Input variables
  • outputs.tf - Output values
  • versions.tf - Provider versions
  • data.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
자주 묻는 질문

Terraform 기본 문법을 가르치나요?

아닙니다. 기본 문법보다는 테스트, 모듈, CI/CD, 아키텍처 결정에 초점을 맞춥니다.

OpenTofu와도 작동하나요?

네. Terraform과 OpenTofu를 모두 다룹니다.

어떤 보안 도구를 언급하나요?

인프라 코드의 보안 문제를 검사하는 trivy와 checkov를 언급합니다.

상세 정보

작성자의 원본 설명

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

인기도

GitHub 스타
37k
순위
#7569
라이선스
Apache-2.0
업데이트
2026. 11. 2.

이 스킬이 유용한가요?

0

로그인 투표하려면 로그인하세요.

댓글

  • …

이 저장소의 다른 스킬

비슷한 스킬