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

display raw value from output #22

Open
checkmypi opened this issue Jul 11, 2019 · 0 comments
Open

display raw value from output #22

checkmypi opened this issue Jul 11, 2019 · 0 comments

Comments

@checkmypi
Copy link

checkmypi commented Jul 11, 2019

Hi there,
I'm trying to add printout of the raw value from the output.
So from this

output "val_a" {
  value = "${var.a}"
}

I'd like to get output like this

  "outputs": {
    "val_a": {
      "name": "val_a",
      "raw_value": "${var.a}",
      "pos": {
        "filename": "test.tf",
        "line": 5
      }
    }
  }

The trouble I have is that I don't know how to force attr.Expr to return raw value, it seems to try to evaluate the attribute when I access it.
Any tips would be appreciated.

Thank you

DUMP


(*hcl.Block)(0xc00015e5b0)({
 Type: (string) (len=6) "output",
 Labels: ([]string) (len=1 cap=1) {
  (string) (len=5) "val_a"
 },
 Body: (*hclsyntax.Body)(0xc0001840b0)({
  Attributes: (hclsyntax.Attributes) (len=1) {
   (string) (len=5) "value": (*hclsyntax.Attribute)(0xc0001820e0)({
    Name: (string) (len=5) "value",
    Expr: (*hclsyntax.TemplateWrapExpr)(0xc00015a190)({
     Wrapped: (*hclsyntax.ScopeTraversalExpr)(0xc00014d800)({
      Traversal: (hcl.Traversal) (len=2 cap=2) {
       (hcl.TraverseRoot) {
        isTraverser: (hcl.isTraverser) {
        },
        Name: (string) (len=3) "var",
        SrcRange: (hcl.Range) test.tf:6,14-17
       },
       (hcl.TraverseAttr) {
        isTraverser: (hcl.isTraverser) {
        },
        Name: (string) (len=1) "a",
        SrcRange: (hcl.Range) test.tf:6,17-19
       }
      },
      SrcRange: (hcl.Range) test.tf:6,14-19
     }),
     SrcRange: (hcl.Range) test.tf:6,11-21
    }),
    SrcRange: (hcl.Range) test.tf:6,3-21,
    NameRange: (hcl.Range) test.tf:6,3-8,
    EqualsRange: (hcl.Range) test.tf:6,9-10
   })
  },

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

1 participant