title: Terraform, conditionally execute some lines of code in template file
body: <p>In terraform, is there any way to conditionally execute some lines of code in template file? For example:</p>
  <p>I have a test.sh.tpl file defined as below called from main.tf</p>
  <p>#!/bin/bash
  echo ${test_key} &gt; /opt/test_key.properties</p>
  <p>In the above value to &quot;test_key&quot; is assigned from variable</p>
  <p>Now I want to execute the above code only if ${test_key} value is not empty. I tried this, but not working even the value exists</p>
  <p>{ if ${test_key} != &quot;&quot; }</p>
  <p>echo ${test_key} &gt; /opt/test_key.properties</p>
  <p>{ endif }</p>