title: build a dynamic ignore_changes in terraform
body: <p>I want to avoid resource creation when <strong>hidden-link</strong> tag is being added by azure on a <code>azurerm_application_insights_web_test</code> :</p>
  <pre class="lang-hcl prettyprint-override"><code>resource &quot;azurerm_application_insights_web_test&quot; &quot;webtest&quot; {
    for_each                = local.webtest_urls
    name                    = each.key
    location                = var.location
    resource_group_name     = azurerm_resource_group.main.name
    application_insights_id = azurerm_application_insights.main.id
    kind                    = &quot;ping&quot;
    frequency               = 300 # 5 minutes  
    enabled                 = true
    geo_locations           = var.ping_locations
    configuration           = templatefile(&quot;webtest.xml.tmpl&quot;, {
    url                     = each.value.url 
    expected_http_code      = 200,
    timeout                 = 60
    })
      lifecycle {
      ignore_changes = [
          tags[&quot;hidden-link:/subscriptions/${var.subscription_id}/resourceGroups/${azurerm_resource_group.main.name}/providers/Microsoft.Insights/components/${azurerm_application_insights.main.name}&quot;]
      ]
    }
  }
  </code></pre>
  <p>Unfortunatly this does not work :</p>
  <blockquote>
  <p>Error: Invalid expression
  on appinsights.tf line 52, in resource &quot;azurerm_application_insights_web_test&quot; &quot;webtest&quot;:
  52:       tags[&quot;hidden-link:/subscriptions/${var.subscription_id}/resourceGroups/${azurerm_resource_group.main.name}/providers/Microsoft.Insights/components/${azurerm_application_insights.main.name}&quot;]
  A single static variable reference is required: only attribute access and indexing with constant keys. No calculations, function calls, template expressions, etc are allowed here.</p>
  </blockquote>
  <p>When I hardcode the value to ignore this works well.</p>
  <p>How am I supposed to deal with this issue?</p>