title: Conditional dependsOn
body: <p>I'm trying to add a <code>dependsOn</code> with an <code>if</code> condition but the false value also needs to return a valid resource (it can't be null or empty) the resource it depends on exists in all environments. The resource with the <code>dependsOn</code> below should only be evaluated when the environment is production. How do I go about this? Here's the depends on:</p>
  <pre><code> &quot;dependsOn&quot;: [
          &quot;[if(equals(parameters('environment'), 'prod'), resourceId('Microsoft.Compute/virtualMachines', parameters('vmName')), json('null'))]&quot;,
        ],
  </code></pre>
  <p>I was hoping the above would work but it doesn't! Please note, there's also a <code>condition</code> on the resource itself but the <code>resourceId</code> get's evaluated either way so I can't get past the validation.</p>