I’m using terraform version 0.15.3.
I’m creating a plan with
terraform plan -out some_1.plan and then again with
terraform plan -out some_2.plan.
No changes happen on the account between the calls. So I’d expect the two plans would do the same.
Then I do a
terraform show -json some_1.plan > some_1.json and a
terraform show -json some_2.plan > some_2.json.
import json with open('some_1.json', 'r') as f: plan1 = json.load(f) with open('some_2.json', 'r') as f: plan2 = json.load(f) print(plan1 == plan2)
So it seems the plans don’t actually do the same.
After some research I found that they are not equal, because some
depends_on lists have a different ordering of their elements than the corresponding one.
I need to compare the two plans to find out if they would do the same changes.
- Is it save to order the
depends_onlists e.g. alphabetically before the comparison?
- Are there more lists with potentially different orderings that I haven’t encountered?
- Is there maybe a different way to automatically find out if the two plans would do the same on the same “reality”?