great-sunset-355
10/19/2021, 8:29 AMpulumi stack export
preserve order? I wanted to compare 2 outputs and I get way more differences than I expected - many of them seem to be caused by a different order of the resources.prehistoric-activity-61023
10/19/2021, 8:43 AMpulumi stack export
.jq
tool.pulumi stack export | jq -S .
cat
them to jq
🙂
cat some-older-state.json | jq -S . > formatted-some-older-state.json
great-sunset-355
10/19/2021, 8:57 AMjq -S
deep sorting?prehistoric-activity-61023
10/19/2021, 8:58 AMgreat-sunset-355
10/19/2021, 9:01 AMprehistoric-activity-61023
10/19/2021, 9:02 AMjq
DOES deep sortingurn
and then compare their contentgreat-sunset-355
10/19/2021, 9:05 AMprehistoric-activity-61023
10/19/2021, 9:06 AMpulumi stack diff <state-file-a> <state-file-b>
.pulumi preview
worksgreat-sunset-355
10/19/2021, 9:08 AMprehistoric-activity-61023
10/19/2021, 9:21 AM.deployments.resources
and each one of them has urn
that should be uniqueurn
, they should be easily comparable❯ cat /tmp/a.json | jq '.'
{
"deployment": {
"resources": [
{
"urn": "b",
"data": 2
},
{
"urn": "a",
"data": 1
}
]
}
}
and with the sorting query:
❯ cat /tmp/a.json | jq '.deployment.resources|=sort_by(.urn)'
{
"deployment": {
"resources": [
{
"urn": "a",
"data": 1
},
{
"urn": "b",
"data": 2
}
]
}
}
pulumi stack export | jq '.deployment.resources|=sort_by(.urn)'
and see if that helpsgreat-sunset-355
10/19/2021, 9:29 AM