title: How to skip/ignore specific module in terraform if var is null or empty
body: <p>Is there any way to skip the terraform block/file if defined variable is empty or null. Instead of throwing error.</p>
  <p>I have created tow terraform script for azure.</p>
  <ol>
  <li>For azure automation creation, runbook creation.</li>
  <li>For event grid creation.</li>
  </ol>
  <p>After executing the first step I have to generate a webhook URL manually (there no such automation support for webhook generation). after generating of webhook URL I need to define it in second resource. If I defined empty/null or invalid URL then terraform throw the error.</p>
  <p>below is the terraform code.</p>
  <pre><code>data &quot;local_file&quot; &quot;runbook_script&quot; {
    filename = &quot;${path.module}/envent-grid-runbook.ps1&quot;
  }
  resource &quot;azurerm_automation_runbook&quot; &quot;runbook&quot; {
    name                    = &quot;event-gird-notification&quot;
    location                = var.location
    resource_group_name     = var.resource_group_name
    automation_account_name = azurerm_automation_account.CreateAutomation.name
    log_verbose             = true
    log_progress            = true
    description             = &quot;This runbook is creted for event grid notification&quot;
    runbook_type            = &quot;PowerShell&quot;
  
    content = data.local_file.runbook_script.content
    publish_content_link {
      uri = &quot;&quot;
    }
  }
  
  resource &quot;azurerm_eventgrid_event_subscription&quot; &quot;key-vault&quot; {
    name  = &quot;test&quot;
    scope = &quot;/subscriptions/xxxxxxxxxxxxxxxxxxxxxx/xxxxxxxxxxxxxxxxxxxx/name&quot;
    topic_name = &quot;/subscriptions/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx/xxxxxx/vault&quot;
    webhook_endpoint  {
          url = var.webhook_url
    }
  
    included_event_types = [
                                  &quot;Microsoft.KeyVault.SecretNewVersionCreated&quot;,
                                  &quot;Microsoft.KeyVault.SecretNearExpiry&quot;,
                                  &quot;Microsoft.KeyVault.SecretExpired&quot;
                          ]
    event_delivery_schema = &quot;EventGridSchema&quot;
  
  }
  </code></pre>
  <p>If I defined null/empty var for webhook ULR variable. then getting below error.</p>
  <p><code>Error: &quot;webhook_endpoint.0.url&quot;: required field is not set</code></p>
  <p>I have created a Jenkins job, where all terraform code to run in a single job. if the code fails, then entire job is getting failed. That's why looking for a solution to skip the specific block/file if var is empty or null.</p>