Store OutPut Value in a text file on Terrafrom Enterprise

We have Terrafrom enterprise which remotely invoked via API Call .
Now I do have plenty of output and those information i need to store in txt and send back to the API method wherever i called it file when the apply has completed . Any help would be highly appreciated .

Depending on how you call the Terraform Enterprise API, there are a few ways to get this, based on the documentation.

If you are working from within the Run API (e.g., the /runs endpoint), then you should be able to add the include parameter to however you’re retrieving the Run information. For example, if you query the status of a Run via GET /runs/:run_id, then you should be able to alter the URL to GET /runs/:run_id?include=plan,apply to get the information about the Plan and Apply related to the Run.

Note: if that doesn’t work, the IDs of the related Plan and Apply can be found in the relationships.plan and relationships.apply properties, respectively, of the run object itself. This can then be used in the GET /plans/:id or GET /applies/:id API methods to get the Plan and Apply objects.

Each of those objects, per the Plan and Apply documentation, contain a log-read-url property that should direct you to a URL to Archivist, which will contain the log of the Plan or Apply, respectively.

Hope this helps!

1 Like