hashicorp / hashicorp/hcl

encoder / hcl.Marshal() support?

Open
#200 0 comments 17 reactions 0 assignees View on GitHub
v1
Dominant language
Go
Stars
5.8k
Forks
657
Avg merge
20h 36m
Merged PRs (30d)
6

Description

This isn't a bug -- but rather a support/feature request for a Marshal method that will take a map of configuration data and output a hcl file. Something like;

```go
func Marshal(data map[string]interface{}) ([]byte, error) {
hcl = []byte
for k, v in data {
...
}
return hcl
}
```

I'm working on a transmorgifying configuration tool that allows reading of arbitrary configuration data (json, yaml, toml, xml, and shellvars) and uses it to either
* render a template
* output as a unified format (e.g. as json or yml or hcl ! :) )

supporting hcl would be great, although I can only include it as input data and not output if the library is not bi-directional. Does it make sense to add something like this?

Thanks!

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reviewing the encoder API and the proposed hcl.Marshal() entry point, then determine how configuration maps should be represented in HCL. Done means an agreed Marshal interface that produces valid HCL output for the requested configuration data, with behavior and compatibility clarified.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
tooling
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.