From ca85fecd03417af322b6d68d208f809a5d100063 Mon Sep 17 00:00:00 2001 From: Daniel Banck Date: Fri, 14 Oct 2022 15:19:31 +0200 Subject: [PATCH] Add TF 1.3 timecmp as example --- internal/funcs/1.3/functions.go | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/internal/funcs/1.3/functions.go b/internal/funcs/1.3/functions.go index 62219998..1e6b9caa 100644 --- a/internal/funcs/1.3/functions.go +++ b/internal/funcs/1.3/functions.go @@ -3,6 +3,8 @@ package funcs import ( "github.com/hashicorp/go-version" "github.com/hashicorp/hcl-lang/schema" + "github.com/zclconf/go-cty/cty" + "github.com/zclconf/go-cty/cty/function" funcs_v0_15 "github.com/hashicorp/terraform-schema/internal/funcs/0.15" ) @@ -12,7 +14,22 @@ func Functions(v *version.Version) map[string]schema.FuncSignature { f["endswith"] = schema.FuncSignature{} // TODO! f["startswith"] = schema.FuncSignature{} // TODO! - f["timecmp"] = schema.FuncSignature{} // TODO! + f["timecmp"] = schema.FuncSignature{ + Description: "timecmp compares two timestamps and returns a number that represents the ordering of the instants those timestamps represent.", + Params: []function.Parameter{ + { + Name: "timestamp_a", + Description: "First timestamp for comparison.", + Type: cty.String, + }, + { + Name: "timestamp_b", + Description: "Second timestamp for comparison.", + Type: cty.String, + }, + }, + ReturnTypes: cty.Number, + } return f }