packer-cn/hcl2template/types.hcl_ref.go
Adrien Delorme 193dad46e6
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 11:49:21 +01:00

29 lines
682 B
Go

package hcl2template
import (
"github.com/hashicorp/hcl/v2"
)
// 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.
type HCL2Ref struct {
// references
DefRange hcl.Range
TypeRange hcl.Range
LabelsRanges []hcl.Range
// remainder of unparsed body
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,
}
}