vendor: upgrade github.com/hashicorp/hcl2
This includes a fix to the dynamic block extension so that nested dynamic blocks can iterate over the temporary variables created by their ancestors.
This commit is contained in:
parent
17873ae61b
commit
a3f6e67b7d
2
go.mod
2
go.mod
|
@ -72,7 +72,7 @@ require (
|
||||||
github.com/hashicorp/go-version v1.0.0
|
github.com/hashicorp/go-version v1.0.0
|
||||||
github.com/hashicorp/golang-lru v0.5.0 // indirect
|
github.com/hashicorp/golang-lru v0.5.0 // indirect
|
||||||
github.com/hashicorp/hcl v0.0.0-20170504190234-a4b07c25de5f
|
github.com/hashicorp/hcl v0.0.0-20170504190234-a4b07c25de5f
|
||||||
github.com/hashicorp/hcl2 v0.0.0-20181219235215-291f7fbe431d
|
github.com/hashicorp/hcl2 v0.0.0-20181220012050-6631d7cd0a68
|
||||||
github.com/hashicorp/hil v0.0.0-20170627220502-fa9f258a9250
|
github.com/hashicorp/hil v0.0.0-20170627220502-fa9f258a9250
|
||||||
github.com/hashicorp/logutils v0.0.0-20150609070431-0dc08b1671f3
|
github.com/hashicorp/logutils v0.0.0-20150609070431-0dc08b1671f3
|
||||||
github.com/hashicorp/memberlist v0.1.0 // indirect
|
github.com/hashicorp/memberlist v0.1.0 // indirect
|
||||||
|
|
2
go.sum
2
go.sum
|
@ -171,6 +171,8 @@ github.com/hashicorp/hcl2 v0.0.0-20181219223929-62acf2ce821d h1:sd9/19rMHTRn7UTY
|
||||||
github.com/hashicorp/hcl2 v0.0.0-20181219223929-62acf2ce821d/go.mod h1:ShfpTh661oAaxo7VcNxg0zcZW6jvMa7Moy2oFx7e5dE=
|
github.com/hashicorp/hcl2 v0.0.0-20181219223929-62acf2ce821d/go.mod h1:ShfpTh661oAaxo7VcNxg0zcZW6jvMa7Moy2oFx7e5dE=
|
||||||
github.com/hashicorp/hcl2 v0.0.0-20181219235215-291f7fbe431d h1:/htY6cNUFEn929uHLoI/5rYUHcaKLXZpbE6zEOymf78=
|
github.com/hashicorp/hcl2 v0.0.0-20181219235215-291f7fbe431d h1:/htY6cNUFEn929uHLoI/5rYUHcaKLXZpbE6zEOymf78=
|
||||||
github.com/hashicorp/hcl2 v0.0.0-20181219235215-291f7fbe431d/go.mod h1:ShfpTh661oAaxo7VcNxg0zcZW6jvMa7Moy2oFx7e5dE=
|
github.com/hashicorp/hcl2 v0.0.0-20181219235215-291f7fbe431d/go.mod h1:ShfpTh661oAaxo7VcNxg0zcZW6jvMa7Moy2oFx7e5dE=
|
||||||
|
github.com/hashicorp/hcl2 v0.0.0-20181220012050-6631d7cd0a68 h1:d2VhAXrdo8KXWFsn8lNHp5IL0OUXmXMIIlcZBmZa1iU=
|
||||||
|
github.com/hashicorp/hcl2 v0.0.0-20181220012050-6631d7cd0a68/go.mod h1:ShfpTh661oAaxo7VcNxg0zcZW6jvMa7Moy2oFx7e5dE=
|
||||||
github.com/hashicorp/hil v0.0.0-20170627220502-fa9f258a9250 h1:fooK5IvDL/KIsi4LxF/JH68nVdrBSiGNPhS2JAQjtjo=
|
github.com/hashicorp/hil v0.0.0-20170627220502-fa9f258a9250 h1:fooK5IvDL/KIsi4LxF/JH68nVdrBSiGNPhS2JAQjtjo=
|
||||||
github.com/hashicorp/hil v0.0.0-20170627220502-fa9f258a9250/go.mod h1:KHvg/R2/dPtaePb16oW4qIyzkMxXOL38xjRN64adsts=
|
github.com/hashicorp/hil v0.0.0-20170627220502-fa9f258a9250/go.mod h1:KHvg/R2/dPtaePb16oW4qIyzkMxXOL38xjRN64adsts=
|
||||||
github.com/hashicorp/logutils v0.0.0-20150609070431-0dc08b1671f3 h1:oD64EFjELI9RY9yoWlfua58r+etdnoIC871z+rr6lkA=
|
github.com/hashicorp/logutils v0.0.0-20150609070431-0dc08b1671f3 h1:oD64EFjELI9RY9yoWlfua58r+etdnoIC871z+rr6lkA=
|
||||||
|
|
|
@ -234,7 +234,8 @@ func (b *expandBody) expandBlocks(schema *hcl.BodySchema, rawBlocks hcl.Blocks,
|
||||||
}
|
}
|
||||||
|
|
||||||
func (b *expandBody) expandChild(child hcl.Body, i *iteration) hcl.Body {
|
func (b *expandBody) expandChild(child hcl.Body, i *iteration) hcl.Body {
|
||||||
ret := Expand(child, b.forEachCtx)
|
chiCtx := i.EvalContext(b.forEachCtx)
|
||||||
|
ret := Expand(child, chiCtx)
|
||||||
ret.(*expandBody).iteration = i
|
ret.(*expandBody).iteration = i
|
||||||
return ret
|
return ret
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,11 +41,14 @@ func (b *expandBody) decodeSpec(blockS *hcl.BlockHeaderSchema, rawSpec *hcl.Bloc
|
||||||
eachVal, eachDiags := eachAttr.Expr.Value(b.forEachCtx)
|
eachVal, eachDiags := eachAttr.Expr.Value(b.forEachCtx)
|
||||||
diags = append(diags, eachDiags...)
|
diags = append(diags, eachDiags...)
|
||||||
|
|
||||||
if !eachVal.CanIterateElements() {
|
if !eachVal.CanIterateElements() && eachVal.Type() != cty.DynamicPseudoType {
|
||||||
|
// We skip this error for DynamicPseudoType because that means we either
|
||||||
|
// have a null (which is checked immediately below) or an unknown
|
||||||
|
// (which is handled in the expandBody Content methods).
|
||||||
diags = append(diags, &hcl.Diagnostic{
|
diags = append(diags, &hcl.Diagnostic{
|
||||||
Severity: hcl.DiagError,
|
Severity: hcl.DiagError,
|
||||||
Summary: "Invalid dynamic for_each value",
|
Summary: "Invalid dynamic for_each value",
|
||||||
Detail: fmt.Sprintf("Cannot use a value of type %s in for_each. An iterable collection is required.", eachVal.Type()),
|
Detail: fmt.Sprintf("Cannot use a %s value in for_each. An iterable collection is required.", eachVal.Type().FriendlyName()),
|
||||||
Subject: eachAttr.Expr.Range().Ptr(),
|
Subject: eachAttr.Expr.Range().Ptr(),
|
||||||
Expression: eachAttr.Expr,
|
Expression: eachAttr.Expr,
|
||||||
EvalContext: b.forEachCtx,
|
EvalContext: b.forEachCtx,
|
||||||
|
|
|
@ -30,12 +30,14 @@ func (i *iteration) Object() cty.Value {
|
||||||
|
|
||||||
func (i *iteration) EvalContext(base *hcl.EvalContext) *hcl.EvalContext {
|
func (i *iteration) EvalContext(base *hcl.EvalContext) *hcl.EvalContext {
|
||||||
new := base.NewChild()
|
new := base.NewChild()
|
||||||
new.Variables = map[string]cty.Value{}
|
|
||||||
|
|
||||||
|
if i != nil {
|
||||||
|
new.Variables = map[string]cty.Value{}
|
||||||
for name, otherIt := range i.Inherited {
|
for name, otherIt := range i.Inherited {
|
||||||
new.Variables[name] = otherIt.Object()
|
new.Variables[name] = otherIt.Object()
|
||||||
}
|
}
|
||||||
new.Variables[i.IteratorName] = i.Object()
|
new.Variables[i.IteratorName] = i.Object()
|
||||||
|
}
|
||||||
|
|
||||||
return new
|
return new
|
||||||
}
|
}
|
||||||
|
|
|
@ -351,7 +351,7 @@ github.com/hashicorp/hcl/hcl/scanner
|
||||||
github.com/hashicorp/hcl/hcl/strconv
|
github.com/hashicorp/hcl/hcl/strconv
|
||||||
github.com/hashicorp/hcl/json/scanner
|
github.com/hashicorp/hcl/json/scanner
|
||||||
github.com/hashicorp/hcl/json/token
|
github.com/hashicorp/hcl/json/token
|
||||||
# github.com/hashicorp/hcl2 v0.0.0-20181219235215-291f7fbe431d
|
# github.com/hashicorp/hcl2 v0.0.0-20181220012050-6631d7cd0a68
|
||||||
github.com/hashicorp/hcl2/hcl
|
github.com/hashicorp/hcl2/hcl
|
||||||
github.com/hashicorp/hcl2/hcl/hclsyntax
|
github.com/hashicorp/hcl2/hcl/hclsyntax
|
||||||
github.com/hashicorp/hcl2/hcldec
|
github.com/hashicorp/hcl2/hcldec
|
||||||
|
|
Loading…
Reference in New Issue