How to output an inner map

Hi all, I have being trying different options to output the inner map of a nested type structure. I have module A and in it, another module, module B which I’m looping over with a for_each. The final output is;

current_final_output = {
     + customer-a          = {
          + "customer-a_application-a" = {
              + count_vm              = 1
              + enable_stickiness     = "false"
              + health_check_enabled  = "true"
              + health_check_interval = "10"
              + health_check_port     = 8080
              + health_check_protocol = "http"
              + instance_ids          = [
                  + "i-0256bcbazc1306258",
                ]
              + path                  = [
                  + "/customer-a_application-a/*",
                ]
              + port                  = 80
              + priority              = 1200
              + protocol              = "http"
              + protocol_version      = "http1"
              + type_stickiness       = "lb_cookie"
            }
          + "cusomter-a_application-b"  = {
              + count_vm              = 1
              + enable_stickiness     = "false"
              + health_check_enabled  = "true"
              + health_check_interval = "10"
              + health_check_port     = 443
              + health_check_protocol = "http"
              + instance_ids          = [
                  + "i-0981bcbzzc1306258",
                ]
              + path                  = [
                  + "/cusomter-a_application-b/*",
                ]
              + port                  = 8443
              + priority              = 1201
              + protocol              = "http"
              + protocol_version      = "http1"
              + type_stickiness       = "lb_cookie"
            }
        }
      + cusomter-b         = {
          + "cusomter-b_application_a" = {
              + count_vm              = 1
              + enable_stickiness     = "false"
              + health_check_enabled  = "true"
              + health_check_interval = "8"
              + health_check_port     = 8080
              + health_check_protocol = "http"
              + instance_ids          = [
                  + "i-195471ema99bdecf8",
                ]
              + path                  = [
                  + "/cusomter-b_application_a/*",
                ]
              + port                  = 80
              + priority              = 1200
              + protocol              = "http"
              + protocol_version      = "http1"
              + type_stickiness       = "lb_cookie"
            }
          + "cusomter-b_application_b"  = {
              + count_vm              = 1
              + enable_stickiness     = "false"
              + health_check_enabled  = "true"
              + health_check_interval = "10"
              + health_check_port     = 8443
              + health_check_protocol = "http"
              + instance_ids          = [
                  + "i-031471eaa99bdecf8",
                ]
              + path                  = [
                  + "/cusomter-b_application_b/*",
                ]
              + port                  = 443
              + priority              = 1201
              + protocol              = "http"
              + protocol_version      = "http1"
              + type_stickiness       = "lb_cookie"
            }
        }
}

How can I output the inner loop so I end with the following?

required_final_output = {
        + "customer-a_application-a" = {
              + count_vm              = 1
              + enable_stickiness     = "false"
              + health_check_enabled  = "true"
              + health_check_interval = "10"
              + health_check_port     = 8080
              + health_check_protocol = "http"
              + instance_ids          = [
                  + "i-0256bcbazc1306258",
                ]
              + path                  = [
                  + "/customer-a_application-a/*",
                ]
              + port                  = 80
              + priority              = 1200
              + protocol              = "http"
              + protocol_version      = "http1"
              + type_stickiness       = "lb_cookie"
            }
        + "cusomter-a_application-b"  = {
              + count_vm              = 1
              + enable_stickiness     = "false"
              + health_check_enabled  = "true"
              + health_check_interval = "10"
              + health_check_port     = 443
              + health_check_protocol = "http"
              + instance_ids          = [
                  + "i-0981bcbzzc1306258",
                ]
              + path                  = [
                  + "/cusomter-a_application-b/*",
                ]
              + port                  = 8443
              + priority              = 1201
              + protocol              = "http"
              + protocol_version      = "http1"
              + type_stickiness       = "lb_cookie"
            }
        + "cusomter-b_application_a" = {
              + count_vm              = 1
              + enable_stickiness     = "false"
              + health_check_enabled  = "true"
              + health_check_interval = "8"
              + health_check_port     = 8080
              + health_check_protocol = "http"
              + instance_ids          = [
                  + "i-195471ema99bdecf8",
                ]
              + path                  = [
                  + "/cusomter-b_application_a/*",
                ]
              + port                  = 80
              + priority              = 1200
              + protocol              = "http"
              + protocol_version      = "http1"
              + type_stickiness       = "lb_cookie"
            }
        + "cusomter-b_application_b"  = {
              + count_vm              = 1
              + enable_stickiness     = "false"
              + health_check_enabled  = "true"
              + health_check_interval = "10"
              + health_check_port     = 8443
              + health_check_protocol = "http"
              + instance_ids          = [
                  + "i-031471eaa99bdecf8",
                ]
              + path                  = [
                  + "/cusomter-b_application_b/*",
                ]
              + port                  = 443
              + priority              = 1201
              + protocol              = "http"
              + protocol_version      = "http1"
              + type_stickiness       = "lb_cookie"
            }
}

I think you want to do a deep merge. It doesn’t seem to be natively supported by Terraform but there are some modules out there.

Example: GitHub - Invicton-Labs/terraform-null-deepmerge: This module performs a deep map merge of standard Terraform maps/objects

Not exactly because I want to remove the outer maps with keys customer-a and customer-b