Importing appgateway azure rewrite rules

Hello,
i have an issue imoorting an azure application gateway.
.
I created modules and dynamic blocks to make it more general.
I have a tdvars file where i have all the values and the core module and variables.

dynamic "rewrite_rule_set" {
    for_each = var.rewrite_rule_sets
    content {
      name = rewrite_rule_set.value["name"]
      dynamic "rewrite_rule" {
        for_each = rewrite_rule_set.value["rewrite_rule"]
        content {
          name          = rewrite_rule.value["name"]
          rule_sequence = rewrite_rule.value["rule_sequence"]
          dynamic "condition" {
            for_each = rewrite_rule.value["condition"]
            content {
              variable    = condition.value["variable"]
              pattern     = condition.value["pattern"]
              ignore_case = condition.value["ignore_case"]
              negate      = condition.value["negate"]
            }
          }

variables

variable "rewrite_rule_sets" {
  type = map(object({
    name = string
    rewrite_rule = optional(map(object({
      name          = string
      rule_sequence = string
      condition = optional(map(object({
        variable    = string
        pattern     = string
        ignore_case = optional(bool)
        negate      = optional(bool)
      })))
      request_header_configuration = optional(map(object({
        header_name  = string
        header_value = string
      })))
      response_header_configuration = optional(map(object({
        header_name  = string
        header_value = string
      })))
      url = optional(map(object({
        path         = optional(string)
        query_string = optional(string)
        components   = optional(string)
        reroute      = optional(bool)
      })))
    })))
  }))
}

So what it does is it mixes the sets he tries to replace the order the url with some others