terraform-state-recovery

Official

Recover Terraform state after cluster recreation.

AuthorMatchpoint-AI
Version1.0.0
Installs0

System Documentation

What problem does it solve?

When a Kubernetes cluster is recreated, Terraform state can become stale, referencing resources that no longer exist. This leads to terraform apply failures and resource conflicts, blocking infrastructure deployments. This Skill provides a systematic procedure to recover from such orphaned state issues.

Core Features & Use Cases

  • Orphaned Resource Identification: Automatically lists Kubernetes and Helm resources in state that are no longer present in the cluster.
  • Safe State Removal: Guides through terraform state rm commands to clean up stale entries without affecting active infrastructure.
  • Automated Recovery Script: Provides a Bash script to streamline the process of identifying and removing orphaned state.
  • Prevention Strategies: Recommends using data sources, letting ArgoCD manage application resources, and remote state locking to prevent future issues.
  • Use Case: If your terraform apply fails with "Resource already exists in state" after a Rackspace Spot cloudspace was deleted and recreated, use this Skill to identify and remove the orphaned Kubernetes and Helm resources from your Terraform state, allowing you to successfully re-apply your infrastructure.

Quick Start

Use the terraform-state-recovery skill to identify and remove orphaned Kubernetes namespaces and Helm releases from the Terraform state after a cluster recreation. Explain how to verify the state is clean before re-applying.

Dependency Matrix

Required Modules

None required

Components

Standard package

💻 Claude Code Installation

Recommended: Let Claude install automatically. Simply copy and paste the text below to Claude Code.

Please help me install this Skill:
Name: terraform-state-recovery
Download link: https://github.com/Matchpoint-AI/matchpoint-github-runners-helm/archive/main.zip#terraform-state-recovery

Please download this .zip file, extract it, and install it in the .claude/skills/ directory.
View Source Repository

Agent Skills Search Helper

Install a tiny helper to your Agent, search and equip skill from 223,000+ vetted skills library on demand.