File tree Expand file tree Collapse file tree 3 files changed +11
-5
lines changed Expand file tree Collapse file tree 3 files changed +11
-5
lines changed Original file line number Diff line number Diff line change 44 "errors"
55 "fmt"
66
7- "github.com/zclconf /go-cty/cty"
7+ "github.com/hashicorp /go-cty/cty"
88)
99
1010// Diagnostics is a collection of Diagnostic.
Original file line number Diff line number Diff line change @@ -22,9 +22,9 @@ import (
2222 "strconv"
2323 "strings"
2424
25+ "github.com/hashicorp/go-cty/cty"
2526 "github.com/mitchellh/copystructure"
2627 "github.com/mitchellh/mapstructure"
27- "github.com/zclconf/go-cty/cty"
2828
2929 "github.com/hashicorp/terraform-plugin-sdk/v2/diag"
3030 "github.com/hashicorp/terraform-plugin-sdk/v2/internal/configs/hcl2shim"
@@ -1459,7 +1459,12 @@ func (m schemaMap) validate(
14591459
14601460 err = validateRequiredWithAttribute (k , schema , c )
14611461 if err != nil {
1462- return nil , []error {err }
1462+ return append (diags , diag.Diagnostic {
1463+ Severity : diag .Error ,
1464+ Summary : "RequiredWith" ,
1465+ Detail : err .Error (),
1466+ AttributePath : path ,
1467+ })
14631468 }
14641469
14651470 // If the value is unknown then we can't validate it yet.
Original file line number Diff line number Diff line change @@ -12,11 +12,11 @@ import (
1212 "strings"
1313 "testing"
1414
15+ "github.com/hashicorp/go-cty/cty"
1516 "github.com/hashicorp/terraform-plugin-sdk/v2/diag"
1617 "github.com/hashicorp/terraform-plugin-sdk/v2/helper/hashcode"
1718 "github.com/hashicorp/terraform-plugin-sdk/v2/internal/configs/hcl2shim"
1819 "github.com/hashicorp/terraform-plugin-sdk/v2/terraform"
19- "github.com/zclconf/go-cty/cty"
2020)
2121
2222func TestEnvDefaultFunc (t * testing.T ) {
@@ -6791,7 +6791,8 @@ func TestValidateRequiredWithAttributes(t *testing.T) {
67916791 for tn , tc := range cases {
67926792 t .Run (tn , func (t * testing.T ) {
67936793 c := terraform .NewResourceConfigRaw (tc .Config )
6794- _ , es := schemaMap (tc .Schema ).Validate (c )
6794+ diags := schemaMap (tc .Schema ).Validate (c )
6795+ es := errorDiags (diags ).Errors ()
67956796 if len (es ) > 0 != tc .Err {
67966797 if len (es ) == 0 {
67976798 t .Fatalf ("expected error" )
You can’t perform that action at this time.
0 commit comments