Token导航 LogoToken导航TokenDH.com
研究检索只读github未标认证来源可访问许可证需确认审计通过

terraform-state-managerTerraform state Manager ORM

Agent Skill

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

总安装

198

周安装

8

GitHub Stars

27

下载量

62
CodexClaudeCursorGemini CLI

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

2

许可证

unknown

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

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

请帮我安装这个 Agent Skill:terraform-state-manager(Terraform state Manager ORM)
来源仓库:https://github.com/armanzeroeight/fastagent-plugins
仓库路径:skills/terraform-state-manager
安装命令:
npx skills add https://github.com/armanzeroeight/fastagent-plugins --skill terraform-state-manager
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

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

skills.shnpx skills
npx skills add https://github.com/armanzeroeight/fastagent-plugins --skill terraform-state-manager

简介

用于 Terraform 状态文件的安全操作与冲突恢复。

  • 支持资源导入、重命名与状态拆分等高级管理功能。
  • 强调备份与计划先行原则,降低误操作风险。
  • 安装方式:通过 npx skills add 命令从指定 GitHub 仓库添加。
  • 使用前必须创建状态备份,并在变更后执行 terraform plan 验证影响。

SKILL.md

Terraform State Manager

This skill provides safe workflows for Terraform state operations and troubleshooting.

When to Use

Use this skill when:

  • Importing existing infrastructure into Terraform
  • Moving resources to different addresses (renaming)
  • Removing resources from state without destroying them
  • Migrating state between backends (local to S3, etc.)
  • Recovering from state corruption or conflicts
  • Splitting or merging state files

Critical Safety Rules

ALWAYS follow these rules when working with state:

  1. Backup first: Create state backup before any operation
  2. Plan after: Run terraform plan after state changes to verify
  3. One at a time: Make incremental changes, not bulk operations
  4. Test in non-prod: Practice state operations in dev/test first
  5. Version control: Commit code changes with state operations

Common Operations

1. Import Existing Resources

Workflow:

# Step 1: Write the resource configuration in .tf file
# Step 2: Import the resource
terraform import <resource_address> <resource_id>

# Step 3: Verify with plan (should show no changes)
terraform plan

Example - Import AWS S3 Bucket:

# 1. Add to main.tf
resource "aws_s3_bucket" "existing" {
  bucket = "my-existing-bucket"
}

# 2. Import
terraform import aws_s3_bucket.existing my-existing-bucket

# 3. Verify
terraform plan  # Should show: No changes

Tips:

  • Find resource ID format in provider docs
  • Import one resource at a time
  • Some resources require multiple imports (bucket + versioning + encryption)
  • Use terraform show to see imported attributes

2. Move Resources (Rename/Refactor)

Workflow:

# Move resource to new address
terraform state mv <source> <destination>

# Verify
terraform plan  # Should show: No changes

Example - Rename Resource:

# Before: aws_s3_bucket.bucket
# After:  aws_s3_bucket.main

terraform state mv aws_s3_bucket.bucket aws_s3_bucket.main

Example - Move to Module:

# Move resource into module
terraform state mv aws_instance.web module.web_server.aws_instance.main

Example - Move Between Modules:

terraform state mv module.old.aws_db_instance.main module.new.aws_db_instance.main

Tips:

  • Update.tf files to match new addresses before running plan
  • Use quotes for addresses with special characters
  • Move related resources together (e.g., bucket + bucket_policy)

3. Remove from State

Workflow:

# Remove resource from state (keeps actual resource)
terraform state rm <resource_address>

# Verify resource still exists in cloud
# Update .tf files to remove resource definition

Example - Remove Resource:

# Remove from Terraform management
terraform state rm aws_s3_bucket.temp

# Resource still exists in AWS, just not managed by Terraform

Use cases:

  • Handing off resource to another Terraform workspace
  • Removing accidentally imported resources
  • Decomissioning Terraform management of legacy resources

4. Migrate State Backend

Workflow for Local → S3:

# Step 1: Create S3 bucket and DynamoDB table for locking

# Step 2: Add backend configuration
terraform {
  backend "s3" {
    bucket         = "my-terraform-state"
    key            = "project/terraform.tfstate"
    region         = "us-east-1"
    encrypt        = true
    dynamodb_table = "terraform-locks"
  }
}

# Step 3: Initialize with migration
terraform init -migrate-state

# Step 4: Verify
terraform plan

Backend Migration Checklist:

  • Backup current state file
  • Create new backend resources (S3 bucket, etc.)
  • Update backend configuration in code
  • Run terraform init -migrate-state
  • Verify with terraform plan
  • Test state locking works
  • Update team documentation

5. List State Resources

View all resources in state:

# List all resources
terraform state list

# Show specific resource details
terraform state show aws_s3_bucket.main

# Output state as JSON
terraform show -json

Troubleshooting

State Lock Issues

# If state is locked and shouldn't be
terraform force-unlock <lock-id>

# Only use if you're certain no other operation is running

State Drift Detection

# Check for drift between state and actual infrastructure
terraform plan -refresh-only

# Update state to match reality (doesn't change infrastructure)
terraform apply -refresh-only

Corrupted State Recovery

# Terraform keeps backups automatically
ls terraform.tfstate.backup

# Restore from backup
cp terraform.tfstate.backup terraform.tfstate

# Or restore from remote backend version history (S3 versioning)

Pre-Operation Checklist

Before any state operation:

  • Backup state file (cp terraform.tfstate terraform.tfstate.backup)
  • Ensure no other operations are running
  • Understand the exact command and its impact
  • Have rollback plan ready
  • Test in non-production first

Post-Operation Verification

After any state operation:

  • Run terraform plan (should show expected changes or no changes)
  • Verify resource still exists in cloud console
  • Check state file size is reasonable
  • Commit changes to version control
  • Document what was done and why

适合场景

01

用户想查找某类 Agent Skill 时

02

需要根据任务场景推荐可安装能力包时

03

需要对比不同来源的安装命令和来源信息时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

保留来源站点、仓库和原始说明,方便继续核验

能力 4

展示第三方安全扫描或审计结果

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

Codex

36.67%
按下载量换算23

Claude

31.2%
按下载量换算19

Cursor

18.31%
按下载量换算11

Gemini CLI

10.51%
按下载量换算7

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

只读

该 Skill 主要提供规则、说明或参考内容,本身偏只读;真正读写文件、联网或执行命令仍取决于宿主 Agent 的任务。

安装前确认

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

来源信息

继续浏览同类 Skills