@667/terraform-ts
TypeScript icon, indicating that this package has built-in type declarations

0.3.0 • Public • Published

terraform-ts

A Javascript wrapper for terraform CLI.

Supports all commands with the exception of terraform console.

Installation

npm install terraform-ts

Usage

See the generated API Docs for detailed documentation.

Using the Terraform Class

import { Terraform, Parse } from "terraform-ts"

const tf = new Terraform({
    path: "/path/to/terraform",
    cwd: "/path/to/project"
})

tf.workspaceList().then(console.log)

//   workspace1
// * workspace2
//   workspace3

Functional Style

import { exec, map, Config, WorkspaceList, WorkspaceSelect, WorkspaceNew } from 'terraform-ts'

const cfg = Config({ cwd: "/path/to/project" })

// execute a single command
exec(WorkspaceNew("test-2"), cfg).then((console.log))

//> * default


// execute multiple commands
const commands = [
    WorkspaceNew("test-1"),
    WorkspaceSelect("default")
    WorkspaceList()
]

mapExec(commands, cfg).then(results => results.forEach(console.log))

// logs output of each command

Readme

Keywords

Package Sidebar

Install

npm i @667/terraform-ts

Weekly Downloads

4

Version

0.3.0

License

MIT

Unpacked Size

1.24 MB

Total Files

76

Last publish

Collaborators

  • 667