title: Terraform output variables as input
body: <p>I'm new to Terraform and trying to wrap my head around the use of output variables. we are on AKS, and I'm deploying the following resources: resource group, log analytics workspace, Azure Kubernetes.  When Log analytics is deployed, I capture the workspace ID into an output variable. Now, when Terraform deploys Kubernetes, it needs to know the workspace ID, how can I pass the output value to the <code>addon_profile</code> (last line in the code below)? </p>
  
  <p>Error: </p>
  
  <pre><code>environment = "${log_analytics_workspace_id.value}"
  
  A managed resource "log_analytics_workspace_id" "value" has not been declared in the root module.
  </code></pre>
  
  <p>Code: </p>
  
  <pre><code>resource "azurerm_resource_group" "test" {
    name     = "${var.log}"
    location = "${var.location}" 
  }
  
  resource "azurerm_log_analytics_workspace" "test" {
    name                = "${var.logname}"
    location            = "${azurerm_resource_group.loganalytics.location}"
    resource_group_name = "${azurerm_resource_group.loganalytics.name}"
    sku                 = "PerGB2018"
    retention_in_days   = 30
  }
  
  **output "log_analytics_workspace_id" {
    value = "${azurerm_log_analytics_workspace.test.workspace_id}"
  }** 
  
  ....................................................
  
  addon_profile {
        oms_agent {
          enabled                    = true
          **log_analytics_workspace_id = "${log_analytics_workspace_id.value}"**
        }
  }
  </code></pre>