planとapplyのサイクルとは?
planとapplyのサイクルは、宣言的なインフラツールの中核にある2段階のworkflowです。planフェーズは望ましい設定を現在のstateと比較し、何が作成、変更、破棄されるかのdiffを生成します。applyフェーズはそのplanをライブ環境に対して実行し、新しいstateを記録します。
なぜ重要か
planをapplyから分離することで、何かが本番を変更する前に、人間が正確な変更をレビューできます。CIでは、pull requestでplanを実行することで、インフラ変更の影響範囲をmerge前に可視化します。
関連ガイド
What Is an Idempotent Apply?An idempotent apply produces the same final state no matter how many times it runs, making no changes when re…
What Is Infrastructure Drift?Infrastructure drift is divergence between the real state of cloud resources and the state declared in infras…
What Is a Remote State Backend?A remote state backend stores infrastructure-as-code state in a shared, durable location so teams and CI runn…