Skip to content

Commit ed4c5db

Browse files
committed
path: Introduce package with initial tftypes.AttributePath abstraction
Reference: #81 Reference: #161 Reference: #215 Reference: #365 This introduces a native abstraction over terraform-plugin-go's `tftypes.AttributePath`, allowing the framework to own the implementation details and extend the functionality further. Provider developers will be closer to removing a direct dependency on terraform-plugin-go. This is a major breaking change, however it is necessary before 1.0 to prevent compatibility issues in the future. This functionality is only intended to replace `tftypes.AttributePath` usage and not mess with the `tfsdk.Config`, `tfsdk.Plan`, and `tfsdk.State` type `tftypes.Value` data storage fields or their underlying data manipulation logic. This does leave the framework in an awkward half-state until those are further refactored (likely towards native `attr.Value`), but is done to try and reduce the review complexity of this initial migration. Additional followup changes will introduce the concept of path expressions, which will allow provider developers to match against multiple paths or reference parent paths in schema-based plan modifier and validation functionality. To prevent import cycles between `attr` and `diag` packages due changing the `attr.TypeWithValidate` type `Validate` method signature from `Validate(context.Context, tftypes.Value, *tftypes.AttributePath) diag.Diagnostics` to `Validate(context.Context, tftypes.Value, path.Path) diag.Diagnostics`, the `TypeWithValidation` interface is moved a new `xattr` package underneath `attr` with Go and website documentation to direct provider developers to the other package. This will also solve a prior issue with trying to implement `TypeWithModifyPlan` support. Naming and location of anything in this initial implementation can be adjusted as necessary. Provider developers can migrate to the new path handling by replacing: ```go tftypes.NewAttributePath().WithAttributeName("example") ``` With the equivalent: ```go path.RootPath("example") ``` Then using the `(Path).At*` methods to extend the path definition instead of `(*tftypes.AttributePath).With*` methods: | Current | New | | ------------------------ | --------------- | | `WithAttributeName()` | `AtName()` | | `WithElementKeyInt()` | `AtListIndex()` | | `WithElementKeyString()` | `AtMapKey()` | | `WithElementKeyValue()` | `AtSetValue()` |
1 parent 6e01dca commit ed4c5db

File tree

139 files changed

+3997
-1281
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

139 files changed

+3997
-1281
lines changed

attr/doc.go

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
// Package attr contains type and value interfaces for core framework and
2+
// provider-defined data types. The underlying xattr package contains
3+
// additional interfaces for advanced type functionality.
4+
package attr

attr/type.go

+3-13
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,15 @@ package attr
33
import (
44
"context"
55

6-
"github.com/hashicorp/terraform-plugin-framework/diag"
76
"github.com/hashicorp/terraform-plugin-go/tftypes"
87
)
98

