# @karmaniverous/json2tf

> Convert complex JSON objects to Terraform notation.

Latest version **0.1.2** (published 2024-07-17) · BSD-3-Clause license · 0 weekly downloads

## Install

```sh
npm install @karmaniverous/json2tf
pnpm add @karmaniverous/json2tf
yarn add @karmaniverous/json2tf
bun add @karmaniverous/json2tf
```

## Health

**Score 40/100 (D)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads; pre 1.0.

Negative: abandoned.

## Facts

| | |
|---|---|
| Version | 0.1.2 |
| Published | 2024-07-17 |
| First published | 2024-07-10 |
| Weekly downloads | 0 |
| License | BSD-3-Clause |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 1 |
| Unpacked size | 16.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 2 |
| Author | Jason Williscroft |
| Maintainers | karmaniverous |
| Keywords | chai, eslint, lefthook, mocha, npm, nyc, prettier, rollup, template, typescript |

## Links

- npm: https://www.npmjs.com/package/@karmaniverous/json2tf
- Repository: https://github.com/karmaniverous/json2tf
- Homepage: https://github.com/karmaniverous/json2tf#readme
- Issues: https://github.com/karmaniverous/json2tf/issues
- npm.io page: https://npm.io/package/@karmaniverous/json2tf

## Dependencies (1)

- [is-what](https://npm.io/package/is-what.md) ^5.0.2

## Alternatives

- [eslint-plugin-sonarjs](https://npm.io/package/eslint-plugin-sonarjs.md) — 2.9M weekly downloads
- [eslint-config-expo](https://npm.io/package/eslint-config-expo.md) — 1.5M weekly downloads
- [@matter/protocol](https://npm.io/package/@matter/protocol.md) — 63.5K weekly downloads
- [@eventcatalog/linter](https://npm.io/package/@eventcatalog/linter.md) — 24.8K weekly downloads
- [@pandacss/eslint-plugin](https://npm.io/package/@pandacss/eslint-plugin.md) — 18.7K weekly downloads

## Recent versions

- 0.1.2 (latest) — 2024-07-17
- 0.1.1 — 2024-07-10
- 0.1.0 — 2024-07-10

## README

# JSON to Terraform

This package exports a single function, `json2tf`, which takes a JSON object and returns a Terraform configuration string.

It is NOT designed to output modules, resources, or other top-level objects. Instead, it enables the generation of the data values INSIDE those objects.

Installation:

```bash
npm install @karmaniverous/json2tf
```

Usage:

```ts
import { json2tf } from '@karmaniverous/json2tf';

const json = {
  a: 1,
  b: 'two',
  c: {
    x: null,
    y: 'eight',
    z: [42, 69, 'one million dollars'],
  },
};

console.log(json2tf(json));

/*
{
    a = 1
    b = "two"
    c = {
        x = null
        y = "eight"
        z = [
            42,
            69,
            "one million dollars"
        ]
    }
}
*/
```

`json2tf` takes an optional second argument that looks like this:

```ts
/**
 * json2tf options
 *
 * @param offset - The number of spaces to indent the entire block.
 * @param tabWidth - The number of spaces to use for each tab.
 */
interface Json2tfOptions {
  offset?: number;
  tabWidth?: number;
}
```

---

See more great templates and other tools on
[my GitHub Profile](https://github.com/karmaniverous)!

---
_Source: https://npm.io/package/@karmaniverous/json2tf · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
