2019-10-14 11:02:53 -04:00
|
|
|
package hcl2template
|
|
|
|
|
|
|
|
import (
|
|
|
|
"github.com/hashicorp/hcl/v2"
|
|
|
|
)
|
|
|
|
|
Hcl2 input variables, local variables and functions (#8588)
Mainly redefine or reused what Terraform did.
* allow to used `variables`, `variable` and `local` blocks
* import the following functions and their docs from Terraform: abs, abspath, basename, base64decode, base64encode, bcrypt, can, ceil, chomp, chunklist, cidrhost, cidrnetmask, cidrsubnet, cidrsubnets, coalesce, coalescelist, compact, concat, contains, convert, csvdecode, dirname, distinct, element, file, fileexists, fileset, flatten, floor, format, formatdate, formatlist, indent, index, join, jsondecode, jsonencode, keys, length, log, lookup, lower, max, md5, merge, min, parseint, pathexpand, pow, range, reverse, rsadecrypt, setintersection, setproduct, setunion, sha1, sha256, sha512, signum, slice, sort, split, strrev, substr, timestamp, timeadd, title, trim, trimprefix, trimspace, trimsuffix, try, upper, urlencode, uuidv4, uuidv5, values, yamldecode, yamlencode, zipmap.
2020-02-06 05:49:21 -05:00
|
|
|
// HCL2Ref references to the source definition in configuration text file. It
|
|
|
|
// is used to tell were something was wrong, - like a warning or an error -
|
|
|
|
// long after it was parsed; allowing to give pointers as to where change/fix
|
|
|
|
// things in a file.
|
2019-10-14 11:02:53 -04:00
|
|
|
type HCL2Ref struct {
|
Hcl2 input variables, local variables and functions (#8588)
Mainly redefine or reused what Terraform did.
* allow to used `variables`, `variable` and `local` blocks
* import the following functions and their docs from Terraform: abs, abspath, basename, base64decode, base64encode, bcrypt, can, ceil, chomp, chunklist, cidrhost, cidrnetmask, cidrsubnet, cidrsubnets, coalesce, coalescelist, compact, concat, contains, convert, csvdecode, dirname, distinct, element, file, fileexists, fileset, flatten, floor, format, formatdate, formatlist, indent, index, join, jsondecode, jsonencode, keys, length, log, lookup, lower, max, md5, merge, min, parseint, pathexpand, pow, range, reverse, rsadecrypt, setintersection, setproduct, setunion, sha1, sha256, sha512, signum, slice, sort, split, strrev, substr, timestamp, timeadd, title, trim, trimprefix, trimspace, trimsuffix, try, upper, urlencode, uuidv4, uuidv5, values, yamldecode, yamlencode, zipmap.
2020-02-06 05:49:21 -05:00
|
|
|
// references
|
2020-01-16 06:08:39 -05:00
|
|
|
DefRange hcl.Range
|
|
|
|
TypeRange hcl.Range
|
|
|
|
LabelsRanges []hcl.Range
|
2019-10-14 11:02:53 -04:00
|
|
|
|
|
|
|
// remainder of unparsed body
|
2020-01-16 06:08:39 -05:00
|
|
|
Rest hcl.Body
|
|
|
|
}
|
|
|
|
|
|
|
|
func newHCL2Ref(block *hcl.Block, rest hcl.Body) HCL2Ref {
|
|
|
|
return HCL2Ref{
|
|
|
|
Rest: rest,
|
|
|
|
DefRange: block.DefRange,
|
|
|
|
TypeRange: block.TypeRange,
|
|
|
|
LabelsRanges: block.LabelRanges,
|
|
|
|
}
|
2019-10-14 11:02:53 -04:00
|
|
|
}
|