title: map of string within a map object
body: <p>I'm trying to create a Compute Engine instance and I'm trying to map values of different types, but I'm getting error as you can see from the following code.</p>
  <pre><code>variable &quot;compute_engine_instances&quot; {
    type = map(object({
      instance_name = string
      machine_type  = string
      zone          = string
      tags          = list(string)
      image_name    = string
      image_project = string
      labels        =list(object({
      app_id      = number
      cost_center = string
      owner       = string
      email       = string
    }))
    }))
  }
  
  module &quot;compute_engines&quot; {
    source = &quot;../modules/compute_engine&quot;
  
    for_each      = var.compute_engine_instances
    project_id    = var.project_id
    instance_name = each.value.instance_name
    machine_type  = each.value.machine_type
    tags          = each.value.tags
    labels        = each.value.labels
    subnetwork    = var.subnetwork
    zone          = each.value.zone
    image_name    = each.value.image_name
    image_project = each.value.image_project
  }
  
  </code></pre>
  <p>Terraform tf vars file as:</p>
  <pre><code>compute_engine_instances ={
      &quot;test-adi&quot;={
  
      instance_name = &quot;test-vm&quot;
      machine_type  = &quot;n1-standard-1&quot;
      zone           = &quot;us-east4-b&quot;
      tags   = [&quot;foo&quot;,&quot;bar&quot;]
      image_name    = &quot;centos-7&quot;
      image_project = &quot;cc-devtools&quot;
      labels = [{
    app_id      = &quot;6&quot;
    cost_center = &quot;0156&quot;
    owner       = &quot;ops&quot;
    email       = &quot;ps&quot;
  }]
  }
  }
  </code></pre>
  <p>I'm getting the following error when I run tf plan, How can i fix this error?</p>
  <p>Thanks for you help.</p>
  <pre><code>Error: Incorrect attribute value type
  
    on ..\modules\compute_engine\main.tf line 14, in resource &quot;google_compute_instance&quot; &quot;generic_instance&quot;:
    14:   labels = var.labels
  
  Inappropriate value for attribute &quot;labels&quot;: map of string required.
  </code></pre>
  <p>modules folder looks like the following:</p>
  <pre><code>data &quot;google_compute_image&quot; &quot;compute_image&quot; {
    name    = var.image_name
    project = var.image_project
  }
  
  resource &quot;google_compute_instance&quot; &quot;generic_instance&quot; {
    project      = var.project_id
    name         = var.instance_name
    machine_type = var.machine_type
    zone         = var.zone
  
    tags   = var.tags
    labels = var.labels
  
    boot_disk {
      initialize_params {
        image = data.google_compute_image.compute_image.self_link
      }
      auto_delete = true
    }
  
    network_interface {
      subnetwork = var.subnetwork
    }
  }
  </code></pre>
  <p>labels variable in modules is as follows:</p>
  <pre><code>variable &quot;labels&quot; {
    type        = any
    description = &quot;A list of labels for this VM&quot;
  } 
  </code></pre>