Interpolate variables with Outputs

Dear All,

I’m facing a situation which I have no clue how to handle in a proper way.

TL;DR;
The goal is installing OMS-Agent to a Windows VM on Azure, which the WORKSPACE_ID and WORKSPACE_KEY needs to be pulled from another resource (azurerm_log_analytics_workspace).

The extension definition is declared using .tfvars.

What’s the best approach for pulling the ID and KEY from the Analytics and use them as arguments for the VM_extension?

# variables.tf
...
variable "vm-extensions" {
    description = "VM definitions"
    type        = map(object({
        vm-name                     = string
        vm-extension-name           = string
        vm-extension-publisher      = string
        vm-extension-type           = string
        vm-extension-type-version   = string
        vm-extension-settings       = string
    }))
}
...
# variables.auto.tfvars
# The definition below is not permitted since we cannot have variables declared in variables files.

win-vm-params = {
        "app-01-install-omsagent" = {
            vm-name                     = "vm-test-app-01"
            vm-extension-name           = "OmsAgent"
            vm-extension-publisher      = "Microsoft.EnterpriseCloud.Monitoring"
            vm-extension-type           = "MicrosoftMonitoringAgent"
            vm-extension-type-version   = "1.0"
            vm-extension-settings       = <<SETTINGS
                                {
                                    "workspaceId": "${azurerm_log_analytics_workspace.azmon_lga.workspace_id}",
                                    "workspaceKey": "${azurerm_log_analytics_workspace.azmon_lga.primary_shared_key}"
                                }
                                SETTINGS

        },
}
# main.tf
...
resource "azurerm_virtual_machine_extension" "vm-extensions" {
  for_each              = var.vm-extensions
  depends_on            = [azurerm_windows_virtual_machine.windows-vm]
  name                  = "vm-extension-${local.short-app-name}-${var.short-location}-${var.environment}-${each.value.vm-name}-${each.value.vm-extension-name}"
  virtual_machine_id    = azurerm_windows_virtual_machine.windows-vm[each.value.vm-name].id
  publisher             = each.value.vm-extension-publisher
  type                  = each.value.vm-extension-type
  type_handler_version  = each.value.vm-extension-type-version
  settings              = each.value.vm-extension-settings
  tags                  = var.tags
}
...

Any help will be highly appreciated.