terraform-azurerm-set-diff-analyzer
Analyze Terraform plan JSON output for AzureRM Provider to distinguish between false-positive diffs (order-only changes in Set-type attributes) and actual resource changes. Use when reviewing terraform plan output for Azure resources like Application Gateway, Load Balancer,
Installation
Pick a client and clone the repository into its skills directory.
Installation
About this skill
Analyze Terraform plan JSON output for AzureRM Provider to distinguish between false-positive diffs (order-only changes in Set-type attributes) and actual resource changes. Use when reviewing terraform plan output for Azure resources like Application Gateway, Load Balancer, Firewall, Front Door, NSG, and other resources with Set-type attributes that cause spurious diffs due to internal ordering changes.
How to use
Upewnij się, że masz zainstalowany Python 3.8 lub nowszy. Jeśli Python nie jest dostępny, zainstaluj go za pomocą menedżera pakietów (apt install python3, brew install python3) lub ze strony python.org.
Wygeneruj plik planu Terraform w formacie JSON, uruchamiając terraform plan -out=plan.tfplan, a następnie terraform show -json plan.tfplan > plan.json. Polecenie zapisze strukturę planu do pliku plan.json.
Uruchom skrypt analizy, wpisując python scripts/analyze_plan.py plan.json. Skrypt przeanalizuje plik i wyświetli listę rzeczywistych zmian, odfiltrując fałszywe różnice spowodowane zmianami kolejności elementów w atrybutach Set.
Przejrzyj wynik — zobaczysz tylko zmiany, które faktycznie wpłyną na zasoby Azure. Jeśli terraform plan pokazywał wiele zmian, ale dodałeś lub usunąłeś tylko jeden element, narzędzie wykaże, które różnice są fałszywe.
W przypadku błędu "python: command not found" użyj python3 zamiast python. Jeśli pojawi się ModuleNotFoundError, upewnij się, że masz Python 3.8+ — skrypt używa tylko biblioteki standardowej.