vendor: update github.com/hashicorp/hcl/v2 to v2.19.1

Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
This commit is contained in:
CrazyMax
2023-10-19 14:49:10 +02:00
parent ad674e2666
commit 34b9a629a0
157 changed files with 20123 additions and 5438 deletions

View File

@ -9,6 +9,7 @@ import (
)
var EqualFunc = function.New(&function.Spec{
Description: `Returns true if the two given values are equal, or false otherwise.`,
Params: []function.Parameter{
{
Name: "a",
@ -25,13 +26,15 @@ var EqualFunc = function.New(&function.Spec{
AllowNull: true,
},
},
Type: function.StaticReturnType(cty.Bool),
Type: function.StaticReturnType(cty.Bool),
RefineResult: refineNonNull,
Impl: func(args []cty.Value, retType cty.Type) (ret cty.Value, err error) {
return args[0].Equals(args[1]), nil
},
})
var NotEqualFunc = function.New(&function.Spec{
Description: `Returns false if the two given values are equal, or true otherwise.`,
Params: []function.Parameter{
{
Name: "a",
@ -48,14 +51,16 @@ var NotEqualFunc = function.New(&function.Spec{
AllowNull: true,
},
},
Type: function.StaticReturnType(cty.Bool),
Type: function.StaticReturnType(cty.Bool),
RefineResult: refineNonNull,
Impl: func(args []cty.Value, retType cty.Type) (ret cty.Value, err error) {
return args[0].Equals(args[1]).Not(), nil
},
})
var CoalesceFunc = function.New(&function.Spec{
Params: []function.Parameter{},
Description: `Returns the first of the given arguments that isn't null, or raises an error if there are no non-null arguments.`,
Params: []function.Parameter{},
VarParam: &function.Parameter{
Name: "vals",
Type: cty.DynamicPseudoType,
@ -74,6 +79,7 @@ var CoalesceFunc = function.New(&function.Spec{
}
return retType, nil
},
RefineResult: refineNonNull,
Impl: func(args []cty.Value, retType cty.Type) (ret cty.Value, err error) {
for _, argVal := range args {
if !argVal.IsKnown() {
@ -89,6 +95,10 @@ var CoalesceFunc = function.New(&function.Spec{
},
})
func refineNonNull(b *cty.RefinementBuilder) *cty.RefinementBuilder {
return b.NotNull()
}
// Equal determines whether the two given values are equal, returning a
// bool value.
func Equal(a cty.Value, b cty.Value) (cty.Value, error) {