Skip to content

Commit fd7bb5c

Browse files
committed
SDK v2.0.3
1 parent bed3918 commit fd7bb5c

File tree

1,947 files changed

+214328
-133159
lines changed

Some content is hidden

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

1,947 files changed

+214328
-133159
lines changed

go.mod

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
1-
module github.com/terraform-providers/terraform-provider-archive
1+
module github.com/hashicorp/terraform-provider-archive
22

33
go 1.14
44

5-
require (
6-
github.com/hashicorp/hcl v1.0.0 // indirect
7-
github.com/hashicorp/terraform-plugin-sdk v1.12.0
8-
)
5+
require github.com/hashicorp/terraform-plugin-sdk/v2 v2.0.3

go.sum

Lines changed: 319 additions & 50 deletions
Large diffs are not rendered by default.

internal/hashcode/hashcode_test.go

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
package hashcode
2+
3+
import (
4+
"testing"
5+
)
6+
7+
func TestString(t *testing.T) {
8+
v := "hello, world"
9+
expected := String(v)
10+
for i := 0; i < 100; i++ {
11+
actual := String(v)
12+
if actual != expected {
13+
t.Fatalf("bad: %#v\n\t%#v", actual, expected)
14+
}
15+
}
16+
}
17+
18+
func TestStrings(t *testing.T) {
19+
v := []string{"hello", ",", "world"}
20+
expected := Strings(v)
21+
for i := 0; i < 100; i++ {
22+
actual := Strings(v)
23+
if actual != expected {
24+
t.Fatalf("bad: %#v\n\t%#v", actual, expected)
25+
}
26+
}
27+
}
28+
29+
func TestString_positiveIndex(t *testing.T) {
30+
// "2338615298" hashes to uint32(2147483648) which is math.MinInt32
31+
ips := []string{"192.168.1.3", "192.168.1.5", "2338615298"}
32+
for _, ip := range ips {
33+
if index := String(ip); index < 0 {
34+
t.Fatalf("Bad Index %#v for ip %s", index, ip)
35+
}
36+
}
37+
}

internal/provider/data_source_archive_file.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ import (
1212
"os"
1313
"path"
1414

15-
"github.com/hashicorp/terraform-plugin-sdk/helper/hashcode"
16-
"github.com/hashicorp/terraform-plugin-sdk/helper/schema"
15+
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
16+
"github.com/hashicorp/terraform-provider-archive/internal/hashcode"
1717
)
1818

1919
func dataSourceFile() *schema.Resource {

internal/provider/data_source_archive_file_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ import (
88
"regexp"
99
"testing"
1010

11-
r "github.com/hashicorp/terraform-plugin-sdk/helper/resource"
12-
"github.com/hashicorp/terraform-plugin-sdk/terraform"
11+
r "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource"
12+
"github.com/hashicorp/terraform-plugin-sdk/v2/terraform"
1313
)
1414

1515
func TestAccArchiveFile_Basic(t *testing.T) {

internal/provider/provider.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
package archive
22

33
import (
4-
"github.com/hashicorp/terraform-plugin-sdk/helper/schema"
5-
"github.com/hashicorp/terraform-plugin-sdk/terraform"
4+
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
65
)
76

8-
func Provider() terraform.ResourceProvider {
7+
func Provider() *schema.Provider {
98
return &schema.Provider{
109
DataSourcesMap: map[string]*schema.Resource{
1110
"archive_file": dataSourceFile(),

internal/provider/provider_test.go

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,23 +3,15 @@ package archive
33
import (
44
"testing"
55

6-
"github.com/hashicorp/terraform-plugin-sdk/acctest"
7-
"github.com/hashicorp/terraform-plugin-sdk/helper/resource"
8-
"github.com/hashicorp/terraform-plugin-sdk/helper/schema"
9-
"github.com/hashicorp/terraform-plugin-sdk/terraform"
6+
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
107
)
118

12-
var testProviders = map[string]terraform.ResourceProvider{
9+
var testProviders = map[string]*schema.Provider{
1310
"archive": Provider(),
1411
}
1512

1613
func TestProvider(t *testing.T) {
17-
if err := Provider().(*schema.Provider).InternalValidate(); err != nil {
14+
if err := Provider().InternalValidate(); err != nil {
1815
t.Fatalf("err: %s", err)
1916
}
2017
}
21-
22-
func TestMain(m *testing.M) {
23-
acctest.UseBinaryDriver("archive", Provider)
24-
resource.TestMain(m)
25-
}

main.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
package main
22

33
import (
4-
"github.com/hashicorp/terraform-plugin-sdk/plugin"
5-
"github.com/terraform-providers/terraform-provider-archive/internal/provider"
4+
"github.com/hashicorp/terraform-plugin-sdk/v2/plugin"
5+
"github.com/hashicorp/terraform-provider-archive/internal/provider"
66
)
77

88
func main() {

vendor/cloud.google.com/go/.gitignore

Lines changed: 11 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)