Does anyone know how to solve this little terraform challenge? I can’t come up with a solution for this. I have two maps like this:
instances = {
“instance1” = “us-east-1a”
“instance2” = “us-east-1a”
“instance3” = “us-east-1c”
“instance4” = “us-east-1b”
“instance5” = “us-east-1b”
“instance6” = “us-east-1c”
}
snapshots = {
“snap1” = “us-east-1c”
“snap2” = “us-east-1b”
“snap3” = “us-east-1b”
“snap4” = “us-east-1c”
“snap5” = “us-east-1a”
“snap6” = “us-east-1a”
}
What I would like to get out of this is:
desired_result = {
“instance1” = “snap5”
“instance2” = “snap6”
“instnace3” = “snap1”
“instance4” = “snap2”
“instance5” = “snap3”
“instance6” = “snap4”
}
Any ideas would be greatly appreciated!