Sample scripts to parse HashiCorp Configuration Language (HCL).
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.
.gitignore
Gopkg.lock
Gopkg.toml
LICENSE
README.md
main.go
variables.tfvars

README.md

hcl_parse_sample

Sample scripts to parse and generate HashiCorp Configuration Language (HCL).

$ go get -u github.com/golang/dep/cmd/dep
$ dep ensure
$ go run main.go
2017/09/08 11:11:39 --- Parsing HCL ---
foo = "bar"
xyz = "abc"

somelist = [
  "one",
  "two",
]

somemap = {
  foo = "bar"
  baz = "qux"
}
2017/09/08 11:11:39 --- Operate the elements ---
2017/09/08 11:11:39 foo: bar
2017/09/08 11:11:39 xyz: abc
2017/09/08 11:11:39 somelist: [one two]
2017/09/08 11:11:39 somemap: map[foo:bar baz:qux]
2017/09/08 11:11:39 variables.Foo = "baz"
2017/09/08 11:11:39 variables.Xyz = "def"
2017/09/08 11:11:39 variables.Somelist = append(variables.Somelist, "three")
2017/09/08 11:11:39 variables.Somemap["quux"] = "corge"
2017/09/08 11:11:39 --- Generate HCL ---
"foo" = "baz"

"xyz" = "def"

"somelist" = ["one", "two", "three"]

"somemap" = {
  "baz" = "qux"

  "foo" = "bar"

  "quux" = "corge"
}