mirror of
https://github.com/opentofu/opentofu.git
synced 2025-02-25 18:45:20 -06:00
govendor fetch github.com/hashicorp/hcl2/...
This includes fixes to hcldec that should make our configschema.Block implementation behave better with Optional+Computed attributes.
This commit is contained in:
parent
8c1f0842b0
commit
fa11fb70f6
4
vendor/github.com/hashicorp/hcl2/ext/typeexpr/README.md
generated
vendored
4
vendor/github.com/hashicorp/hcl2/ext/typeexpr/README.md
generated
vendored
@ -55,8 +55,8 @@ in a type expression:
|
|||||||
For example:
|
For example:
|
||||||
|
|
||||||
* `list(string)`
|
* `list(string)`
|
||||||
* `object({"name":string,"age":number})`
|
* `object({name=string,age=number})`
|
||||||
* `map(object({"name":string,"age":number}))`
|
* `map(object({name=string,age=number}))`
|
||||||
|
|
||||||
Note that the object constructor syntax is not fully-general for all possible
|
Note that the object constructor syntax is not fully-general for all possible
|
||||||
object types because it requires the attribute names to be valid identifiers.
|
object types because it requires the attribute names to be valid identifiers.
|
||||||
|
5
vendor/github.com/hashicorp/hcl2/hcldec/public.go
generated
vendored
5
vendor/github.com/hashicorp/hcl2/hcldec/public.go
generated
vendored
@ -65,7 +65,10 @@ func ChildBlockTypes(spec Spec) map[string]Spec {
|
|||||||
visit = func(s Spec) {
|
visit = func(s Spec) {
|
||||||
if bs, ok := s.(blockSpec); ok {
|
if bs, ok := s.(blockSpec); ok {
|
||||||
for _, blockS := range bs.blockHeaderSchemata() {
|
for _, blockS := range bs.blockHeaderSchemata() {
|
||||||
ret[blockS.Type] = bs.nestedSpec()
|
nested := bs.nestedSpec()
|
||||||
|
if nested != nil { // nil can be returned to dynamically opt out of this interface
|
||||||
|
ret[blockS.Type] = nested
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
42
vendor/github.com/hashicorp/hcl2/hcldec/spec.go
generated
vendored
42
vendor/github.com/hashicorp/hcl2/hcldec/spec.go
generated
vendored
@ -848,6 +848,16 @@ func findLabelSpecs(spec Spec) []string {
|
|||||||
//
|
//
|
||||||
// The two specifications must have the same implied result type for correct
|
// The two specifications must have the same implied result type for correct
|
||||||
// operation. If not, the result is undefined.
|
// operation. If not, the result is undefined.
|
||||||
|
//
|
||||||
|
// Any requirements imposed by the "Default" spec apply even if "Primary" does
|
||||||
|
// not return null. For example, if the "Default" spec is for a required
|
||||||
|
// attribute then that attribute is always required, regardless of the result
|
||||||
|
// of the "Primary" spec.
|
||||||
|
//
|
||||||
|
// The "Default" spec must not describe a nested block, since otherwise the
|
||||||
|
// result of ChildBlockTypes would not be decidable without evaluation. If
|
||||||
|
// the default spec _does_ describe a nested block then the result is
|
||||||
|
// undefined.
|
||||||
type DefaultSpec struct {
|
type DefaultSpec struct {
|
||||||
Primary Spec
|
Primary Spec
|
||||||
Default Spec
|
Default Spec
|
||||||
@ -872,6 +882,38 @@ func (s *DefaultSpec) impliedType() cty.Type {
|
|||||||
return s.Primary.impliedType()
|
return s.Primary.impliedType()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// attrSpec implementation
|
||||||
|
func (s *DefaultSpec) attrSchemata() []hcl.AttributeSchema {
|
||||||
|
// We must pass through the union of both of our nested specs so that
|
||||||
|
// we'll have both values available in the result.
|
||||||
|
var ret []hcl.AttributeSchema
|
||||||
|
if as, ok := s.Primary.(attrSpec); ok {
|
||||||
|
ret = append(ret, as.attrSchemata()...)
|
||||||
|
}
|
||||||
|
if as, ok := s.Default.(attrSpec); ok {
|
||||||
|
ret = append(ret, as.attrSchemata()...)
|
||||||
|
}
|
||||||
|
return ret
|
||||||
|
}
|
||||||
|
|
||||||
|
// blockSpec implementation
|
||||||
|
func (s *DefaultSpec) blockHeaderSchemata() []hcl.BlockHeaderSchema {
|
||||||
|
// Only the primary spec may describe a block, since otherwise
|
||||||
|
// our nestedSpec method below can't know which to return.
|
||||||
|
if bs, ok := s.Primary.(blockSpec); ok {
|
||||||
|
return bs.blockHeaderSchemata()
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// blockSpec implementation
|
||||||
|
func (s *DefaultSpec) nestedSpec() Spec {
|
||||||
|
if bs, ok := s.Primary.(blockSpec); ok {
|
||||||
|
return bs.nestedSpec()
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
func (s *DefaultSpec) sourceRange(content *hcl.BodyContent, blockLabels []blockLabel) hcl.Range {
|
func (s *DefaultSpec) sourceRange(content *hcl.BodyContent, blockLabels []blockLabel) hcl.Range {
|
||||||
// We can't tell from here which of the two specs will ultimately be used
|
// We can't tell from here which of the two specs will ultimately be used
|
||||||
// in our result, so we'll just assume the first. This is usually the right
|
// in our result, so we'll just assume the first. This is usually the right
|
||||||
|
48
vendor/vendor.json
vendored
48
vendor/vendor.json
vendored
@ -1891,68 +1891,68 @@
|
|||||||
{
|
{
|
||||||
"checksumSHA1": "dJPromzLdd492RQjE/09klKRXGs=",
|
"checksumSHA1": "dJPromzLdd492RQjE/09klKRXGs=",
|
||||||
"path": "github.com/hashicorp/hcl2/ext/dynblock",
|
"path": "github.com/hashicorp/hcl2/ext/dynblock",
|
||||||
"revision": "5f8ed954abd873b2c09616ba0aa607892bbca7e9",
|
"revision": "bbbd0ef30d601e5ecf89e492d0842170f144db85",
|
||||||
"revisionTime": "2018-03-08T16:30:58Z"
|
"revisionTime": "2018-05-22T22:06:42Z"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"checksumSHA1": "Tpj2tK/XrhxbIKB5xEJlfTI46M0=",
|
"checksumSHA1": "IAfC0Xri1iCRgbbiDBgs6ue8/Ic=",
|
||||||
"path": "github.com/hashicorp/hcl2/ext/typeexpr",
|
"path": "github.com/hashicorp/hcl2/ext/typeexpr",
|
||||||
"revision": "5f8ed954abd873b2c09616ba0aa607892bbca7e9",
|
"revision": "bbbd0ef30d601e5ecf89e492d0842170f144db85",
|
||||||
"revisionTime": "2018-03-08T16:30:58Z"
|
"revisionTime": "2018-05-22T22:06:42Z"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"checksumSHA1": "BRJaQcKriVKEirVC7YxBxPufQF0=",
|
"checksumSHA1": "BRJaQcKriVKEirVC7YxBxPufQF0=",
|
||||||
"path": "github.com/hashicorp/hcl2/gohcl",
|
"path": "github.com/hashicorp/hcl2/gohcl",
|
||||||
"revision": "5f8ed954abd873b2c09616ba0aa607892bbca7e9",
|
"revision": "bbbd0ef30d601e5ecf89e492d0842170f144db85",
|
||||||
"revisionTime": "2018-03-08T16:30:58Z"
|
"revisionTime": "2018-05-22T22:06:42Z"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"checksumSHA1": "v1JCFNvhLqF3ErYcxkJJPboKO8c=",
|
"checksumSHA1": "v1JCFNvhLqF3ErYcxkJJPboKO8c=",
|
||||||
"path": "github.com/hashicorp/hcl2/hcl",
|
"path": "github.com/hashicorp/hcl2/hcl",
|
||||||
"revision": "5f8ed954abd873b2c09616ba0aa607892bbca7e9",
|
"revision": "bbbd0ef30d601e5ecf89e492d0842170f144db85",
|
||||||
"revisionTime": "2018-03-08T16:30:58Z"
|
"revisionTime": "2018-05-22T22:06:42Z"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"checksumSHA1": "ekhg+MJLLGkJQdh/tZ4A3EZwpNY=",
|
"checksumSHA1": "ekhg+MJLLGkJQdh/tZ4A3EZwpNY=",
|
||||||
"path": "github.com/hashicorp/hcl2/hcl/hclsyntax",
|
"path": "github.com/hashicorp/hcl2/hcl/hclsyntax",
|
||||||
"revision": "5f8ed954abd873b2c09616ba0aa607892bbca7e9",
|
"revision": "bbbd0ef30d601e5ecf89e492d0842170f144db85",
|
||||||
"revisionTime": "2018-03-08T16:30:58Z"
|
"revisionTime": "2018-05-22T22:06:42Z"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"checksumSHA1": "G40fCmu1bSWXv4Hw5JXwEUTVThk=",
|
"checksumSHA1": "G40fCmu1bSWXv4Hw5JXwEUTVThk=",
|
||||||
"path": "github.com/hashicorp/hcl2/hcl/json",
|
"path": "github.com/hashicorp/hcl2/hcl/json",
|
||||||
"revision": "5f8ed954abd873b2c09616ba0aa607892bbca7e9",
|
"revision": "bbbd0ef30d601e5ecf89e492d0842170f144db85",
|
||||||
"revisionTime": "2018-03-08T16:30:58Z"
|
"revisionTime": "2018-05-22T22:06:42Z"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"checksumSHA1": "672O/GQ9z+OFsG3eHLKq1yg3ZGM=",
|
"checksumSHA1": "c3Lb2st15sopmoLrjLQp+XyaZjE=",
|
||||||
"path": "github.com/hashicorp/hcl2/hcldec",
|
"path": "github.com/hashicorp/hcl2/hcldec",
|
||||||
"revision": "5f8ed954abd873b2c09616ba0aa607892bbca7e9",
|
"revision": "bbbd0ef30d601e5ecf89e492d0842170f144db85",
|
||||||
"revisionTime": "2018-03-08T16:30:58Z"
|
"revisionTime": "2018-05-22T22:06:42Z"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"checksumSHA1": "sySYF9Ew71VS/LfrG+s/0jK+1VQ=",
|
"checksumSHA1": "sySYF9Ew71VS/LfrG+s/0jK+1VQ=",
|
||||||
"path": "github.com/hashicorp/hcl2/hcled",
|
"path": "github.com/hashicorp/hcl2/hcled",
|
||||||
"revision": "5f8ed954abd873b2c09616ba0aa607892bbca7e9",
|
"revision": "bbbd0ef30d601e5ecf89e492d0842170f144db85",
|
||||||
"revisionTime": "2018-03-08T16:30:58Z"
|
"revisionTime": "2018-05-22T22:06:42Z"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"checksumSHA1": "IzmftuG99BqNhbFGhxZaGwtiMtM=",
|
"checksumSHA1": "IzmftuG99BqNhbFGhxZaGwtiMtM=",
|
||||||
"path": "github.com/hashicorp/hcl2/hclparse",
|
"path": "github.com/hashicorp/hcl2/hclparse",
|
||||||
"revision": "5f8ed954abd873b2c09616ba0aa607892bbca7e9",
|
"revision": "bbbd0ef30d601e5ecf89e492d0842170f144db85",
|
||||||
"revisionTime": "2018-03-08T16:30:58Z"
|
"revisionTime": "2018-05-22T22:06:42Z"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"checksumSHA1": "v5qx2XghQ+EtvFLa4a0Efjiwt9I=",
|
"checksumSHA1": "v5qx2XghQ+EtvFLa4a0Efjiwt9I=",
|
||||||
"path": "github.com/hashicorp/hcl2/hcltest",
|
"path": "github.com/hashicorp/hcl2/hcltest",
|
||||||
"revision": "5f8ed954abd873b2c09616ba0aa607892bbca7e9",
|
"revision": "bbbd0ef30d601e5ecf89e492d0842170f144db85",
|
||||||
"revisionTime": "2018-03-08T16:30:58Z"
|
"revisionTime": "2018-05-22T22:06:42Z"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"checksumSHA1": "9UCSLRG+TEAsNKOZJUaJj/7d6r8=",
|
"checksumSHA1": "9UCSLRG+TEAsNKOZJUaJj/7d6r8=",
|
||||||
"path": "github.com/hashicorp/hcl2/hclwrite",
|
"path": "github.com/hashicorp/hcl2/hclwrite",
|
||||||
"revision": "5f8ed954abd873b2c09616ba0aa607892bbca7e9",
|
"revision": "bbbd0ef30d601e5ecf89e492d0842170f144db85",
|
||||||
"revisionTime": "2018-03-08T16:30:58Z"
|
"revisionTime": "2018-05-22T22:06:42Z"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"checksumSHA1": "M09yxoBoCEtG7EcHR8aEWLzMMJc=",
|
"checksumSHA1": "M09yxoBoCEtG7EcHR8aEWLzMMJc=",
|
||||||
|
Loading…
Reference in New Issue
Block a user