Google Monitoring Uptime Check - monitored_resource - labels

Terraform v0.12.20
provider.google v3.16.0

I am trying to create a tf file which I can use to create any of the three uptime checks with the resource google_monitoring_uptime_check_config
(uptime_url gce_instance gae_app).

The issue I am having is the labels field inside the monitored_resource block will have different values for each type.

I have defined the variable as such for one example:

variable "resource_type_labels" {
  type        = map
  default = {
    "project_id" = "my_project"
    "module_id"  = "default"
    "version_id" = "20200zzzxxc"
    "zone"       = "us-central"
  }
  description = "Labels for the resource type. Labels are different for each resource type."
}

The goal would be in a .tfvar file I could override the resource_type_labels with the correct values for that type, and then have it build the monitored_resource block with the correct number of key value entries.
Example: gae_app has 4 values and uptime_url has 2 values.

Output should look like this according to the example.

  monitored_resource {
    type = "uptime_url"
    labels = {
      project_id = "my-project-name"
      host       = "192.168.1.1"
    }
  }

Can you tell me how I need to code it in the .tf file?
I have tried so many different ways with no success.
Here is just one example:

  monitored_resource {
    type = var.type

    labels = {
      for_each = var.resource_type_labels
        (var.resource_type_labels.key) = (var.resource_type_labels.value)
    }
  }

Thank You in advance!

Update: I did some more reading about inline blocks and I tried this logic.

  monitored_resource {
    type = var.type

    dynamic "labels" {
      for_each = var.resource_type_labels
      content {
        labels.key = labels.value
      }
    }
  }

But when I run terraform apply I get this error.

$ terraform apply --var-file monitoring-uptime-check.tfvars

Error: Argument or block definition required

  on monitoring-uptime-check-https.tf line 33, in resource "google_monitoring_uptime_check_config" "uptime_check":
  33:         labels.key = labels.value

An argument or block definition is required here. To set an argument, use the
equals sign "=" to introduce the argument value.

Does anyone have any idea on this one?
I really need to know how to create the inline block, with a variable amount of attributes, such as this (labels):

  monitored_resource {
    type = "uptime_url"
    labels = {
      project_id = "my-project-name"
      host       = "192.168.1.1"
    }
  }

This issue is closed.
The solution can be found here…