Convert maps to list of maps

Hi @apparentlymart,
I have a map of any shown below .

variable "actions" {
  type = map(any)
  default = {
    "fixed_response" = {
      content_type = "application/json"
      message_body = "{ \"message\" : \"Not found\" }"
      status_code  = "404"
    },
    "redirect" = {
      port        = "443"
      protocol    = "HTTPS"
      status_code = "HTTP_301"
    }
  }
}

the end result i want as each map is arranged in own index so that i can loop through it ,
for first for each i can get the first set of map

for_each =  var.actions

1st element should be :

 "fixed_response" = {
      content_type = "application/json"
      message_body = "{ \"message\" : \"Not found\" }"
      status_code  = "404"
    }

2nd element should be :

"redirect" = {
      port        = "443"
      protocol    = "HTTPS"
      status_code = "HTTP_301"
    }

for creating listeners for ALB dynamically as shown below:
Using below code :

resource "aws_lb_listener" "this" {
  load_balancer_arn = ""
  certificate_arn   = ""
  port              = ""
  protocol          = ""
  ssl_policy        = ""

  dynamic "default_action" {
    for_each = length(keys(var.actions)) == 0 ? [] : [var.actions]
    content {
      type             = replace(keys(default_action.value)[0], "_", "-")
      target_group_arn = ""
      dynamic "fixed_response" {
        for_each = { for key, val in default_action : key => val if key == "fixed_response" }
        content {
          content_type = fixed_response.value["content_type"]
          message_body = lookup(fixed_response.value, "message_body", null)
          status_code  = lookup(fixed_response.value, "status_code", null)
        }
      }

      dynamic "redirect" {
        for_each = { for key, val in default_action : key => val if key == "redirect" }
        content {
          status_code = redirect.value["status_code"]
          path        = lookup(redirect.value, "path", null)
          host        = lookup(redirect.value, "host", null)
          port        = lookup(redirect.value, "port", null)
          protocol    = lookup(redirect.value, "protocol", null)
          query       = lookup(redirect.value, "query", null)
        }
      }
    }
  }
}