title: retrieve value on post api call - terraform
body: <p>I have been trying to write a code using terraform which must do an API call on POST and it must get back value on post, this return value on post I must be able to use it else where in the code.</p>
  <p>Reading a lot I noticed there are two ways to do it</p>
  <ol>
  <li>Mastercard Rest API</li>
  <li>Local-Exec and Null provider</li>
  </ol>
  <p>The first one also has some issues when we try to fetch a value on post, unfortunately the API I am trying to call needs some input values to return an output. If anyone has experience in doing this using the mastercard rest api please let me know how.</p>
  <p>My curl statement looks like this -</p>
  <pre><code>curl --insecure -X POST 'https://url.fqdn/get_hostname' --header 'Content-Type: application/json' --header 'Authorization: Basic tokenvalue' -d '{&quot;key&quot;: &quot;value&quot;,&quot;key&quot;: &quot;value&quot;,&quot;key&quot;: &quot;value&quot;}'
  </code></pre>
  <p>Using local-exec and null provider</p>
  <pre><code>resource &quot;null_resource&quot; &quot;get-hostname&quot; {
  provisioner &quot;local-exec&quot; {
      command = &lt;&lt;EOF
      curl --insecure -X POST 'https://url.fqdn/get_hostname' --header 'Content-Type: application/json' --header 'Authorization: Basic tokenvalue' -d '{&quot;key1&quot;: &quot;value1&quot;,&quot;key2&quot;: &quot;value2&quot;}'
      EOF
  }
  </code></pre>
  <p>}</p>
  <p>How can I get the output of the command property ?</p>