title: How to call parameterized Jsonnet from bash?
body: <p>I can't understand how to best to parameterize a Jsonnet file so that I may call the same file from bash and from another Jsonnet file.</p>
  
  <p>Assuming I have a simple template called template.jsonnet:</p>
  
  <pre><code>{
    // Required arguments
    name:: error "'name' must be specified",
    port:: error "'port' must be specified",
  
    ...,
  }
  </code></pre>
  
  <p>I can readily incorporate this into another Jsonnet file and provide its required parameter values with:</p>
  
  <pre><code>{
    local template = = import "./template.jsonnet";
  
    template + {
      name:: "service",
      port:: 8080,
  }
  </code></pre>
  
  <p>I'm struggling to determine the intended way that I could call <code>template.jsonnet</code> from bash to achieve the same result.</p>
  
  <p>I can use <code>--ext-str</code> but this appears to require <code>std.extVar(x)</code></p>
  
  <p>A GitHub <a href="https://github.com/google/jsonnet/issues/147" rel="noreferrer">issue</a> suggests that <code>--tla-code</code> may be an alternative to std.extVar() but I don't understand how to use it for my needs.</p>
  
  <p>A follow-up question is: how do do this for a parameter this is an array:</p>
  
  <pre><code>{
    local template = = import "./template.jsonnet";
  
    template + {
      name:: "service",
      port:: [8080,8081,8082],
  }
  </code></pre>