本文へスキップ
Skillpedia
デプロイとクラウド(DevOps)40k · #7449

terraform-azurerm-set-diff-analyzer

できること

Azureリソース用のTerraformのplan出力を分析するツールです。Azureの一部のリソースは項目のリストの扱い方が原因で、実際にはわずかな変更しかない、あるいは変更がないのに大きな変更に見えることがあります。そのような変更を見分けるのに役立ちます。

使う場面

  • ✓`terraform plan`で多くの変更が表示されるのに、実際には項目を1つ追加または削除しただけのとき。
  • ✓Application GatewayやLoad Balancerなどのリソースで「all elements changed」と表示されるとき。
  • ✓自動化の処理(CI/CD)で、誤検知の変更を自動的に除外したいとき。

スキルのリンク

https://github.com/github/awesome-copilot/blob/main/skills/terraform-azurerm-set-diff-analyzer/SKILL.md

コピーしてAI(Claude、ChatGPT、Cursor)に貼り付け、指示に従うよう頼んでください。

使い方

いちばん簡単な方法:メッセージをコピーしてAIに貼り付けるだけ。AIがスキルを読んで指示に従います。

貼り付け用メッセージ

このスキルを使って手伝ってください:https://github.com/github/awesome-copilot/blob/main/skills/terraform-azurerm-set-diff-analyzer/SKILL.md このリンクのSKILL.mdファイルを読んで、私の作業でその指示に従ってください。
こういうスキルを、AIが自分で見つけてくれたら?無料のSkillpedia MCPをインストール。1行で、作業の前に15,000+のスキルから探してくれます。1分でインストール →

AIへの頼み方の例

“私のTerraform planを分析して、どの変更が本物で、どの変更が誤検知かを教えてください。”

毎週5つの新しいスキル。1分で読めます。

仕組み

このツールは、Terraformのplan出力を、こうした「誤検知の変更」を引き起こすことが知られているリソースや属性の一覧と比較します。並び順の問題を起こす「Set」型の属性に注目します。

技術的な内容(元のSKILL.md)

作者による元のテキスト(英語)をGitHubからそのまま表示しています。

Terraform AzureRM Set Diff Analyzer

A skill to identify "false-positive diffs" in Terraform plans caused by AzureRM Provider's Set-type attributes and distinguish them from actual changes.

When to Use

  • terraform plan shows many changes, but you only added/removed a single element
  • Application Gateway, Load Balancer, NSG, etc. show "all elements changed"
  • You want to automatically filter false-positive diffs in CI/CD

Background

Terraform's Set type compares by position rather than by key, so when adding or removing elements, all elements appear as "changed". This is a general Terraform issue, but it's particularly noticeable with AzureRM resources that heavily use Set-type attributes like Application Gateway, Load Balancer, and NSG.

These "false-positive diffs" don't actually affect the resources, but they make reviewing terraform plan output difficult.

Prerequisites

  • Python 3.8+

If Python is unavailable, install via your package manager (e.g., apt install python3, brew install python3) or from python.org.

Basic Usage

# 1. Generate plan JSON output
terraform plan -out=plan.tfplan
terraform show -json plan.tfplan > plan.json

# 2. Analyze
python scripts/analyze_plan.py plan.json

Troubleshooting

  • python: command not found: Use python3 instead, or install Python
  • ModuleNotFoundError: Script uses only standard library; ensure Python 3.8+

Detailed Documentation

よくある質問

「誤検知の変更」とは何ですか?

Terraformがplanで変更として表示しても、Azure上のリソースは実際には変わっていないものです。一部のリストでは項目の内容ではなく並び順が比較されるため、このようなことが起こります。

何かインストールする必要がありますか?

はい。お使いのコンピューターにPython 3.8以上がインストールされている必要があります。

どのように使いますか?

まず、Terraformのplanファイルを生成します(`terraform plan -out=plan.tfplan`と`terraform show -json plan.tfplan > plan.json`)。次に、生成したファイルを指定してPythonスクリプトを実行します(`python scripts/analyze_plan.py plan.json`)。

詳細

作者による元の説明

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 ch

repo: github/awesome-copilot

人気

GitHubのスター
40k
ランキング
#7449
ライセンス
MIT
更新日
2026/10/15

このスキルは役に立ちますか?

0

ログイン して投票しましょう。

コメント

  • …

このリポジトリの他のスキル

似ているスキル