Skip to content

Commit 68e2015

Browse files
authored
framework v0.10.0 updates: (#19)
* framework v0.10.0 updates: - moving to v2 module as there are bc breaks - simplifying AttributeValidator interface, will probably remove in v3 - refactoring validator construction to using config type - implementing new path....stuff * small readme update
1 parent c64bd6d commit 68e2015

File tree

11 files changed

+156
-287
lines changed

11 files changed

+156
-287
lines changed

README.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,22 @@ changes as possible but, as always, community help is appreciated!
99

1010
# Index
1111

12+
* [Version Matrix](#version-matrix)
1213
* [Installation](#installation)
1314
* [Type Conversion](#type-conversion)
1415
* [Attribute Validation](#attribute-validation)
1516
* [Test Utilities](#test-utilities)
1617

18+
# Version Matrix
19+
20+
| Terraform Plugin Framework | Framework Utils |
21+
|----------------------------|-----------------|
22+
| v0.7.0-v0.9.0 | v1 |
23+
| v0.10.x | v2 |
24+
1725
# Installation
1826
```shell
19-
go get -u github.com/dcarbone/terraform-plugin-framework-utils@latest
27+
go get -u github.com/dcarbone/terraform-plugin-framework-utils/v2@latest
2028
```
2129

2230
# Type Conversion

acctest/config.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import (
66
"sync"
77
"time"
88

9-
"github.com/dcarbone/terraform-plugin-framework-utils/internal/util"
9+
"github.com/dcarbone/terraform-plugin-framework-utils/v2/internal/util"
1010
)
1111

1212
type ConfigLiteral string

acctest/config_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import (
77
"testing"
88
"time"
99

10-
"github.com/dcarbone/terraform-plugin-framework-utils/acctest"
10+
"github.com/dcarbone/terraform-plugin-framework-utils/v2/acctest"
1111
)
1212

1313
func TestConfigValue_Defaults(t *testing.T) {

conv/attr.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,19 @@ import (
44
"fmt"
55
"strings"
66

7+
"github.com/hashicorp/terraform-plugin-framework/path"
78
"github.com/hashicorp/terraform-plugin-go/tftypes"
89
)
910

11+
// FormatPathPathSteps takes one or more path steps and joins them together with "."
12+
func FormatPathPathSteps(pathSteps ...path.PathStep) string {
13+
bits := make([]string, 0)
14+
for _, pathStep := range pathSteps {
15+
bits = append(bits, pathStep.String())
16+
}
17+
return strings.Join(bits, ".")
18+
}
19+
1020
// FormatAttributePathSteps takes one or more path steps and joins them together with "."
1121
func FormatAttributePathSteps(pathSteps ...tftypes.AttributePathStep) string {
1222
bits := make([]string, 0)

conv/errors.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import (
44
"errors"
55
"fmt"
66

7-
"github.com/dcarbone/terraform-plugin-framework-utils/internal/util"
7+
"github.com/dcarbone/terraform-plugin-framework-utils/v2/internal/util"
88
"github.com/hashicorp/terraform-plugin-framework/attr"
99
)
1010

go.mod

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
1-
module github.com/dcarbone/terraform-plugin-framework-utils
1+
module github.com/dcarbone/terraform-plugin-framework-utils/v2
22

33
go 1.17
44

55
require (
6-
github.com/hashicorp/terraform-plugin-framework v0.9.0
7-
github.com/hashicorp/terraform-plugin-go v0.10.0
6+
github.com/hashicorp/terraform-plugin-framework v0.10.0
7+
github.com/hashicorp/terraform-plugin-go v0.13.0
88
)
99

1010
require (
1111
github.com/fatih/color v1.13.0 // indirect
1212
github.com/golang/protobuf v1.5.2 // indirect
1313
github.com/google/go-cmp v0.5.8 // indirect
1414
github.com/hashicorp/go-hclog v1.2.1 // indirect
15-
github.com/hashicorp/terraform-plugin-log v0.4.1 // indirect
15+
github.com/hashicorp/terraform-plugin-log v0.7.0 // indirect
1616
github.com/mattn/go-colorable v0.1.12 // indirect
1717
github.com/mattn/go-isatty v0.0.14 // indirect
1818
github.com/mitchellh/go-testing-interface v1.14.1 // indirect

go.sum

Lines changed: 6 additions & 155 deletions
Large diffs are not rendered by default.

validation/comparison.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,15 @@ package validation
22

33
import (
44
"fmt"
5-
"github.com/hashicorp/terraform-plugin-framework/types"
65
"math/big"
76
"strings"
87
"sync"
98

10-
"github.com/dcarbone/terraform-plugin-framework-utils/conv"
11-
"github.com/dcarbone/terraform-plugin-framework-utils/internal/util"
9+
"github.com/dcarbone/terraform-plugin-framework-utils/v2/conv"
10+
"github.com/dcarbone/terraform-plugin-framework-utils/v2/internal/util"
1211
"github.com/hashicorp/terraform-plugin-framework/attr"
1312
"github.com/hashicorp/terraform-plugin-framework/tfsdk"
13+
"github.com/hashicorp/terraform-plugin-framework/types"
1414
)
1515

1616
type CompareOp string

validation/comparison_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import (
44
"math/big"
55
"testing"
66

7-
"github.com/dcarbone/terraform-plugin-framework-utils/validation"
7+
"github.com/dcarbone/terraform-plugin-framework-utils/v2/validation"
88
"github.com/hashicorp/terraform-plugin-framework/attr"
99
"github.com/hashicorp/terraform-plugin-framework/types"
1010
)

validation/errors.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import (
44
"errors"
55
"fmt"
66

7-
"github.com/dcarbone/terraform-plugin-framework-utils/internal/util"
7+
"github.com/dcarbone/terraform-plugin-framework-utils/v2/internal/util"
88
)
99

1010
var (

0 commit comments

Comments
 (0)