HCL/Terraform config parser and generator
JavaScript TypeScript Nearley CSS Other
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
.vscode
fixtures
lib_test/test/snapshots
packages/docsite
src
test
typings
.editorconfig
.gitignore
.travis.yml
LICENSE
README.md
deploy.sh
lerna.json
package.json
tsconfig.json
tsconfig.test.json
tslint.json

README.md

title path layout
README
/readme/
home

Build Status Coverage Status MIT license

tf-hcl

Hashicorp Config Language parsing/generating.

Usage

const makeParser = require('tf-hcl').makeParser;

const parser = makeParser();
parser.feed(`
# Simple EC2 instance
resource "aws_instance" "my_ec2" {
  ami           = "\${data.aws_ami.ubuntu.id}"
  instance_type = "t2.micro"

  tags {
    Name = "HelloWorld"
  }
}
`);

const results = parser.results[0];

AST follows the Unist schema but is otherwise undocumented. See the test snapshots or read the tests for details; I'll document these once the whole library is stable.

Contributing

This project uses ESLint-style commit messages.