netmemo / netmemo.github.io

1 stars 0 forks source link

post/tf-map-ordering/ #3

Open utterances-bot opened 1 year ago

utterances-bot commented 1 year ago

Terraform list of map ordering | netmemo.github.io

The need I went into some troubles when I wanted to implement NSXT rules. My aim was to keep the order of the rules as intended by the user when he wrote his data without asking him to enter a rule ID manually. If the order is kept then it’s easy to prioritize the rules according to their placement. With the NSX-T Terraform provider the rules are in the form below :

https://netmemo.github.io/post/tf-map-ordering/

ChrisTerBeke commented 1 year ago

format("%.4d",key) this saved our day

kbcz1989 commented 3 weeks ago

Great article!

I was still missing my use-case, so here it is: Transform list of objects into list of objects sorted by any key(like "name"): [for k, v in { for i in var.list : i.name => i } : v]