Skip to content

Commit 6c37178

Browse files
author
Sean Sain
committed
addressing some of the results of tfproviderlint and updating packages
1 parent 469ae8c commit 6c37178

File tree

1,156 files changed

+153046
-48949
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,156 files changed

+153046
-48949
lines changed

go.mod

Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,34 @@ module github.com/SumoLogic/sumologic-terraform-provider
33
go 1.12
44

55
require (
6+
cloud.google.com/go/pubsub v1.2.0 // indirect
7+
github.com/aws/aws-sdk-go v1.28.14 // indirect
8+
github.com/fatih/color v1.9.0 // indirect
69
github.com/go-errors/errors v1.0.1
7-
github.com/hashicorp/hcl v0.0.0-20180404174102-ef8a98b0bbce // indirect
8-
github.com/hashicorp/terraform-plugin-sdk v1.0.0
10+
github.com/go-test/deep v1.0.5 // indirect
11+
github.com/golang/mock v1.4.0 // indirect
12+
github.com/hashicorp/go-getter v1.4.1 // indirect
13+
github.com/hashicorp/go-hclog v0.12.0 // indirect
14+
github.com/hashicorp/go-uuid v1.0.2 // indirect
15+
github.com/hashicorp/hcl v1.0.0 // indirect
16+
github.com/hashicorp/hcl/v2 v2.3.0 // indirect
17+
github.com/hashicorp/terraform-config-inspect v0.0.0-20200210163047-f7d8399e1194 // indirect
18+
github.com/hashicorp/terraform-plugin-sdk v1.6.0
19+
github.com/hashicorp/terraform-svchost v0.0.0-20191119180714-d2e4933b9136 // indirect
20+
github.com/hashicorp/yamux v0.0.0-20190923154419-df201c70410d // indirect
21+
github.com/kr/pretty v0.2.0 // indirect
22+
github.com/mattn/go-isatty v0.0.12 // indirect
23+
github.com/oklog/run v1.1.0 // indirect
24+
github.com/posener/complete v1.2.3 // indirect
25+
github.com/sergi/go-diff v1.1.0 // indirect
26+
github.com/ulikunitz/xz v0.5.6 // indirect
27+
github.com/vmihailenco/msgpack v4.0.4+incompatible // indirect
28+
github.com/zclconf/go-cty v1.2.1 // indirect
29+
golang.org/x/crypto v0.0.0-20200210222208-86ce3cb69678 // indirect
30+
golang.org/x/exp v0.0.0-20200207192155-f17229e696bd // indirect
31+
golang.org/x/tools v0.0.0-20200210223759-b0390335f4a1 // indirect
32+
google.golang.org/api v0.17.0 // indirect
33+
google.golang.org/genproto v0.0.0-20200210034751-acff78025515 // indirect
34+
google.golang.org/grpc v1.27.1 // indirect
35+
gopkg.in/yaml.v2 v2.2.8 // indirect
936
)

go.sum

Lines changed: 224 additions & 30 deletions
Large diffs are not rendered by default.

sumologic/resource_sumologic_content_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import (
1313
)
1414

1515
//Testing create functionality for Content resources
16-
func TestAccContentCreate(t *testing.T) {
16+
func TestAccContent_create(t *testing.T) {
1717
var content Content
1818
personalContentId := os.Getenv("SUMOLOGIC_PF")
1919

@@ -35,7 +35,7 @@ func TestAccContentCreate(t *testing.T) {
3535
})
3636
}
3737

