Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exposing the result as yaml #3

Open
baloo opened this issue Dec 3, 2021 · 3 comments
Open

Exposing the result as yaml #3

baloo opened this issue Dec 3, 2021 · 3 comments

Comments

@baloo
Copy link
Collaborator

baloo commented Dec 3, 2021

It could be worth exposing the result of the evaluation as YAML:

# resources.tf
resource "aws_iam_policy" "assets-access" {
  name  = "assets-access"
  description = "A policy allowing access to assets."

  policy = data.dhall.foo.yaml
}

Exporting a new value here should suffice

outJSON, err := json.Marshal(data)
if err != nil {
return err
}
err = d.Set("result", string(outJSON))

@isaacsanders
Copy link

couldn't one just take the JSON and re-encode it as YAML?

@baloo
Copy link
Collaborator Author

baloo commented Jul 29, 2022

You mean using a helper in terraform? (jsondecode and yamlencode)
I thought it could have been a bit more useful/less verbose to do that in the go plugin. But otherwise yes, decode json then reencode it in yaml in golang.

@isaacsanders
Copy link

Yeah, the terraform helper. I would think it would be nice to keep the dhall part of the tooling as simple as possible.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants