npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@c6fc/terraform

v1.3.0

Published

Download/Use Terraform via Node

Downloads

327

Readme

@c6fc/terraform

Link and use the Terraform binary with NPM.

Usage

npm install -p @c6fc/terraform

Set the tf_version config element in your package.json:

"config": {
	"tf_version": "0.15.4"
}
const terraform = require('@c6fc/terraform');

// Importing does nothing on its own -- no disk reads, no download. exec()
// installs the binary on first use, once however many callers ask for it.
await terraform.exec(['apply'], { cwd: './render', stdio: 'inherit' });

That is the whole API for running Terraform. You do not need to await anything first; exec does it for you.

Spawning the binary yourself

isReady exists for the one case exec doesn't cover — when you want the executable and intend to run it your own way. Reading it installs the binary if it isn't cached, and resolves once it's on disk:

const { spawn } = require('child_process');

await terraform.isReady;
spawn(terraform.executablePath, ['plan'], { stdio: 'inherit' });

This package's own bin/index.js is exactly this. Reading executablePath without awaiting isReady first gives you a path that may not exist yet.

Laziness

cacheDir, version and executablePath are accessors: reading any of them resolves tf_version from the nearest package.json, and reading isReady — or calling exec — downloads and hash-verifies the binary if it isn't cached. Destructuring the module (const { isReady } = require('@c6fc/terraform')) therefore starts the download immediately; reach through the module object instead to stay lazy.

Platforms

Linux, on arm, arm64, x32 and x64. Anything else throws when the binary is first needed, naming itself and what is supported, rather than at import.

Exit codes

exec() exits the process with Terraform's own status when Terraform fails, and with 1 when it could not be started at all — a missing binary, or a cwd that does not exist. spawnSync reports status: null in that case, which used to be passed straight to process.exit(), where null means success.

I created this package specifically for use with Sonnetry (@c6fc/sonnetry), but perhaps someone else will find it useful.