Convert a `map` of objects into a tuple

Need some help with the following conversion

Map of objects:

locals {
  
  dummy_map = {
    "group1" = {
      zones = ["a", "b", "c"]
      name               = "group1"
      version = "1.1"
      tags = [
        {
          key                 = "type"
          value               = "abc"
        },
      ]
    },
    "group2" = {
      zones = ["a", "b", "c"]
      name               = "group2"
      version = "1.2"
      tags = [
        {
          key                 = "type"
          value               = "xyz"
        },
      ]
    }
}

to Tuple

test = [
     {
      zones = ["a", "b", "c"]
      name               = "group1"
      version = "1.1"
      tags = [
        {
          key                 = "type"
          value               = "abc"
        },
      ]
    },
     {
      zones = ["a", "b", "c"]
      name               = "group2"
      version = "1.2"
      tags = [
        {
          key                 = "type"
          value               = "xyz"
        },
      ]
    }
]

Hi @veyaja4226,

Is this what you’re looking for?

values(local.dummy_map)

The equivalent for expression would be:

[ for v in local.dummy_map : v ]
1 Like