Token导航 LogoToken导航

Agent Skill · 开发

debug%3aterraform(调试%3aterraform)

用于辅助云资源、部署、容器、基础设施和运维自动化任务。它适合让 Agent 检查配置、整理部署步骤、分析资源状态、生成排障思路或辅助云服务接入。使用时需要明确目标环境、账号权限、区域和资源组,区分本地测试与生产操作;涉及删除资源、重启服务、修改网络或权限配置时,应先确认影响范围。

debug%3aterraform 是开发类 Agent Skill,可用宿主为 Codex、Claude、Cursor、Gemini CLI,通过GitHub 仓库获取,权限为接触敏感数据;许可证信息还不明确,暂无第三方扫描结果,按安装量在开发类的 21,746 个 Skill 里排第 16,237。

总安装 519周安装 21GitHub Stars 7下载 163核验 2026-05-01

安装说明

本站只整理中文说明,不托管安装包,也不代用户安装。
GitHub
许可证
unknown

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:debug%3aterraform(调试%3aterraform)
来源仓库:https://github.com/snakeo/claude-debug-and-refactor-skills-plugin
仓库路径:skills/debug%3Aterraform
安装命令:
npx skills add https://github.com/snakeo/claude-debug-and-refactor-skills-plugin --skill debug:terraform
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 npx skills 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

skills.shnpx skills
npx skills add https://github.com/snakeo/claude-debug-and-refactor-skills-plugin --skill debug:terraform

这个 Skill 是做什么的

开发类 Skill 面向写代码、改代码和排查问题,一般会读写仓库文件,部分还会执行构建或测试命令。

debug%3aterraform 采用四阶段法诊断 IaC 配置与状态文件问题,覆盖语法、Provider、State 三类错误。适用于资源漂移、状态锁冲突、API 认证失败等多云部署场景的典型故障。自动执行 terraform validate 与 plan 分析,输出最小化修复 diff 与回滚方案。

操作生产环境前应获取临时凭证并限制资源组作用域,避免意外删除关键服务。适用宿主包括 Codex、Claude、Cursor、Gemini CLI,接入前应确认版本、权限和运行环境要求。

来源仓库内路径:skills/debug%3Aterraform

上手步骤

4 步
  1. 1

    确认自己的宿主工具

    公开资料标注支持 Codex、Claude、Cursor、Gemini CLI;先确认自己用的是其中之一,再按对应工具的 Skills 目录放置。

  2. 2

    拿到安装命令

    可以直接复制的命令是 npx skills add https://github.com/snakeo/claude-debug-and-refactor-skills-plugin…;命令里的占位符换成自己的路径或密钥再执行。

  3. 3

    安装后重启宿主

    命令执行完要完全退出宿主工具再打开,让新装的 Skill 被重新扫描到,否则列表里可能看不到。

  4. 4

    按最小权限试用

    它需要接触敏感数据,先在测试目录或测试账号里跑,确认没问题再放到正式项目。

常见问题

6 条

debug%3aterraform 怎么安装?

在终端执行 npx skills add https://github.com/snakeo/claude-debug-and-refactor-skills-plugin --skill d…。装完完全退出宿主工具再打开,让它重新扫描本地 Skill。

debug%3aterraform 支持哪些 AI 工具?

公开资料标注支持 Codex、Claude、Cursor、Gemini CLI。其他工具只要能读取本地 Skill 目录,一般也能手动放进去,但要自己确认触发方式是否一致。

debug%3aterraform 需要什么权限?

权限级别是接触敏感数据。该 Skill 可能接触密钥、Token、环境变量或敏感配置,应进入高风险复核队列,默认不自动发布。

debug%3aterraform 是免费的吗?

公开资料没有标注明确许可证,收费和商用限制都无法确认。正式使用前请到来源仓库核对授权说明。

debug%3aterraform 用的人多吗?

公开数据是累计安装 519 次,近一周安装 21 次,下载 163 次,GitHub 7 星。这些数字来自第三方目录统计,只能当作热度参考,不代表质量或安全性。

debug%3aterraform 安全吗?

没有查到第三方扫描结果,安全性无法从公开资料判断,安装前请自行审查源码、依赖和命令行为。

值得选的地方和要先想清楚的地方

值得选的地方

  • 同时适配 4 种工具,换客户端不用重新找替代品。

先想清楚的地方

  • 需要接触敏感数据,装到常用环境前要先评估影响面。
  • 许可证没有明确标注,能不能商用、能不能再分发都不确定。
  • 没有第三方扫描结果,安全性只能靠自己读源码判断。
  • 第三方目录整理,版本更新和行为细节以来源仓库为准。

适不适合你

更适合

  • 已经在用 Codex,想直接扩展它能力的人。
  • 需要处理开发类任务、又不想每次都手写提示词的人。

不太适合

  • 环境里有大量密钥、凭证,不方便给第三方 Skill 读取的人。
  • 需要明确授权才能用到公司项目里的场景。
  • 要求有安全扫描结论才肯安装的团队。

开发类 Skill 对比

6 个同类
Skill总安装GitHub 星权限许可证扫描
skill-vetter

