JSPM

@densebrain/terraformjs

1.0.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 2
  • Score
    100M100P100Q22022F
  • License MIT

A HashiCorp Terraform wrapper

Package Exports

  • @densebrain/terraformjs

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@densebrain/terraformjs) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

terraformjs

Forked from strigo/terraform.js. It was not published, that's the only reason.

terraformjs is a javascript wrapper for terraform, which aims to provide an simple API to execute terraform commands from a nodejs app.

Alternatives

There don't appear to be any.

Installation

$ npm install [-g] terraformjs

Usage

var terraform = require('terraformjs')

console.log(terraform.version())
// 0.8.5

# The constructor receives the following three arguments:
# workDir = process.cwd(), silent = false, noColor = false
let tf = new terraform.Terraform(workDir, silent, noColor);
let outcome = tf.apply()
console.log(outcome.stdout)

// To pass options:
let outcome = tf.apply(
    {
        'state': 'my-state-file.tfstate',
        'var': {'foo': 'bar', 'bah': 'boo'},
        'vars_file': ['x.tfvars', 'y.tfvars']
    }
)

// A commands positional arguments will be passed alongside an object of options:
let outcome = tf.apply({}, process.cwd())

Command positional arguments and options

  • Optional positional arguments can be passed as null to the function if not required.
  • Option names are normalized (e.g. vars_file is really --vars-file).
  • Strings are simple options (e.g. -state=my-state-file.tfstate)
  • Objects are converted to (multiple) key=values (e.g. -var 'foo=bar' -var 'bah=boo')
  • Arrays are converted to multi-usage options (e.g. --vars-file=x --vars-file=y)

Supported subcommands

As of now, the supported subcommands are:

  • apply
  • destroy
  • console
  • fmt
  • get
  • graph
  • import
  • init
  • output
  • plan
  • push
  • refresh
  • show
  • taint
  • untaint
  • validate

Contributions..

See CONTRIBUTIONS

Pull requests are always welcome..