title: Unable to use JSON input for Terraform a map variable in Azure VM extension setting
body: <p>I am creating an SQL extension for a Azure Window VM using variable type map.</p>
  <p>My module is defined as below :</p>
  <pre><code>resource &quot;azurerm_virtual_machine_extension&quot; &quot;virtual_machine_extension&quot;{
    for_each = var.virtual_machine_extensions
    name = each.value[&quot;name&quot;]
    virtual_machine_id = lookup(var.virtual_machine_ids, each.value[&quot;virtual_machine_variable_name&quot;], null)
    publisher = each.value[&quot;publisher&quot;]
    type = each.value[&quot;type&quot;]
    type_handler_version = each.value[&quot;type_handler_version&quot;]
    settings = jsonencode(each.value[&quot;settings&quot;])
    tags = each.value[&quot;virtual_machine_extension_tags&quot;]
  }
  </code></pre>
  <p>and my variable is defined as below :</p>
  <pre><code> variable &quot;virtual_machine_extensions&quot; {
        type = map(object({
         name = string
         virtual_machine_variable_name = string
         publisher = string
         type = string
         type_handler_version = string
         settings = any
         virtual_machine_extension_tags = map(string)
       }))
     }
  
     variable &quot;virtual_machine_ids&quot; {
       type    = map(string)
       default = {}
     }
  </code></pre>
  <p>virtual_machine_ids will have a list of virtual machines and their corresponding ids passed to it from the main file</p>
  <p>My tfvars file looks like this :</p>
  <pre><code>   virtual_machine_extensions = {
    virtual_machine_extension_sql ={
      name = &quot;vmsqlext&quot;   #Required
      virtual_machine_variable_name = &quot;windows_virtual_machine1&quot;  
      publisher = &quot;Microsoft.SqlServer.Management&quot;  
      type = &quot;SqlIaaSAgent&quot; 
      type_handler_version = &quot;1.2&quot; 
      settings =&lt;&lt;SETTINGS
      {
        &quot;AutoTelemetrySettings&quot;: {
          &quot;Region&quot;: &quot;West Europe&quot;
        },
        &quot;AutoPatchingSettings&quot;: {
          &quot;PatchCategory&quot;: &quot;WindowsMandatoryUpdates&quot;,
          &quot;Enable&quot;: true,
          &quot;DayOfWeek&quot;: &quot;Sunday&quot;,
          &quot;MaintenanceWindowStartingHour&quot;: &quot;2&quot;,
          &quot;MaintenanceWindowDuration&quot;: &quot;60&quot;
        },
        &quot;KeyVaultCredentialSettings&quot;: {
          &quot;Enable&quot;: false,
          &quot;CredentialName&quot;: &quot;&quot;
        },
        &quot;ServerConfigurationsManagementSettings&quot;: {
          &quot;SQLConnectivityUpdateSettings&quot;: {
            &quot;ConnectivityType&quot;: &quot;Public&quot;,
            &quot;Port&quot;: &quot;1433&quot;
          },
          &quot;SQLWorkloadTypeUpdateSettings&quot;: {
            &quot;SQLWorkloadType&quot;: &quot;GENERAL&quot;
          },
          &quot;AdditionalFeaturesServerConfigurations&quot;: {
            &quot;IsRServicesEnabled&quot;: &quot;true&quot;
          },
          &quot;protectedSettings&quot;: {}
        }
      }
      SETTINGS
      
      virtual_machine_extension_tags = {
        applicationName = &quot;Windows VM Extension&quot;
        approver        = &quot;IT Infrastructure&quot;
      }
    }
  }
  </code></pre>
  <p>I am receiving the below error when I run apply:</p>
  <pre><code>Error: unable to parse settings: json: cannot unmarshal string into Go value of type map[string]interface {}
  </code></pre>
  <p>A screenshot of the same:
  <a href="https://i.stack.imgur.com/AAB6Q.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/AAB6Q.png" alt="enter image description here" /></a></p>
  <p>understand that the issue is coming because the JSON input is not getting read properly , I tried running the code by using &lt;&lt;EOF EOF instead of &lt;&lt;SETTING SETTING as well but it's still throwing the same error</p>