Terraform Cloud REST API client for javascript.
NOTE: This is a work in progress, please review the current implementation.
yarn add terraform-cloud # With Yarn
npm install terraform-cloud # With NPM
import { TerraformCloud } from 'terraform-cloud'
// Set a your terraform cloud API token
const { Account, Plans, Runs } = new TerraformCloud('terraform-api-token')
// Make an API call
// Get Account Information
Account.getDetails().then(account => {
// handle account data
})
// Update Account Password
const updatePasswordRequest = {
data: {
type: 'user',
attributes: {
current_password: 'current-password',
password: 'new-password',
password_confirmation: 'new-password',
},
},
}
Account.updatePassword(updatePasswordRequest).then(user => {
// handle account password update
})
Plans.show('plan-id').then(plan => {
// handle plan data
})
// Runs
Runs.show('run-id').then(run => {
// handle run data
})
// Perform an action over a run ex: (apply, cancel, discard, force-cancel, force-execute)
Runs.action('cancel', 'run-id', { data: { comment: 'cancel run by id' } }).then(() => {
// handle run action
})
- Account (100%)
- Runs (100%)
- Plans (90%) - TODO: Handle Terraform Plans JsonOutput #17
- Workspaces
- ...
We would love you to contribute to terraform-cloud
, pull requests are very welcome! Please see CONTRIBUTING.md for more information.