title: How to Extract the variable values from terraform variables.tf file using PowerShell commands
body: <p>I have a variables.tf file which contains all the project variables and im trying to fetch a variable values using PowerShell.</p>
  <p><strong>variables.tf</strong></p>
  <pre><code>variable &quot;products&quot; {
     default = [
       &quot;Product-1&quot;,
       &quot;Product-2&quot;,
       &quot;Product-3&quot;,
       &quot;Product-4&quot;
       ]
  }
  
  variable &quot;product_unified_container&quot; {
     default =  [
       &quot;cont-data&quot;,
       &quot;cont-data-2&quot;
       ]
  }
  
  variable &quot;location&quot; {
    default = &quot;westeurope&quot;
  }
  </code></pre>
  <p>Using PowerShell i need to be able to fetch the variable values for any variable I want.</p>
  <p>Example : the command should give me a array of all the products variables in variables.tf if it has multiple values.</p>
  <p><strong>write-host $product_list</strong></p>
  <p>Product-1</p>
  <p>Product-2</p>
  <p>Product-3</p>
  <p>Product-4</p>
  <p><em>if the variable has one value then it should give me that value like &quot;location&quot; variable.</em></p>
  <p><strong>write-host $deployed_location</strong></p>
  <p>westeurope</p>