Skip to content

anhldbk/hcl-parser

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 

Repository files navigation

HCL Parser

Overview

This package is used to generate Javascript parser for HCL (HashiCorp Configuration Language).

Thank you phamtai97 for making this feasible

Installation

# Install GopherJS first
$ go get -u github.com/gopherjs/gopherjs

# Build JS package
$ gopherjs build github.com/anhldbk/hcl-parser -o index.js -m

# Require & enjoy

Example JS code

import {parse} from "hcl-parser"
const input = `
# only root or owners to manage groups
allow {
  subject = "iam:user/anhldbk"
  action = "group/\*"
  resource = [
    "iam:group/admin"
  ]
}

# allow any other subjects to read
allow {
  subject = "\*"
  action = [
    "group/read",
    "group/list"
  ]
  resource = [
    "iam:group/zalopay/pma"
  ]
}  
`

console.log(
  JSON.stringify(
    parse(input)
  )
)

About

Go code for parsing HCL into JSON

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages