From e5120d0d376225ce13028dd9e56e2be13c9151cb Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 16 Nov 2022 00:32:18 +0000 Subject: [PATCH 1/2] Bump github.com/hashicorp/terraform-plugin-framework Bumps [github.com/hashicorp/terraform-plugin-framework](https://github.com/hashicorp/terraform-plugin-framework) from 0.15.0 to 0.16.0. - [Release notes](https://github.com/hashicorp/terraform-plugin-framework/releases) - [Changelog](https://github.com/hashicorp/terraform-plugin-framework/blob/main/CHANGELOG.md) - [Commits](https://github.com/hashicorp/terraform-plugin-framework/compare/v0.15.0...v0.16.0) --- updated-dependencies: - dependency-name: github.com/hashicorp/terraform-plugin-framework dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- go.mod | 4 ++-- go.sum | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/go.mod b/go.mod index b3938b6..48d19cc 100644 --- a/go.mod +++ b/go.mod @@ -4,14 +4,14 @@ go 1.18 require ( github.com/google/go-cmp v0.5.9 - github.com/hashicorp/terraform-plugin-framework v0.15.0 + github.com/hashicorp/terraform-plugin-framework v0.16.0 ) require ( github.com/fatih/color v1.13.0 // indirect github.com/golang/protobuf v1.5.2 // indirect github.com/hashicorp/go-hclog v1.2.1 // indirect - github.com/hashicorp/terraform-plugin-go v0.14.0 // indirect + github.com/hashicorp/terraform-plugin-go v0.14.1 // indirect github.com/hashicorp/terraform-plugin-log v0.7.0 // indirect github.com/mattn/go-colorable v0.1.12 // indirect github.com/mattn/go-isatty v0.0.14 // indirect diff --git a/go.sum b/go.sum index dcb73c7..b7719da 100644 --- a/go.sum +++ b/go.sum @@ -13,10 +13,10 @@ github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/hashicorp/go-hclog v1.2.1 h1:YQsLlGDJgwhXFpucSPyVbCBviQtjlHv3jLTlp8YmtEw= github.com/hashicorp/go-hclog v1.2.1/go.mod h1:W4Qnvbt70Wk/zYJryRzDRU/4r0kIg0PVHBcfoyhpF5M= -github.com/hashicorp/terraform-plugin-framework v0.15.0 h1:6f4UY2yfp5UsSX9JhUA6RSptjd+ojStBGWA4jrPhB6Q= -github.com/hashicorp/terraform-plugin-framework v0.15.0/go.mod h1:wcZdk4+Uef6Ng+BiBJjGAcIPlIs5bhlEV/TA1k6Xkq8= -github.com/hashicorp/terraform-plugin-go v0.14.0 h1:ttnSlS8bz3ZPYbMb84DpcPhY4F5DsQtcAS7cHo8uvP4= -github.com/hashicorp/terraform-plugin-go v0.14.0/go.mod h1:2nNCBeRLaenyQEi78xrGrs9hMbulveqG/zDMQSvVJTE= +github.com/hashicorp/terraform-plugin-framework v0.16.0 h1:kEHh0d6dp5Ig/ey6PYXkWDZPMLIW8Me41T/Oa7bpO4s= +github.com/hashicorp/terraform-plugin-framework v0.16.0/go.mod h1:Vk5MuIJoE1qksHZawAZr6psx6YXsQBFIKDrWbROrwus= +github.com/hashicorp/terraform-plugin-go v0.14.1 h1:cwZzPYla82XwAqpLhSzdVsOMU+6H29tczAwrB0z9Zek= +github.com/hashicorp/terraform-plugin-go v0.14.1/go.mod h1:Bc/K6K26BQ2FHqIELPbpKtt2CzzbQou+0UQF3/0NsCQ= github.com/hashicorp/terraform-plugin-log v0.7.0 h1:SDxJUyT8TwN4l5b5/VkiTIaQgY6R+Y2BQ0sRZftGKQs= github.com/hashicorp/terraform-plugin-log v0.7.0/go.mod h1:p4R1jWBXRTvL4odmEkFfDdhUjHf9zcs/BCoNHAc7IK4= github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI= From 474222c70f64463ccec8645022f26e6e4a41c0d0 Mon Sep 17 00:00:00 2001 From: Benjamin Bennett Date: Wed, 16 Nov 2022 10:37:50 +0000 Subject: [PATCH 2/2] Replacing unknown fields --- internal/validators/timeduration_test.go | 8 +- timeouts/parser_test.go | 264 +++++++++++------------ 2 files changed, 124 insertions(+), 148 deletions(-) diff --git a/internal/validators/timeduration_test.go b/internal/validators/timeduration_test.go index b051609..cb43566 100644 --- a/internal/validators/timeduration_test.go +++ b/internal/validators/timeduration_test.go @@ -23,16 +23,16 @@ func TestTimeDuration(t *testing.T) { tests := map[string]testCase{ "unknown": { - val: types.String{Unknown: true}, + val: types.StringUnknown(), }, "null": { - val: types.String{Null: true}, + val: types.StringNull(), }, "valid": { - val: types.String{Value: "20m"}, + val: types.StringValue("20m"), }, "invalid": { - val: types.String{Value: "20x"}, + val: types.StringValue("20x"), expectedDiagnostics: diag.Diagnostics{ diag.NewAttributeErrorDiagnostic( path.Root("test"), diff --git a/timeouts/parser_test.go b/timeouts/parser_test.go index b19c932..b3364ea 100644 --- a/timeouts/parser_test.go +++ b/timeouts/parser_test.go @@ -28,64 +28,58 @@ func TestCreate(t *testing.T) { expected: def, }, "create-is-null": { - obj: types.Object{ - Attrs: map[string]attr.Value{ - "create": types.String{Null: true}, - }, - AttrTypes: map[string]attr.Type{ + obj: types.ObjectValueMust( + map[string]attr.Type{ "create": types.StringType, }, - }, + map[string]attr.Value{ + "create": types.StringNull(), + }, + ), expected: def, }, "create-not-string": { - obj: types.Object{ - Attrs: map[string]attr.Value{ - "create": types.Bool{}, - }, - AttrTypes: map[string]attr.Type{ + obj: types.ObjectValueMust( + map[string]attr.Type{ "create": types.BoolType, }, - }, + map[string]attr.Value{ + "create": types.Bool{}, + }, + ), expected: def, }, "create-not-parseable-empty": { - obj: types.Object{ - Attrs: map[string]attr.Value{ - "create": types.String{ - Value: "", - }, - }, - AttrTypes: map[string]attr.Type{ + obj: types.ObjectValueMust( + map[string]attr.Type{ "create": types.StringType, }, - }, + map[string]attr.Value{ + "create": types.StringValue(""), + }, + ), expected: def, }, "create-not-parseable": { - obj: types.Object{ - Attrs: map[string]attr.Value{ - "create": types.String{ - Value: "60x", - }, - }, - AttrTypes: map[string]attr.Type{ + obj: types.ObjectValueMust( + map[string]attr.Type{ "create": types.StringType, }, - }, + map[string]attr.Value{ + "create": types.StringValue("60x"), + }, + ), expected: def, }, "create-valid": { - obj: types.Object{ - Attrs: map[string]attr.Value{ - "create": types.String{ - Value: "60m", - }, - }, - AttrTypes: map[string]attr.Type{ + obj: types.ObjectValueMust( + map[string]attr.Type{ "create": types.StringType, }, - }, + map[string]attr.Value{ + "create": types.StringValue("60m"), + }, + ), expected: 60 * time.Minute, }, } @@ -118,64 +112,58 @@ func TestRead(t *testing.T) { expected: def, }, "read-is-null": { - obj: types.Object{ - Attrs: map[string]attr.Value{ - "read": types.String{Null: true}, - }, - AttrTypes: map[string]attr.Type{ + obj: types.ObjectValueMust( + map[string]attr.Type{ "read": types.StringType, }, - }, + map[string]attr.Value{ + "read": types.StringNull(), + }, + ), expected: def, }, "read-not-string": { - obj: types.Object{ - Attrs: map[string]attr.Value{ - "read": types.Bool{}, - }, - AttrTypes: map[string]attr.Type{ + obj: types.ObjectValueMust( + map[string]attr.Type{ "read": types.BoolType, }, - }, + map[string]attr.Value{ + "read": types.BoolValue(true), + }, + ), expected: def, }, "read-not-parseable-empty": { - obj: types.Object{ - Attrs: map[string]attr.Value{ - "read": types.String{ - Value: "", - }, - }, - AttrTypes: map[string]attr.Type{ + obj: types.ObjectValueMust( + map[string]attr.Type{ "read": types.StringType, }, - }, + map[string]attr.Value{ + "read": types.StringValue(""), + }, + ), expected: def, }, "read-not-parseable": { - obj: types.Object{ - Attrs: map[string]attr.Value{ - "read": types.String{ - Value: "60x", - }, - }, - AttrTypes: map[string]attr.Type{ + obj: types.ObjectValueMust( + map[string]attr.Type{ "read": types.StringType, }, - }, + map[string]attr.Value{ + "read": types.StringValue("60x"), + }, + ), expected: def, }, "read-valid": { - obj: types.Object{ - Attrs: map[string]attr.Value{ - "read": types.String{ - Value: "60m", - }, - }, - AttrTypes: map[string]attr.Type{ + obj: types.ObjectValueMust( + map[string]attr.Type{ "read": types.StringType, }, - }, + map[string]attr.Value{ + "read": types.StringValue("60m"), + }, + ), expected: 60 * time.Minute, }, } @@ -208,64 +196,58 @@ func TestUpdate(t *testing.T) { expected: def, }, "update-is-null": { - obj: types.Object{ - Attrs: map[string]attr.Value{ - "update": types.String{Null: true}, - }, - AttrTypes: map[string]attr.Type{ + obj: types.ObjectValueMust( + map[string]attr.Type{ "update": types.StringType, }, - }, + map[string]attr.Value{ + "update": types.StringNull(), + }, + ), expected: def, }, "update-not-string": { - obj: types.Object{ - Attrs: map[string]attr.Value{ - "update": types.Bool{}, - }, - AttrTypes: map[string]attr.Type{ + obj: types.ObjectValueMust( + map[string]attr.Type{ "update": types.BoolType, }, - }, + map[string]attr.Value{ + "update": types.BoolValue(true), + }, + ), expected: def, }, "update-not-parseable-empty": { - obj: types.Object{ - Attrs: map[string]attr.Value{ - "update": types.String{ - Value: "", - }, - }, - AttrTypes: map[string]attr.Type{ + obj: types.ObjectValueMust( + map[string]attr.Type{ "update": types.StringType, }, - }, + map[string]attr.Value{ + "update": types.StringValue(""), + }, + ), expected: def, }, "update-not-parseable": { - obj: types.Object{ - Attrs: map[string]attr.Value{ - "update": types.String{ - Value: "60x", - }, - }, - AttrTypes: map[string]attr.Type{ + obj: types.ObjectValueMust( + map[string]attr.Type{ "update": types.StringType, }, - }, + map[string]attr.Value{ + "update": types.StringValue("60x"), + }, + ), expected: def, }, "update-valid": { - obj: types.Object{ - Attrs: map[string]attr.Value{ - "update": types.String{ - Value: "60m", - }, - }, - AttrTypes: map[string]attr.Type{ + obj: types.ObjectValueMust( + map[string]attr.Type{ "update": types.StringType, }, - }, + map[string]attr.Value{ + "update": types.StringValue("60m"), + }, + ), expected: 60 * time.Minute, }, } @@ -298,64 +280,58 @@ func TestDelete(t *testing.T) { expected: def, }, "delete-is-null": { - obj: types.Object{ - Attrs: map[string]attr.Value{ - "delete": types.String{Null: true}, - }, - AttrTypes: map[string]attr.Type{ + obj: types.ObjectValueMust( + map[string]attr.Type{ "delete": types.StringType, }, - }, + map[string]attr.Value{ + "delete": types.StringNull(), + }, + ), expected: def, }, "delete-not-string": { - obj: types.Object{ - Attrs: map[string]attr.Value{ - "delete": types.Bool{}, - }, - AttrTypes: map[string]attr.Type{ + obj: types.ObjectValueMust( + map[string]attr.Type{ "delete": types.BoolType, }, - }, + map[string]attr.Value{ + "delete": types.BoolValue(true), + }, + ), expected: def, }, "delete-not-parseable-empty": { - obj: types.Object{ - Attrs: map[string]attr.Value{ - "delete": types.String{ - Value: "", - }, - }, - AttrTypes: map[string]attr.Type{ + obj: types.ObjectValueMust( + map[string]attr.Type{ "delete": types.StringType, }, - }, + map[string]attr.Value{ + "delete": types.StringValue(""), + }, + ), expected: def, }, "delete-not-parseable": { - obj: types.Object{ - Attrs: map[string]attr.Value{ - "delete": types.String{ - Value: "60x", - }, - }, - AttrTypes: map[string]attr.Type{ + obj: types.ObjectValueMust( + map[string]attr.Type{ "delete": types.StringType, }, - }, + map[string]attr.Value{ + "delete": types.StringValue("60x"), + }, + ), expected: def, }, "delete-valid": { - obj: types.Object{ - Attrs: map[string]attr.Value{ - "delete": types.String{ - Value: "60m", - }, - }, - AttrTypes: map[string]attr.Type{ + obj: types.ObjectValueMust( + map[string]attr.Type{ "delete": types.StringType, }, - }, + map[string]attr.Value{ + "delete": types.StringValue("60m"), + }, + ), expected: 60 * time.Minute, }, }