terraform-state-identity-mismatch
CommunityFix Terraform state drift and restore identity.
System Documentation
What problem does it solve?
Fix Terraform "Unexpected Identity Change" errors during plan/apply. Use when: (1) Terraform fails with "the Terraform Provider unexpectedly returned a different identity", (2) State refresh shows identity mismatch between stored and current values, (3) Resource was created but terraform apply timed out, leaving state inconsistent. Solution involves removing and reimporting the affected resource.
Core Features & Use Cases
- Identify the affected resource from the error message.
- Remove from state and re-import the resource back into Terraform state.
- Verify with plan and apply to ensure drift is synchronized. Use Case: Kubernetes deployments where a timeout during deployment leaves state inconsistent.
Quick Start
Identify the affected resource from the error message, remove it from state, re-import the resource using the correct address, then run a targeted plan and apply to synchronize state.
Dependency Matrix
Required Modules
None requiredComponents
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-identity-mismatch Download link: https://github.com/ViktorBarzin/infra/archive/main.zip#terraform-state-identity-mismatch Please download this .zip file, extract it, and install it in the .claude/skills/ directory.
Agent Skills Search Helper
Install a tiny helper to your Agent, search and equip skill from 223,000+ vetted skills library on demand.