title: Terraform depends_on with modules
body: <p>I'm new at terraform and I created a custom azure policies on module structure.
  each policy represents a custom module. 
  One of the modules that I have created is enabling diagnostics logs for any new azure resource created. 
  but, I need a storage account for that. (before enabling the diagnostics settings how can I implement <strong>"depends_on"? or any other methods?</strong>
  I want to create first the storage account and then the module of diagnostics settings.
  on the <code>main.tf</code> (where calling all the other modules) or inside the resource (module)? </p>
  
  <p>Thanks for the help!! :) </p>
  
  <p><strong>this below code represents the main.tf file:</strong></p>
  
  <pre><code>//calling the create storage account name
  
  module "createstorageaccount" {
  
  source = "./modules/module_create_storage_account"
      depends_on = [
      "module_enable_diagnostics_logs"
    ]
  
  }
  </code></pre>
  
  <p><strong>this one represents the create storage account module</strong> </p>
  
  <pre><code>resource "azurerm_resource_group" "management" {
  
  
    name     = "management-rg"
    location = "West Europe"
  }
  
  resource "azurerm_storage_account" "test" {
    name                     = "diagnostics${azurerm_resource_group.management.name}"
    resource_group_name      = "${azurerm_resource_group.management.name}"
    location                 = "${azurerm_resource_group.management.location}"
    account_tier             = "Standard"
    account_replication_type = "LRS"
  
    tags = {
      environment = "diagnostics"
    }
  }
  
      depends_on = [
      "module_enable_diagnostics_logs"
    ]
  
  </code></pre>