38-
func TestAccContentUpdate(t *testing.T) {
38+
func TestAccContent_update(t *testing.T) {
3939
var content Content
4040
personalContentId := os.Getenv("SUMOLOGIC_PF")
4141

sumologic/resource_sumologic_extraction_rule_import_test.go

Lines changed: 0 additions & 55 deletions
This file was deleted.

sumologic/resource_sumologic_extraction_rule_test.go

Lines changed: 37 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,31 @@ import (
2121
"github.com/hashicorp/terraform-plugin-sdk/terraform"
2222
)
2323

24-
func TestAccFieldExtractionRuleCreate(t *testing.T) {
24+
func TestAccSumologicFieldExtractionRule_basic(t *testing.T) {
25+
var fieldextractionrule FieldExtractionRule
26+
testName := FieldsMap["FieldExtractionRule"]["name"]
27+
testScope := FieldsMap["FieldExtractionRule"]["scope"]
28+
testParseExpression := FieldsMap["FieldExtractionRule"]["parseExpression"]
29+
testEnabled, _ := strconv.ParseBool(FieldsMap["FieldExtractionRule"]["enabled"])
30+
31+
resource.Test(t, resource.TestCase{
32+
PreCheck: func() { testAccPreCheck(t) },
33+
Providers: testAccProviders,
34+
CheckDestroy: testAccCheckFieldExtractionRuleDestroy(fieldextractionrule),
35+
Steps: []resource.TestStep{
36+
{
37+
Config: testAccCheckSumologicFieldExtractionRuleConfigImported(testName, testScope, testParseExpression, testEnabled),
38+
},
39+
{
40+
ResourceName: "sumologic_field_extraction_rule.foo",
41+
ImportState: true,
42+
ImportStateVerify: true,
43+
},
44+
},
45+
})
46+
}
47+
48+
func TestAccFieldExtractionRule_create(t *testing.T) {
2549
var fieldextractionrule FieldExtractionRule
2650
testName := FieldsMap["FieldExtractionRule"]["name"]
2751
testScope := FieldsMap["FieldExtractionRule"]["scope"]
@@ -88,7 +112,7 @@ func testAccCheckFieldExtractionRuleExists(name string, fieldextractionrule *Fie
88112
}
89113
}
90114

91-
func TestAccFieldExtractionRuleUpdate(t *testing.T) {
115+
func TestAccFieldExtractionRule_update(t *testing.T) {
92116
var fieldextractionrule FieldExtractionRule
93117
testName := FieldsMap["FieldExtractionRule"]["name"]
94118
testScope := FieldsMap["FieldExtractionRule"]["scope"]
@@ -131,6 +155,17 @@ func TestAccFieldExtractionRuleUpdate(t *testing.T) {
131155
})
132156
}
133157

158+
func testAccCheckSumologicFieldExtractionRuleConfigImported(name string, scope string, parseExpression string, enabled bool) string {
159+
return fmt.Sprintf(`
160+
resource "sumologic_field_extraction_rule" "foo" {
161+
name = "%s"
162+
scope = "%s"
163+
parse_expression = "%s"
164+
enabled = %t
165+
}
166+
`, name, scope, parseExpression, enabled)
167+
}
168+
134169
func testAccSumologicFieldExtractionRule(name string, scope string, parseExpression string, enabled bool) string {
135170
return fmt.Sprintf(`
136171
resource "sumologic_field_extraction_rule" "test" {

sumologic/resource_sumologic_folder_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import (
1010
"github.com/hashicorp/terraform-plugin-sdk/terraform"
1111
)
1212

13-
func TestAccFolderCreate(t *testing.T) {
13+
func TestAccFolder_create(t *testing.T) {
1414
var folder Folder
1515
rName := acctest.RandStringFromCharSet(10, acctest.CharSetAlphaNum)
1616
personalFolderId := os.Getenv("SUMOLOGIC_PF")
@@ -34,7 +34,7 @@ func TestAccFolderCreate(t *testing.T) {
3434
})
3535
}
3636

37-
func TestAccFolderUpdate(t *testing.T) {
37+
func TestAccFolder_update(t *testing.T) {
3838
var folder Folder
3939
rName := acctest.RandStringFromCharSet(10, acctest.CharSetAlphaNum)
4040
personalFolderId := os.Getenv("SUMOLOGIC_PF")

sumologic/resource_sumologic_partition.go

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ func resourceSumologicPartition() *schema.Resource {
1313
Read: resourceSumologicPartitionRead,
1414
Delete: resourceSumologicPartitionDelete,
1515
Update: resourceSumologicPartitionUpdate,
16-
Exists: resourceSumologicPartitionExists,
1716

1817
Schema: map[string]*schema.Schema{
1918
"name": {
@@ -120,16 +119,6 @@ func resourceSumologicPartitionUpdate(d *schema.ResourceData, meta interface{})
120119

121120
return resourceSumologicPartitionRead(d, meta)
122121
}
123-
func resourceSumologicPartitionExists(d *schema.ResourceData, meta interface{}) (bool, error) {
124-
c := meta.(*Client)
125-
126-
spartition, err := c.GetPartition(d.Id())
127-
if err != nil {
128-
return false, err
129-
}
130-
131-
return spartition != nil, nil
132-
}
133122

134123
func resourceToPartition(d *schema.ResourceData) Partition {
135124
return Partition{

sumologic/resource_sumologic_partition_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import (
99
"github.com/hashicorp/terraform-plugin-sdk/terraform"
1010
)
1111

12-
func TestAccSumoLogicPartition(t *testing.T) {
12+
func TestAccSumoLogicPartition_basic(t *testing.T) {
1313
testName := acctest.RandString(16)
1414
resource.Test(t, resource.TestCase{
1515
PreCheck: func() { testAccPreCheck(t) },

sumologic/resource_sumologic_role_import_test.go

Lines changed: 0 additions & 55 deletions
This file was deleted.

sumologic/resource_sumologic_role_test.go

Lines changed: 37 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,31 @@ import (
2121
"github.com/hashicorp/terraform-plugin-sdk/terraform"
2222
)
2323

24-
func TestAccRoleCreate(t *testing.T) {
24+
func TestAccSumologicRole_basic(t *testing.T) {
25+
var role Role
26+
testName := FieldsMap["Role"]["name"]
27+
testDescription := FieldsMap["Role"]["description"]
28+
testFilterPredicate := FieldsMap["Role"]["filterPredicate"]
29+
testCapabilities := []string{"\"" + FieldsMap["Role"]["capabilities"] + "\""}
30+
31+
resource.Test(t, resource.TestCase{
32+
PreCheck: func() { testAccPreCheck(t) },
33+
Providers: testAccProviders,
34+
CheckDestroy: testAccCheckRoleDestroy(role),
35+
Steps: []resource.TestStep{
36+
{
37+
Config: testAccCheckSumologicRoleConfigImported(testName, testDescription, testFilterPredicate, testCapabilities),
38+
},
39+
{
40+
ResourceName: "sumologic_role.foo",
41+
ImportState: true,
42+
ImportStateVerify: true,
43+
},
44+
},
45+
})
46+
}
47+
48+
func TestAccRole_create(t *testing.T) {
2549
var role Role
2650
testName := FieldsMap["Role"]["name"]
2751
testDescription := FieldsMap["Role"]["description"]
@@ -88,7 +112,7 @@ func testAccCheckRoleExists(name string, role *Role, t *testing.T) resource.Test
88112
}
89113
}
90114

91-
func TestAccRoleUpdate(t *testing.T) {
115+
func TestAccRole_update(t *testing.T) {
92116
var role Role
93117
testName := FieldsMap["Role"]["name"]
94118
testDescription := FieldsMap["Role"]["description"]
@@ -131,6 +155,17 @@ func TestAccRoleUpdate(t *testing.T) {
131155
})
132156
}
133157

158+
func testAccCheckSumologicRoleConfigImported(name string, description string, filterPredicate string, capabilities []string) string {
159+
return fmt.Sprintf(`
160+
resource "sumologic_role" "foo" {
161+
name = "%s"
162+
description = "%s"
163+
filter_predicate = "%s"
164+
capabilities = %v
165+
}
166+
`, name, description, filterPredicate, capabilities)
167+
}
168+
134169
func testAccSumologicRole(name string, description string, filterPredicate string, capabilities []string) string {
135170
return fmt.Sprintf(`
136171
resource "sumologic_role" "test" {

0 commit comments

Comments
 (0)