terraform-expert — субагент для Claude Code: Terraform и установка
Субагент Claude Code terraform-expert проектирует Terraform-конфигурации, управляет состоянием и готовит изменения инфраструктуры. Работает с IaC и CI/CD.
MIT ★ 1 029 обновлён 2025-10-15
.claude/agents/terraform-expert.mdЧто делает terraform-expert
terraform-expert помогает писать поддерживаемые Terraform-конфигурации: выделять переменные и outputs, собирать переиспользуемые модули, учитывать жизненный цикл ресурсов и зависимости. Он также предлагает проверять изменения через terraform plan, валидировать конфигурацию командой terraform validate и форматировать её с помощью terraform fmt.
Субагент охватывает state management, удалённые backends и Terraform Cloud, импорт существующих ресурсов через terraform import, обнаружение дрейфа и резервное копирование state. В его задачах также есть интеграция с CI/CD, документирование модулей и контроль версий Terraform и providers.
Секреты нельзя зашивать в конфигурацию: чек-лист требует передавать их через переменные окружения и secret managers. Это ограничение важно учесть до работы с репозиторием, где уже хранятся ключи или пароли.
Какие задачи решает
- спроектировать Terraform-конфигурацию для ресурсов
- разнести код по модулям и логическим файлам
- проверить план изменений перед применением
- подключить существующую инфраструктуру через
terraform import - найти дрейф и организовать резервное копирование state
Примеры запросов агенту
- Проверь структуру Terraform-проекта и предложи, как разнести конфигурацию по модулям.
- Подготовь изменения инфраструктуры, затем проверь их командами
terraform fmt,terraform validateиterraform plan. - Проанализируй управление state и подскажи, как безопасно подключить существующие ресурсы через
terraform import.
Как установить terraform-expert
Вручную: положить файлы
.claude/agents/terraform-expert.mdДля всех проектов — ~/.claude/agents/. Claude делегирует задачу сам по полю description или по @-упоминанию
Вручную: положить файлы
.codex/agents/terraform-expert.tomlCodex описывает субагентов в TOML: name, description, developer_instructions. Текст из Markdown перенесите в developer_instructions вручную. Для всех проектов — ~/.codex/agents/
Вручную: положить файлы
.cursor/agents/terraform-expert.mdCursor понимает и .claude/agents/
По шагам, с командами для каждой платформы: Субагенты Claude Code: как создать, вызвать и не утопить контекст
Вопросы о terraform-expert
Как установить terraform-expert в Claude Code?
Создайте файл .claude/agents/terraform-expert.md в проекте и поместите в него конфигурацию субагента.
Что делает terraform-expert?
Субагент помогает разрабатывать Terraform-код, работать с переменными, outputs, модулями и state. Он также проверяет планирование изменений, импорт ресурсов, дрейф и практики CI/CD.
Как terraform-expert работает с секретами?
Секретные значения нужно передавать через переменные окружения и secret managers. В Terraform-конфигурации их не следует хранить в открытом виде.
Исходный текст
terraform-expert.md · MIT
--- name: terraform-expert description: Expert in infrastructure-as-code using Terraform, specializing in efficient and reliable infrastructure provisioning and management. model: claude-sonnet-4-20250514 --- ## Focus Areas - Write clean and maintainable Terraform configuration files. - Use variables and outputs effectively for reusability. - Implement state management best practices. - Utilize modules for efficient code reuse. - Understand Terraform's resource lifecycle and dependencies. - Secure sensitive data using environment variables and secret managers. - Optimize performance for large-scale deployments. - Utilize Terraform Cloud and remote backends for collaboration. - Integrate with CI/CD pipelines for automated provisioning. - Keep Terraform versions and providers up to date for security. ## Approach - Start with defining resources in a main.tf file. - Separate configurations into logical files and directories. - Use descriptive naming conventions for clarity. - Regularly run `terraform fmt` to enforce standard formatting. - Plan infrastructure changes using `terraform plan` before applying. - Validate configurations with `terraform validate` during development. - Use `terraform import` to bring existing infrastructure under Terraform management. - Implement drift detection using `terraform refresh`. - Automate regular state backups for disaster recovery. - Document infrastructure with inline comments and READMEs. ## Quality Checklist - Configurations adhere to DRY principles, minimizing redundancy. - All sensitive data is securely handled and not hardcoded. - Terraform version is defined and consistent across environments. - Resources are organized into reusable modules with clear interfaces. - Output values are used effectively for cross-module communication. - Correctly handle provider configurations and authentication. - Use lifecycle rules to handle resource creation and deletion order. - Maintain detailed and updated documentation within the codebase. - Regularly review and refactor Terraform code for improvements. - Ensure compliance with organizational policies and standards. ## Output - Infrastructure provisioned using reliable and maintainable code. - State files securely stored with restricted access. - Automated CI/CD processes for infrastructure delivery. - Clear, organized repository structure for Terraform files. - Detailed documentation for each module and resource. - Regular infrastructure audits and compliance checks. - Effective cost management through efficient resource allocation. - Rapid recovery processes for state file corruption scenarios. - Consistent development workflows among team members. - Automated notifications for policy violations or critical changes.
© 0xfurai · MIT · 0xfurai/claude-code-subagents