技能审查员 · OpenClaw

8,779,018986操作浏览器MIT-0通过
ontology

本体论 · OpenClaw

6,636,960576只读MIT-0通过
entra-app-registration

内部应用程序注册 · Codex、Claude

6,631,872764接触敏感数据未明确通过
entra-app-registration

内部应用程序注册 · Codex、Claude

3,757,680201接触敏感数据未明确通过
nano-banana-pro

纳米香蕉专业版 · OpenClaw

3,526,898364接触敏感数据MIT-0有提醒
debug%3aterraform

调试%3aterraform · 本页

5197接触敏感数据未明确未收录

按安装量取同分类前几名;数字来自第三方目录统计,只作热度参考,不代表质量结论。

SKILL.md 原文

Terraform Debugging Guide

Debug Terraform configurations and state issues using a systematic four-phase approach with provider-specific considerations.

Error Classification

Terraform errors fall into four categories:

  1. Language Errors - Syntax and configuration issues
  2. State Errors - State file corruption, drift, or lock issues
  3. Core Errors - Terraform engine problems
  4. Provider Errors - Cloud provider authentication or API issues

Phase 1: Reproduce and Isolate

Gather Initial Information

# Check Terraform and provider versions
terraform version

# Validate configuration syntax
terraform validate

# Review current state
terraform state list
terraform state show <resource_address>

# Check for state drift
terraform plan -refresh-only

Enable Debug Logging

# Set log level (TRACE, DEBUG, INFO, WARN, ERROR)
export TF_LOG=DEBUG

# Write logs to file (recommended for large outputs)
export TF_LOG_PATH="./terraform-debug.log"

# For provider-specific debugging
export TF_LOG_PROVIDER=DEBUG

# Run command with logging
terraform plan

Log Levels:

  • TRACE - Maximum verbosity, every action logged
  • DEBUG - Detailed debugging for complex issues
  • INFO - General informative messages
  • WARN - Non-critical warnings
  • ERROR - Critical errors only

Isolate the Problem

# Target specific resource
terraform plan -target=aws_instance.example

# Check specific module
terraform plan -target=module.networking

# Validate single file
terraform validate -json

Phase 2: Analyze Root Cause

Common Error Patterns and Solutions

State Lock Errors
Error: Error acquiring the state lock

Diagnosis:

# Check if another process is running
ps aux | grep terraform

# View lock info (for S3 backend)
aws dynamodb get-item --table-name terraform-locks --key '{"LockID":{"S":"your-state-path"}}'

Solution:

# Force unlock (use with caution!)
terraform force-unlock <LOCK_ID>

# For S3/DynamoDB backend
aws dynamodb delete-item --table-name terraform-locks --key '{"LockID":{"S":"your-state-path"}}'
Provider Authentication Failures
Error: error configuring Terraform AWS Provider: no valid credential sources found

Diagnosis:

# Check AWS credentials
aws sts get-caller-identity

# Verify environment variables
env | grep AWS

# Check credential file
cat ~/.aws/credentials

Solution:

# Explicit provider configuration
provider "aws" {
  region  = "us-east-1"
  profile = "my-profile"

  # Or use assume_role
  assume_role {
    role_arn = "arn:aws:iam::123456789012:role/TerraformRole"
  }
}
Resource Dependency Cycles
Error: Cycle: aws_security_group.a, aws_security_group.b

Diagnosis:

# Generate dependency graph
terraform graph | dot -Tpng > graph.png

# Or view in text format
terraform graph

Solution:

# Break cycle with explicit dependencies
resource "aws_security_group" "a" {
  name = "sg-a"
  # Remove circular reference
}

resource "aws_security_group_rule" "a_to_b" {
  security_group_id        = aws_security_group.a.id
  source_security_group_id = aws_security_group.b.id
  # ...
}
State Drift
Note: Objects have changed outside of Terraform

Diagnosis:

# Detect drift
terraform plan -refresh-only

# Show current state
terraform show

# Pull remote state for inspection
terraform state pull > state.json

Solution:

# Accept external changes into state
terraform apply -refresh-only

# Or reimport drifted resource
terraform import aws_instance.example i-1234567890abcdef0

# Or replace resource to match config
terraform apply -replace=aws_instance.example
Import Failures
Error: Cannot import non-existent remote object

Diagnosis:

# Verify resource exists
aws ec2 describe-instances --instance-ids i-1234567890abcdef0

# Check import syntax for resource type
terraform providers schema -json | jq '.provider_schemas["registry.terraform.io/hashicorp/aws"].resource_schemas["aws_instance"]'

Solution:

# Correct import command
terraform import aws_instance.example i-1234567890abcdef0

# For modules
terraform import module.ec2.aws_instance.example i-1234567890abcdef0

# Generate import blocks (Terraform 1.5+)
terraform plan -generate-config-out=generated.tf
Module Version Conflicts
Error: Module version requirements have changed

Diagnosis:

# Check current module versions
terraform providers lock -platform=linux_amd64

# View dependency tree
cat .terraform.lock.hcl

Solution:

# Upgrade modules
terraform init -upgrade