109
// Type defines an interface for describing a kind of attribute. Types are
1110
// collections of constraints and behaviors such that they can be reused on
1211
// multiple attributes easily.
12+
//
13+
// Refer also to the xattr package, which contains additional extensions for
14+
// Type, such as validation.
1315
type Type interface {
1416
// TerraformType returns the tftypes.Type that should be used to
1517
// represent this type. This constrains what user input will be
@@ -74,18 +76,6 @@ type TypeWithElementTypes interface {
7476
ElementTypes() []Type
7577
}
7678

77-
// TypeWithValidate extends the Type interface to include a Validate method,
78-
// used to bundle consistent validation logic with the Type.
79-
type TypeWithValidate interface {
80-
Type
81-
82-
// Validate returns any warnings or errors about the value that is
83-
// being used to populate the Type. It is generally used to check the
84-
// data format and ensure that it complies with the requirements of the
85-
// Type.
86-
Validate(context.Context, tftypes.Value, *tftypes.AttributePath) diag.Diagnostics
87-
}
88-
8979
// TypeWithPlaintextDescription extends the Type interface to include a
9080
// Description method, used to bundle extra information to include in attribute
9181
// descriptions with the Type. It expects the description to be written as

attr/xattr/doc.go

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
// Package xattr contains additional interfaces for attr types. This package
2+
// is separate from the core attr package to prevent import cycles.
3+
package xattr

attr/xattr/type.go

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
package xattr
2+
3+
import (
4+
"context"
5+
6+
"github.com/hashicorp/terraform-plugin-framework/attr"
7+
"github.com/hashicorp/terraform-plugin-framework/diag"
8+
"github.com/hashicorp/terraform-plugin-framework/path"
9+
"github.com/hashicorp/terraform-plugin-go/tftypes"
10+
)
11+
12+
// TypeWithValidate extends the attr.Type interface to include a Validate
13+
// method, used to bundle consistent validation logic with the Type.
14+
type TypeWithValidate interface {
15+
attr.Type
16+
17+
// Validate returns any warnings or errors about the value that is
18+
// being used to populate the Type. It is generally used to check the
19+
// data format and ensure that it complies with the requirements of the
20+
// Type.
21+
Validate(context.Context, tftypes.Value, path.Path) diag.Diagnostics
22+
}

diag/attribute_error_diagnostic.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
package diag
22

33
import (
4-
"github.com/hashicorp/terraform-plugin-go/tftypes"
4+
"github.com/hashicorp/terraform-plugin-framework/path"
55
)
66

77
// NewAttributeErrorDiagnostic returns a new error severity diagnostic with the given summary, detail, and path.
8-
func NewAttributeErrorDiagnostic(path *tftypes.AttributePath, summary string, detail string) DiagnosticWithPath {
8+
func NewAttributeErrorDiagnostic(path path.Path, summary string, detail string) DiagnosticWithPath {
99
return withPath{
1010
Diagnostic: NewErrorDiagnostic(summary, detail),
1111
path: path,

diag/attribute_warning_diagnostic.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
package diag
22

33
import (
4-
"github.com/hashicorp/terraform-plugin-go/tftypes"
4+
"github.com/hashicorp/terraform-plugin-framework/path"
55
)
66

77
// NewAttributeWarningDiagnostic returns a new warning severity diagnostic with the given summary, detail, and path.
8-
func NewAttributeWarningDiagnostic(path *tftypes.AttributePath, summary string, detail string) DiagnosticWithPath {
8+
func NewAttributeWarningDiagnostic(path path.Path, summary string, detail string) DiagnosticWithPath {
99
return withPath{
1010
Diagnostic: NewWarningDiagnostic(summary, detail),
1111
path: path,

diag/diagnostic.go

+2-4
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
package diag
22

3-
import (
4-
"github.com/hashicorp/terraform-plugin-go/tftypes"
5-
)
3+
import "github.com/hashicorp/terraform-plugin-framework/path"
64

75
// Diagnostic is an interface for providing enhanced feedback.
86
//
@@ -48,5 +46,5 @@ type DiagnosticWithPath interface {
4846
//
4947
// If present, this enables the display of source configuration context for
5048
// supporting implementations such as Terraform CLI commands.
51-
Path() *tftypes.AttributePath
49+
Path() path.Path
5250
}

diag/diagnostics.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
package diag
22

33
import (
4-
"github.com/hashicorp/terraform-plugin-go/tftypes"
4+
"github.com/hashicorp/terraform-plugin-framework/path"
55
)
66

77
// Diagnostics represents a collection of diagnostics.
@@ -11,12 +11,12 @@ import (
1111
type Diagnostics []Diagnostic
1212

1313
// AddAttributeError adds a generic attribute error diagnostic to the collection.
14-
func (diags *Diagnostics) AddAttributeError(path *tftypes.AttributePath, summary string, detail string) {
14+
func (diags *Diagnostics) AddAttributeError(path path.Path, summary string, detail string) {
1515
diags.Append(NewAttributeErrorDiagnostic(path, summary, detail))
1616
}
1717

1818
// AddAttributeWarning adds a generic attribute warning diagnostic to the collection.
19-
func (diags *Diagnostics) AddAttributeWarning(path *tftypes.AttributePath, summary string, detail string) {
19+
func (diags *Diagnostics) AddAttributeWarning(path path.Path, summary string, detail string) {
2020
diags.Append(NewAttributeWarningDiagnostic(path, summary, detail))
2121
}
2222

diag/diagnostics_test.go

+48-48
Original file line numberDiff line numberDiff line change
@@ -5,53 +5,53 @@ import (
55

66
"github.com/google/go-cmp/cmp"
77
"github.com/hashicorp/terraform-plugin-framework/diag"
8-
"github.com/hashicorp/terraform-plugin-go/tftypes"
8+
"github.com/hashicorp/terraform-plugin-framework/path"
99
)
1010

1111
func TestDiagnosticsAddAttributeError(t *testing.T) {
1212
t.Parallel()
1313

1414
testCases := map[string]struct {
1515
diags diag.Diagnostics
16-
path *tftypes.AttributePath
16+
path path.Path
1717
summary string
1818
detail string
1919
expected diag.Diagnostics
2020
}{
2121
"nil-add": {
2222
diags: nil,
23-
path: tftypes.NewAttributePath().WithAttributeName("test"),
23+
path: path.RootPath("test"),
2424
summary: "one summary",
2525
detail: "one detail",
2626
expected: diag.Diagnostics{
27-
diag.NewAttributeErrorDiagnostic(tftypes.NewAttributePath().WithAttributeName("test"), "one summary", "one detail"),
27+
diag.NewAttributeErrorDiagnostic(path.RootPath("test"), "one summary", "one detail"),
2828
},
2929
},
3030
"add": {
3131
diags: diag.Diagnostics{
32-
diag.NewAttributeErrorDiagnostic(tftypes.NewAttributePath().WithAttributeName("test"), "one summary", "one detail"),
33-
diag.NewAttributeWarningDiagnostic(tftypes.NewAttributePath().WithAttributeName("test"), "two summary", "two detail"),
32+
diag.NewAttributeErrorDiagnostic(path.RootPath("test"), "one summary", "one detail"),
33+
diag.NewAttributeWarningDiagnostic(path.RootPath("test"), "two summary", "two detail"),
3434
},
35-
path: tftypes.NewAttributePath().WithAttributeName("test"),
35+
path: path.RootPath("test"),
3636
summary: "three summary",
3737
detail: "three detail",
3838
expected: diag.Diagnostics{
39-
diag.NewAttributeErrorDiagnostic(tftypes.NewAttributePath().WithAttributeName("test"), "one summary", "one detail"),
40-
diag.NewAttributeWarningDiagnostic(tftypes.NewAttributePath().WithAttributeName("test"), "two summary", "two detail"),
41-
diag.NewAttributeErrorDiagnostic(tftypes.NewAttributePath().WithAttributeName("test"), "three summary", "three detail"),
39+
diag.NewAttributeErrorDiagnostic(path.RootPath("test"), "one summary", "one detail"),
40+
diag.NewAttributeWarningDiagnostic(path.RootPath("test"), "two summary", "two detail"),
41+
diag.NewAttributeErrorDiagnostic(path.RootPath("test"), "three summary", "three detail"),
4242
},
4343
},
4444
"duplicate": {
4545
diags: diag.Diagnostics{
46-
diag.NewAttributeErrorDiagnostic(tftypes.NewAttributePath().WithAttributeName("test"), "one summary", "one detail"),
47-
diag.NewAttributeWarningDiagnostic(tftypes.NewAttributePath().WithAttributeName("test"), "two summary", "two detail"),
46+
diag.NewAttributeErrorDiagnostic(path.RootPath("test"), "one summary", "one detail"),
47+
diag.NewAttributeWarningDiagnostic(path.RootPath("test"), "two summary", "two detail"),
4848
},
49-
path: tftypes.NewAttributePath().WithAttributeName("test"),
49+
path: path.RootPath("test"),
5050
summary: "one summary",
5151
detail: "one detail",
5252
expected: diag.Diagnostics{
53-
diag.NewAttributeErrorDiagnostic(tftypes.NewAttributePath().WithAttributeName("test"), "one summary", "one detail"),
54-
diag.NewAttributeWarningDiagnostic(tftypes.NewAttributePath().WithAttributeName("test"), "two summary", "two detail"),
53+
diag.NewAttributeErrorDiagnostic(path.RootPath("test"), "one summary", "one detail"),
54+
diag.NewAttributeWarningDiagnostic(path.RootPath("test"), "two summary", "two detail"),
5555
},
5656
},
5757
}
@@ -75,45 +75,45 @@ func TestDiagnosticsAddAttributeWarning(t *testing.T) {
7575

7676
testCases := map[string]struct {
7777
diags diag.Diagnostics
78-
path *tftypes.AttributePath
78+
path path.Path
7979
summary string
8080
detail string
8181
expected diag.Diagnostics
8282
}{
8383
"nil-add": {
8484
diags: nil,
85-
path: tftypes.NewAttributePath().WithAttributeName("test"),
85+
path: path.RootPath("test"),
8686
summary: "one summary",
8787
detail: "one detail",
8888
expected: diag.Diagnostics{
89-
diag.NewAttributeWarningDiagnostic(tftypes.NewAttributePath().WithAttributeName("test"), "one summary", "one detail"),
89+
diag.NewAttributeWarningDiagnostic(path.RootPath("test"), "one summary", "one detail"),
9090
},
9191
},
9292
"add": {
9393
diags: diag.Diagnostics{
94-
diag.NewAttributeErrorDiagnostic(tftypes.NewAttributePath().WithAttributeName("test"), "one summary", "one detail"),
95-
diag.NewAttributeWarningDiagnostic(tftypes.NewAttributePath().WithAttributeName("test"), "two summary", "two detail"),
94+
diag.NewAttributeErrorDiagnostic(path.RootPath("test"), "one summary", "one detail"),
95+
diag.NewAttributeWarningDiagnostic(path.RootPath("test"), "two summary", "two detail"),
9696
},
97-
path: tftypes.NewAttributePath().WithAttributeName("test"),
97+
path: path.RootPath("test"),
9898
summary: "three summary",
9999
detail: "three detail",
100100
expected: diag.Diagnostics{
101-
diag.NewAttributeErrorDiagnostic(tftypes.NewAttributePath().WithAttributeName("test"), "one summary", "one detail"),
102-
diag.NewAttributeWarningDiagnostic(tftypes.NewAttributePath().WithAttributeName("test"), "two summary", "two detail"),
103-
diag.NewAttributeWarningDiagnostic(tftypes.NewAttributePath().WithAttributeName("test"), "three summary", "three detail"),
101+
diag.NewAttributeErrorDiagnostic(path.RootPath("test"), "one summary", "one detail"),
102+
diag.NewAttributeWarningDiagnostic(path.RootPath("test"), "two summary", "two detail"),
103+
diag.NewAttributeWarningDiagnostic(path.RootPath("test"), "three summary", "three detail"),
104104
},
105105
},
106106
"duplicate": {
107107
diags: diag.Diagnostics{
108-
diag.NewAttributeErrorDiagnostic(tftypes.NewAttributePath().WithAttributeName("test"), "one summary", "one detail"),
109-
diag.NewAttributeWarningDiagnostic(tftypes.NewAttributePath().WithAttributeName("test"), "two summary", "two detail"),
108+
diag.NewAttributeErrorDiagnostic(path.RootPath("test"), "one summary", "one detail"),
109+
diag.NewAttributeWarningDiagnostic(path.RootPath("test"), "two summary", "two detail"),
110110
},
111-
path: tftypes.NewAttributePath().WithAttributeName("test"),
111+
path: path.RootPath("test"),
112112
summary: "two summary",
113113
detail: "two detail",
114114
expected: diag.Diagnostics{
115-
diag.NewAttributeErrorDiagnostic(tftypes.NewAttributePath().WithAttributeName("test"), "one summary", "one detail"),
116-
diag.NewAttributeWarningDiagnostic(tftypes.NewAttributePath().WithAttributeName("test"), "two summary", "two detail"),
115+
diag.NewAttributeErrorDiagnostic(path.RootPath("test"), "one summary", "one detail"),
116+
diag.NewAttributeWarningDiagnostic(path.RootPath("test"), "two summary", "two detail"),
117117
},
118118
},
119119
}
@@ -285,16 +285,16 @@ func TestDiagnosticsAppend(t *testing.T) {
285285
},
286286
"append-less-specific": {
287287
diags: diag.Diagnostics{
288-
diag.NewAttributeErrorDiagnostic(tftypes.NewAttributePath().WithAttributeName("error"), "one summary", "one detail"),
289-
diag.NewAttributeWarningDiagnostic(tftypes.NewAttributePath().WithAttributeName("warning"), "two summary", "two detail"),
288+
diag.NewAttributeErrorDiagnostic(path.RootPath("error"), "one summary", "one detail"),
289+
diag.NewAttributeWarningDiagnostic(path.RootPath("warning"), "two summary", "two detail"),
290290
},
291291
in: diag.Diagnostics{
292292
diag.NewErrorDiagnostic("one summary", "one detail"),
293293
diag.NewWarningDiagnostic("two summary", "two detail"),
294294
},
295295
expected: diag.Diagnostics{
296-
diag.NewAttributeErrorDiagnostic(tftypes.NewAttributePath().WithAttributeName("error"), "one summary", "one detail"),
297-
diag.NewAttributeWarningDiagnostic(tftypes.NewAttributePath().WithAttributeName("warning"), "two summary", "two detail"),
296+
diag.NewAttributeErrorDiagnostic(path.RootPath("error"), "one summary", "one detail"),
297+
diag.NewAttributeWarningDiagnostic(path.RootPath("warning"), "two summary", "two detail"),
298298
diag.NewErrorDiagnostic("one summary", "one detail"),
299299
diag.NewWarningDiagnostic("two summary", "two detail"),
300300
},
@@ -305,14 +305,14 @@ func TestDiagnosticsAppend(t *testing.T) {
305305
diag.NewWarningDiagnostic("two summary", "two detail"),
306306
},
307307
in: diag.Diagnostics{
308-
diag.NewAttributeErrorDiagnostic(tftypes.NewAttributePath().WithAttributeName("error"), "one summary", "one detail"),
309-
diag.NewAttributeWarningDiagnostic(tftypes.NewAttributePath().WithAttributeName("warning"), "two summary", "two detail"),
308+
diag.NewAttributeErrorDiagnostic(path.RootPath("error"), "one summary", "one detail"),
309+
diag.NewAttributeWarningDiagnostic(path.RootPath("warning"), "two summary", "two detail"),
310310
},
311311
expected: diag.Diagnostics{
312312
diag.NewErrorDiagnostic("one summary", "one detail"),
313313
diag.NewWarningDiagnostic("two summary", "two detail"),
314-
diag.NewAttributeErrorDiagnostic(tftypes.NewAttributePath().WithAttributeName("error"), "one summary", "one detail"),
315-
diag.NewAttributeWarningDiagnostic(tftypes.NewAttributePath().WithAttributeName("warning"), "two summary", "two detail"),
314+
diag.NewAttributeErrorDiagnostic(path.RootPath("error"), "one summary", "one detail"),
315+
diag.NewAttributeWarningDiagnostic(path.RootPath("warning"), "two summary", "two detail"),
316316
},
317317
},
318318
"empty-diagnostics": {
@@ -388,10 +388,10 @@ func TestDiagnosticsContains(t *testing.T) {
388388
},
389389
"matching-attribute-path": {
390390
diags: diag.Diagnostics{
391-
diag.NewAttributeErrorDiagnostic(tftypes.NewAttributePath().WithAttributeName("error"), "one summary", "one detail"),
392-
diag.NewAttributeWarningDiagnostic(tftypes.NewAttributePath().WithAttributeName("warning"), "two summary", "two detail"),
391+
diag.NewAttributeErrorDiagnostic(path.RootPath("error"), "one summary", "one detail"),
392+
diag.NewAttributeWarningDiagnostic(path.RootPath("warning"), "two summary", "two detail"),
393393
},
394-
in: diag.NewAttributeWarningDiagnostic(tftypes.NewAttributePath().WithAttributeName("warning"), "two summary", "two detail"),
394+
in: diag.NewAttributeWarningDiagnostic(path.RootPath("warning"), "two summary", "two detail"),
395395
expected: true,
396396
},
397397
"nil-diagnostics": {
@@ -409,10 +409,10 @@ func TestDiagnosticsContains(t *testing.T) {
409409
},
410410
"different-attribute-path": {
411411
diags: diag.Diagnostics{
412-
diag.NewAttributeErrorDiagnostic(tftypes.NewAttributePath().WithAttributeName("error"), "one summary", "one detail"),
413-
diag.NewAttributeWarningDiagnostic(tftypes.NewAttributePath().WithAttributeName("warning"), "two summary", "two detail"),
412+
diag.NewAttributeErrorDiagnostic(path.RootPath("error"), "one summary", "one detail"),
413+
diag.NewAttributeWarningDiagnostic(path.RootPath("warning"), "two summary", "two detail"),
414414
},
415-
in: diag.NewAttributeWarningDiagnostic(tftypes.NewAttributePath().WithAttributeName("different"), "two summary", "two detail"),
415+
in: diag.NewAttributeWarningDiagnostic(path.RootPath("different"), "two summary", "two detail"),
416416
expected: false,
417417
},
418418
"different-detail": {
@@ -441,8 +441,8 @@ func TestDiagnosticsContains(t *testing.T) {
441441
},
442442
"different-type-less-specific": {
443443
diags: diag.Diagnostics{
444-
diag.NewAttributeErrorDiagnostic(tftypes.NewAttributePath().WithAttributeName("error"), "one summary", "one detail"),
445-
diag.NewAttributeWarningDiagnostic(tftypes.NewAttributePath().WithAttributeName("warning"), "two summary", "two detail"),
444+
diag.NewAttributeErrorDiagnostic(path.RootPath("error"), "one summary", "one detail"),
445+
diag.NewAttributeWarningDiagnostic(path.RootPath("warning"), "two summary", "two detail"),
446446
},
447447
in: diag.NewWarningDiagnostic("two summary", "two detail"),
448448
expected: false,
@@ -452,7 +452,7 @@ func TestDiagnosticsContains(t *testing.T) {
452452
diag.NewErrorDiagnostic("one summary", "one detail"),
453453
diag.NewWarningDiagnostic("two summary", "two detail"),
454454
},
455-
in: diag.NewAttributeWarningDiagnostic(tftypes.NewAttributePath().WithAttributeName("warning"), "two summary", "two detail"),
455+
in: diag.NewAttributeWarningDiagnostic(path.RootPath("warning"), "two summary", "two detail"),
456456
expected: false,
457457
},
458458
}
@@ -487,8 +487,8 @@ func TestDiagnosticsHasError(t *testing.T) {
487487
},
488488
"matching-attribute-path": {
489489
diags: diag.Diagnostics{
490-
diag.NewAttributeErrorDiagnostic(tftypes.NewAttributePath().WithAttributeName("error"), "one summary", "one detail"),
491-
diag.NewAttributeWarningDiagnostic(tftypes.NewAttributePath().WithAttributeName("warning"), "two summary", "two detail"),
490+
diag.NewAttributeErrorDiagnostic(path.RootPath("error"), "one summary", "one detail"),
491+
diag.NewAttributeWarningDiagnostic(path.RootPath("warning"), "two summary", "two detail"),
492492
},
493493
expected: true,
494494
},

diag/with_path.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
package diag
22

33
import (
4-
"github.com/hashicorp/terraform-plugin-go/tftypes"
4+
"github.com/hashicorp/terraform-plugin-framework/path"
55
)
66

77
var _ DiagnosticWithPath = withPath{}
@@ -10,7 +10,7 @@ var _ DiagnosticWithPath = withPath{}
1010
type withPath struct {
1111
Diagnostic
1212

13-
path *tftypes.AttributePath
13+
path path.Path
1414
}
1515

1616
// Equal returns true if the other diagnostic is wholly equivalent.
@@ -33,12 +33,12 @@ func (d withPath) Equal(other Diagnostic) bool {
3333
}
3434

3535
// Path returns the diagnostic path.
36-
func (d withPath) Path() *tftypes.AttributePath {
36+
func (d withPath) Path() path.Path {
3737
return d.path
3838
}
3939

4040
// WithPath wraps a diagnostic with path information or overwrites the path.
41-
func WithPath(path *tftypes.AttributePath, d Diagnostic) DiagnosticWithPath {
41+
func WithPath(path path.Path, d Diagnostic) DiagnosticWithPath {
4242
wp, ok := d.(withPath)
4343

4444
if !ok {

0 commit comments

Comments
 (0)