node_modules | ||
.gitignore | ||
config.mjs | ||
log | ||
main.js | ||
normalize-config.js | ||
package-lock.json | ||
package.json | ||
README.md | ||
tfc-api-functions.mjs | ||
validate-user-input.mjs |
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