title: How do I set a computed local variable
body: <p>I have a <code>tf.json</code> file that declares a bunch of local variables.  One of the variables is a array of complex objects like so:</p>
  <pre><code>{
    &quot;locals&quot;: [
      {
        &quot;ordered_cache_behaviors&quot;: [
          {
            &quot;path_pattern&quot;: &quot;/poc-app-angular*&quot;,
            &quot;s3_target&quot;: &quot;dev-ui-static&quot;,
            &quot;ingress&quot;: &quot;external&quot;
          }
        ]
      }
    ]
  }
  </code></pre>
  <p>Here is what I want to do... instead of declaring the variable <code>ordered_cache_behaviors</code> statically in my file I want this to be a computed value.  I will get this configuration from a <code>S3</code> bucket and set the value here.  So the value statically will only be an empty array <code>[]</code> that I will append to with a script after getting the data from <code>S3</code>.</p>
  <p>This logic needs to execute each time before a <code>terraform plan</code> or <code>terraform apply</code>.  What is the best way to do this?  I am assuming I need to use a Provisioner to fire off a script?  If so how do I then set the local variable here?</p>