-
Notifications
You must be signed in to change notification settings - Fork 10.3k
sorted_list == sort(sorted_list) evaluates to false #35407
Copy link
Copy link
Closed as not planned
Labels
Description
Terraform Version
Terraform v1.9.0
on darwin_arm64
(also tested with 1.8.2)Terraform Configuration Files
locals {
a = ["a", "b", "c"]
}
output "a" {
value = local.a
}
output "a_sorted" {
value = sort(local.a)
}
output "sorted" {
value = local.a == sort(local.a) // evaluates to false
}Debug Output
https://gist.github.com/adam-rummer-hpe/fb3629195481d99879099950992f36e5
Expected Behavior
when already sorted, the list should be equal to the sorted list
Actual Behavior
they are not evaluated as being equal, despite outputting the same
e.g. a plan produces
Changes to Outputs:
+ a = [
+ "a",
+ "b",
+ "c",
]
+ a_sorted = [
+ "a",
+ "b",
+ "c",
]
+ sorted = false
You can apply this plan to save these new output values to the Terraform state, without changing any real infrastructure.
Steps to Reproduce
terraform initterraform plan
Additional Context
No response
References
No response
Reactions are currently unavailable