Skip to content

Instantly share code, notes, and snippets.

View ruinshe's full-sized avatar
🎯
Focusing

Ruins He ruinshe

🎯
Focusing
View GitHub Profile
@ruinshe
ruinshe / README.md
Last active December 24, 2025 01:07
Terraform Kubernetes Provider v1 Migration Helper

Terraform Kubernetes Provider v1 Migration Helper

This script automates the tedious process of migrating Terraform state when upgrading HashiCorp's Kubernetes Provider resources from deprecated versions (e.g., kubernetes_secret) to their stable _v1 counterparts (e.g., kubernetes_secret_v1).

It is specifically designed to handle "hundreds of resources" where terraform state mv fails due to schema incompatibility or sheer volume.

Key Features

  • Module Aware: Correctly handles deeply nested modules (e.g., module.app.module.db.kubernetes_secret.pass).
  • JSON Parsing: Uses jq to parse Terraform state, avoiding regex fragility with HCL.