Skip to content

Commit 0e3705c

Browse files
committed
DET-728: cleanup state for match rule overrides
1 parent 358ca7c commit 0e3705c

File tree

3 files changed

+10
-16
lines changed

3 files changed

+10
-16
lines changed

.github/workflows/test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ jobs:
7575
matrix:
7676
# list whatever Terraform versions here you would like to support
7777
terraform:
78-
- '1.7.0'
78+
- '1.0.3'
7979
steps:
8080
- name: Set up Go
8181
uses: actions/[email protected]

sumologic/resource_sumologic_cse_match_rule_test.go

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -112,11 +112,9 @@ func TestAccSumologicCSEMatchRule_Override(t *testing.T) {
112112
testCheckMatchRuleOverrideValues(&matchRule, descriptionExpression),
113113
resource.TestCheckResourceAttrSet(resourceName, "id"),
114114
resource.TestCheckResourceAttr(resourceName, "id", "MATCH-S01020"),
115+
removeState("sumologic_cse_match_rule", "sumo_match_rule_test"),
115116
),
116117
},
117-
{
118-
Config: getMatchRuleRemovedBlock(),
119-
},
120118
},
121119
})
122120
}
@@ -244,18 +242,6 @@ resource "sumologic_cse_match_rule" "sumo_match_rule_test" {
244242
`, descriptionExpression)
245243
}
246244

247-
func getMatchRuleRemovedBlock() string {
248-
return fmt.Sprintf(`
249-
removed {
250-
from = sumologic_cse_match_rule.sumo_match_rule_test
251-
252-
lifecycle {
253-
destroy = false
254-
}
255-
}
256-
`)
257-
}
258-
259245
func testCheckCSEMatchRuleExists(n string, matchRule *CSEMatchRule) resource.TestCheckFunc {
260246
return func(s *terraform.State) error {
261247
rs, ok := s.RootModule().Resources[n]

sumologic/util_test.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
package sumologic
22

33
import (
4+
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource"
45
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/structure"
6+
"github.com/hashicorp/terraform-plugin-sdk/v2/terraform"
57
"reflect"
68
"testing"
79
)
@@ -274,3 +276,9 @@ func TestRemoveEmptyValues(t *testing.T) {
274276
t.Fatal("Expected json after removing empty values:", cleanedJsonStr, "but was:", processedJsonStr)
275277
}
276278
}
279+
280+
func removeState(addr ...string) resource.TestCheckFunc {
281+
return func(s *terraform.State) error {
282+
return s.Remove(addr...)
283+
}
284+
}

0 commit comments

Comments
 (0)