Перейти к содержанию
Skillpedia
Деплой и облако (DevOps)29k · #9612

terraform-patterns

Что он делает

Этот скилл помогает писать и проверять код Terraform, который описывает облачную инфраструктуру в файлах. Он нужен инженерам, которые управляют инфраструктурой и хотят более безопасную и аккуратную конфигурацию.

Когда использовать

  • ✓Когда вы проверяете файлы Terraform на ошибки или плохую структуру.
  • ✓Когда проектируете переиспользуемый модуль Terraform.
  • ✓Когда нужна проверка безопасности кода инфраструктуры перед изменениями.

Ссылка на скилл

https://github.com/alirezarezvani/claude-skills/blob/main/engineering/terraform-patterns/skills/terraform-patterns/SKILL.md

Скопируйте и вставьте её в ваш ИИ (Claude, ChatGPT или Cursor) с просьбой следовать инструкциям.

Как использовать

Самый простой способ: скопируйте сообщение и вставьте его в свой ИИ. Он прочитает скилл и выполнит инструкции.

Готовое сообщение для вставки

Используй этот скилл, чтобы помочь мне: https://github.com/alirezarezvani/claude-skills/blob/main/engineering/terraform-patterns/skills/terraform-patterns/SKILL.md Прочитай файл SKILL.md по этой ссылке и следуй его инструкциям в моей задаче.
Хотите, чтобы ваш ИИ сам находил такие скиллы?Установите бесплатный MCP Skillpedia: одна строка, и перед каждой задачей он ищет среди 15 000+ скиллов.Установить за 1 минуту →

Пример запроса к вашему ИИ

“Проверь мои файлы Terraform на проблемы безопасности и плохие шаблоны, прежде чем я их применю.”

5 новых скиллов в неделю. 1 минута чтения.

Как это работает

Скилл анализирует структуру модулей, сканирует конфигурацию на ошибки и открытые секреты, затем предлагает исправления.

Технический текст (оригинальный SKILL.md)

Оригинальный текст автора на английском, прямо с GitHub.

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: .tf files, 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

  1. Analyze current state

    • Read all .tf files in the target directory
    • Identify module structure (flat vs nested)
    • Count resources, data sources, variables, outputs
    • Check naming conventions
  2. 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 = true
    
  3. Generate report

    python3 scripts/tf_module_analyzer.py ./terraform
    
  4. Run security scan

    python3 scripts/tf_security_scanner.py ./terraform
    

/terraform-patterns module — Module Design

  1. 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)
  2. 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
    
Частые вопросы

Он охватывает удалённое состояние?

Да, он включает настройку удалённого бэкенда состояния.

Он запускает terraform apply за меня?

Нет, он проверяет и предлагает изменения, а шаги развёртывания выполняете вы.

Какие облака он охватывает?

Общие шаблоны Terraform, включая настройку провайдеров, IAM и многорегиональные конфигурации.

Подробности

Оригинальное описание автора

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.

repo: alirezarezvani/claude-skills

Популярность

Звёзды на GitHub
29k
Место в рейтинге
#9612
Лицензия
MIT
Обновлён
02.11.2026

Полезен ли этот скилл?

0

Войдите , чтобы голосовать.

Комментарии

  • …

Другие скиллы из этого репозитория

Похожие скиллы