hashicorp / hashicorp/hcl

Is There a Way to Generate Anonymous Blocks with Variable References

Open
#696 1 comment 0 reactions 0 assignees View on GitHub
hclsyntax hclwrite waiting-reply
Dominant language
Go
Stars
5.8k
Forks
657
Avg merge
20h 36m
Merged PRs (30d)
6

Description

Hi, Is there any guide on generating something like the following in go?

```hcl
data = {
config.hcl = data.template_file.vault_config.rendered
}
```

### Attempt

```go
dataMap := map[string]cty.Value{
"config.hcl": cty.StringVal("data.template_file.vault_config.rendered"),
}
body.SetAttributeValue("data", cty.ObjectVal(dataMap))
```

However this generates the following (with quotes)

```hcl
data = {
"config.hcl" = "data.template_file.vault_config.rendered"
}
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.