title: If else condition cloudformation
body: <p>I would like to populate a value in cloudformation depending on input parameter. I want to assign <code>Name</code> as either <code>test-svc.abc.com</code> or <code>svc.abc.com</code> depending on whether environment name is <code>prod</code> or not. If the environnment name is <code>prod</code> then the value should be <code>svc.abc.com</code> otherwise it should always be <code>{env-name}-svc.abc.com</code>.</p>
  
  <p>I have the following expression:</p>
  
  <pre><code>Name: !Join [ '-', [ !Ref EnvironmentName, !Ref 'HostedZoneName' ] ]
  </code></pre>
  
  <p>In the above expression, <code>HostedZoneName</code> will be passed as <code>svc.abc.com</code> and the value of <code>EnvironmentName</code> could be <code>test, release or prod</code>. So the conditions should be evaluated as:</p>
  
  <pre><code>Inputs: HostedZoneName -&gt; svc.abc.com, EnvironmentName -&gt; test
  Output: test-svc.abc.com
  
  Inputs: HostedZoneName -&gt; svc.abc.com, EnvironmentName -&gt; release
  Output: release-svc.abc.com
  
  Inputs: HostedZoneName -&gt; svc.abc.com, EnvironmentName -&gt; 1234567
  Output: 1234567-svc.abc.com
  
  Inputs: HostedZoneName -&gt; svc.abc.com, EnvironmentName -&gt; prod
  Output: svc.abc.com
  </code></pre>
  
  <p>It's basically ternary operator.</p>
  
  <pre><code>Name = EnvironmentName.equals("prod") ? HostedZoneName : EnvironmentName + "-" + HostedZoneName
  </code></pre>
  
  <p>Struggling with if else condition in CloudFormation.</p>