Go to file
2023-01-02 15:38:38 -08:00
node_modules added axios 2022-12-30 15:24:33 -08:00
.gitignore revise gitignore 2022-12-30 17:20:27 -08:00
config.mjs add runid to configuration section 2023-01-02 13:35:25 -08:00
log It looks like a export request is successfully made, but I get an error. Might need to introduce delay 2023-01-02 15:38:38 -08:00
main.js It looks like a export request is successfully made, but I get an error. Might need to introduce delay 2023-01-02 15:38:38 -08:00
normalize-config.js added run_id_arg to normalize_configs function call 2023-01-02 13:42:46 -08:00
package-lock.json added axios 2022-12-30 15:24:33 -08:00
package.json tired of this for now, will sort environment variables later 2022-12-30 17:16:59 -08:00
README.md Added readme with general design document 2022-12-30 17:23:32 -08:00
tfc-api-functions.mjs basic error handling skeleton is up 2023-01-02 15:26:52 -08:00
validate-user-input.mjs It looks like a export request is successfully made, but I get an error. Might need to introduce delay 2023-01-02 15:38:38 -08:00

This tool will accept a run ID and a token, and optionally a directory to store things. The directory and token(and base_url in case it's needed for TFE) can be stored in a config file.

It will get the plan ID

from the response object of the 'get run details' API call: https://developer.hashicorp.com/terraform/cloud-docs/api-docs/run#get-run-details

Then, it will make a request to plan exports.

First, it will create a plan export: https://developer.hashicorp.com/terraform/cloud-docs/api-docs/plan-exports#download-exported-plan-data

The response will contain a plan export ID, something like "pe-1jasfkl4lads86f"

You can then monitor the data.attributes.status for when it is finished

The response will contain a link to the download URL: data.attributes.links

Then, the exported data will be downloaded (either in the current directory or wherever specified): https://developer.hashicorp.com/terraform/cloud-docs/api-docs/plan-exports#download-exported-plan-data