# Clear cache and reinitialize
rm -rf .terraform
terraform init

# Pin specific version
module "vpc" {
  source  = "terraform-aws-modules/vpc/aws"
  version = "~> 5.0"
}
Resource Already Exists
Error: Error creating S3 bucket: BucketAlreadyExists

Solution:

# Import existing resource
terraform import aws_s3_bucket.example my-bucket-name

# Or use data source to reference
data "aws_s3_bucket" "existing" {
  bucket = "my-bucket-name"
}

Phase 3: Fix and Verify

Interactive Debugging

# Open Terraform console for expression testing
terraform console

# Test expressions
> var.instance_type
> aws_instance.example.id
> length(var.subnets)
> jsonencode(local.tags)

State Manipulation (Use with Caution)

# Remove resource from state (doesn't destroy)
terraform state rm aws_instance.orphaned

# Move resource in state
terraform state mv aws_instance.old aws_instance.new

# Move to different state file
terraform state mv -state-out=other.tfstate aws_instance.example aws_instance.example

# Replace provider in state
terraform state replace-provider hashicorp/aws registry.terraform.io/hashicorp/aws

Safe Apply Strategies

# Preview changes
terraform plan -out=tfplan

# Apply with plan file (recommended)
terraform apply tfplan

# Apply specific resource only
terraform apply -target=aws_instance.example

# Destroy and recreate
terraform apply -replace=aws_instance.problematic

Phase 4: Document and Prevent

Pre-Commit Validation

# Validate syntax
terraform validate

# Format check
terraform fmt -check -recursive

# Use tflint for best practices
tflint --init
tflint

# Security scanning with checkov
checkov -d .

# Cost estimation
infracost breakdown --path=.

CI/CD Best Practices

# CI-friendly commands
terraform init -input=false
terraform plan -input=false -no-color -out=tfplan
terraform apply -input=false -no-color tfplan

# Lock provider versions
terraform providers lock -platform=linux_amd64 -platform=darwin_amd64

Configuration Best Practices

# Pin Terraform version
terraform {
  required_version = ">= 1.5.0, < 2.0.0"

  required_providers {
    aws = {
      source  = "hashicorp/aws"
      version = "~> 5.0"
    }
  }
}

# Use variables with validation
variable "environment" {
  type = string
  validation {
    condition     = contains(["dev", "staging", "prod"], var.environment)
    error_message = "Environment must be dev, staging, or prod."
  }
}

# Add lifecycle rules for critical resources
resource "aws_instance" "critical" {
  # ...
  lifecycle {
    prevent_destroy = true
    create_before_destroy = true
  }
}

Quick Reference Commands

CommandPurpose
terraform validateCheck syntax and configuration
terraform planPreview changes
terraform plan -refresh-onlyDetect state drift
terraform state listList all resources in state
terraform state show <addr>Show resource details
terraform state pullDownload remote state
terraform state rm <addr>Remove from state
terraform import <addr> <id>Import existing resource
terraform force-unlock <id>Release state lock
terraform consoleInteractive expression testing
terraform graphGenerate dependency graph
terraform providersShow required providers
terraform outputShow output values
terraform taint <addr>Mark for recreation (deprecated)
terraform apply -replace=<addr>Force resource replacement

Environment Variables

VariablePurpose
TF_LOGSet log level (TRACE/DEBUG/INFO/WARN/ERROR)
TF_LOG_PATHWrite logs to file
TF_LOG_PROVIDERProvider-specific logging
TF_INPUTDisable interactive prompts (0/false)
TF_VAR_nameSet variable value
TF_CLI_ARGSAdditional CLI arguments
TF_DATA_DIRCustom data directory (default:.terraform)
TF_WORKSPACESet workspace
TF_IN_AUTOMATIONAdjust output for automation
TF_PLUGIN_CACHE_DIRShare providers across projects

Debugging Checklist

  • Read the complete error message carefully
  • Check Terraform and provider versions
  • Run terraform validate for syntax issues
  • Enable debug logging with TF_LOG=DEBUG
  • Check state with terraform state list
  • Verify provider credentials and permissions
  • Check for resource dependencies with terraform graph
  • Review .terraform.lock.hcl for version conflicts
  • Test expressions with terraform console
  • Check cloud provider console for external changes
  • Review recent changes in version control
  • Search provider documentation for resource-specific issues

Security Reminders

  • Never commit state files or .tfvars with secrets to version control
  • Sanitize debug logs before sharing (may contain credentials)
  • Disable TF_LOG in production to prevent sensitive data exposure
  • Use remote state with encryption for team environments
  • Rotate credentials if exposed in logs

平台分布

Codex

36.12%
按下载量换算59

Claude

32.42%
按下载量换算53

Cursor

17.84%
按下载量换算29

Gemini CLI

9.7%
按下载量换算16

安全审计

暂无安全审计结果可展示。

权限和风险

接触敏感数据

该 Skill 可能接触密钥、Token、环境变量或敏感配置,应进入高风险复核队列,默认不自动发布。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。目前只有一个公开来源,建议同时核对源仓库。

继续浏览同类 Skills