title: How to refer a derived variable in CloudFormation?
body: <p>I am looking for small help in CloudFormation and could not find help from documentation or may be not searching the question in right way.</p>
  <p>Here is the question.</p>
  <p>I am getting availability zones for the environment from mappings as follows.</p>
  <pre><code>&quot;AvailabilityZone&quot;: {
  &quot;Fn::Select&quot;: [
      &quot;1&quot;,
      {
          &quot;Fn::FindInMap&quot;: [
              &quot;Environment&quot;,
              {
                  &quot;Ref&quot;: &quot;EnvType&quot;
              },
              &quot;AvailabilityZones&quot;
          ]
      }
  ]
  </code></pre>
  <p>}</p>
  <p>I need to use the AZ name in my volume naming convention. How could refer the derived variable &quot;AvailabilityZone&quot; again.?</p>
  <p>Currently i am doing this.</p>
  <pre><code>    {
      &quot;Key&quot;: &quot;Name&quot;,
      &quot;Value&quot;: {
          &quot;Fn::Join&quot;: [
              &quot;-&quot;,
              [
                  {
                      &quot;Ref&quot;: &quot;NamePrefix&quot;
                  },
                  {
                      &quot;Ref&quot;: &quot;EnvType&quot;
                  },
                  &quot;myconstant&quot;,
                  {
                      &quot;Fn::Select&quot;: [
                          &quot;2&quot;,
                          {
                              &quot;Fn::Split&quot;: [
                                  &quot;-&quot;,
                                  {
                                      &quot;Fn::Select&quot;: [
                                          &quot;1&quot;,
                                          {
                                              &quot;Fn::FindInMap&quot;: [
                                                  &quot;Environment&quot;,
                                                  {
                                                      &quot;Ref&quot;: &quot;EnvType&quot;
                                                  },
                                                  &quot;AvailabilityZones&quot;
                                              ]
                                          }
                                      ]
                                  }
                              ]
                          }
                      ]
                  }
              ]
          ]
      }
  }
  </code></pre>
  <p>I am doing the same code twice.
  How can i re-use the derived variable here.?</p>