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

Option for multiline strings #13

Closed
rienafairefr opened this issue Mar 11, 2021 · 1 comment · Fixed by #14
Closed

Option for multiline strings #13

rienafairefr opened this issue Mar 11, 2021 · 1 comment · Fixed by #14
Labels
enhancement New feature or request

Comments

@rienafairefr
Copy link

Not really a bug, more like a feature request

Some manifests contain multiline strings, like json/yaml embedded files in a configmap or whatever. When outputting from the cluster -o yaml, the multiline values are (usually, this might depend on their creator) using multiline yaml value, an example in a pgo-config configmap:

  pgo-pg-sa.json: |-
    {
       "apiVersion":"v1",
       "kind":"ServiceAccount",
       "metadata":{
          "name":"pgo-pg",
          "namespace":"{{.TargetNamespace}}",
          "labels":{
             "vendor":"crunchydata"
          }
       }
    }

Importing that yaml into terraform through tfk8s,the manifests seem okay but all the multiline values are "...\n...\n...\n"
This is working fine AFAICS, but for editabitility of the generated .tf, that'd be nice to use the multiline facilities in hcl, like the heredocs:

"pgo-pg-sa.json"= <<JSON
    {
       "apiVersion":"v1",
       "kind":"ServiceAccount",
       "metadata":{
          "name":"pgo-pg",
          "namespace":"{{.TargetNamespace}}",
          "labels":{
             "vendor":"crunchydata"
          }
       }
    }
JSON
@jrhouston jrhouston added the enhancement New feature or request label Mar 17, 2021
@jrhouston
Copy link
Owner

Thanks for opening this @rienafairefr – we are using Terraform's repl package to do the formatting to HCL and it looks they recently added support for this so we should be able to bring this in.

I had a quick look and there's some additional munging we will have to do because the interface has changed to use cty.Value rather than map[string]interface{}.

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

Successfully merging a pull request may close this issue.

2 participants