title: Conditional Blocks for Terraform resource creation
body: <p>I am trying to create some lb rules using the following resource : <a href="https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/lb_listener_rule" rel="nofollow noreferrer">https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/lb_listener_rule</a></p>
  <p>I am trying to iterate over a map of objects and create these rules, some of which have have different condition blocks but even though the resources states these are optional it doesn't like null as a value</p>
  <p>I am wondering if it is possible to only add a condition based on the object passed in</p>
  <pre><code>condition {
      path_pattern {
        values = each.value.condition_block.path_patterns
      }
    }
  
    condition {
      host_header {
        values = each.value.condition_block.host_headers
      }
    }
  </code></pre>
  <p>so in the above example some of my config might not have a path_pattern set in which casa I would want it to skip over this and just add the host_header values and so on.</p>
  <p>I did try doing this</p>
  <pre><code>condition {
          path_pattern {
            values = try(each.value.condition_block.path_patterns, null)
          }
        }
  </code></pre>
  <p>but it doesn't like this</p>