@@ -78,9 +78,8 @@ func TestAccSumologicCSEMatchRule_createAndUpdate(t *testing.T) {
7878func TestAccSumologicCSEMatchRule_Override (t * testing.T ) {
7979 SkipCseTest (t )
8080
81+ descriptionExpression := "Observes for possible exploitation of CVE-2017-8759"
8182 var matchRule CSEMatchRule
82- descriptionExpression := "Detects email addresses associated with known malicious actor(s) or campaign(s) as designated by a threat intelligence provider."
83-
8483 resourceName := "sumologic_cse_match_rule.sumo_match_rule_test"
8584 resource .Test (t , resource.TestCase {
8685 PreCheck : func () { testAccPreCheck (t ) },
@@ -91,7 +90,7 @@ func TestAccSumologicCSEMatchRule_Override(t *testing.T) {
9190 Config : testOverrideCSEMatchRuleConfig (descriptionExpression ),
9291 ResourceName : resourceName ,
9392 ImportState : true ,
94- ImportStateId : "MATCH-S01020 " ,
93+ ImportStateId : "MATCH-S00574 " ,
9594 ImportStateVerify : false ,
9695 ImportStateVerifyIgnore : []string {"name" }, // Ignore fields that might differ
9796 ImportStatePersist : true ,
@@ -102,7 +101,7 @@ func TestAccSumologicCSEMatchRule_Override(t *testing.T) {
102101 testCheckCSEMatchRuleExists (resourceName , & matchRule ),
103102 testCheckMatchRuleOverrideValues (& matchRule , fmt .Sprintf ("Updated %s" , descriptionExpression )),
104103 resource .TestCheckResourceAttrSet (resourceName , "id" ),
105- resource .TestCheckResourceAttr (resourceName , "id" , "MATCH-S01020 " ),
104+ resource .TestCheckResourceAttr (resourceName , "id" , "MATCH-S00574 " ),
106105 ),
107106 },
108107 {
@@ -111,14 +110,27 @@ func TestAccSumologicCSEMatchRule_Override(t *testing.T) {
111110 testCheckCSEMatchRuleExists (resourceName , & matchRule ),
112111 testCheckMatchRuleOverrideValues (& matchRule , descriptionExpression ),
113112 resource .TestCheckResourceAttrSet (resourceName , "id" ),
114- resource .TestCheckResourceAttr (resourceName , "id" , "MATCH-S01020" ),
115- removeState ("sumologic_cse_match_rule.sumo_match_rule_test" ),
113+ resource .TestCheckResourceAttr (resourceName , "id" , "MATCH-S00574" ),
116114 ),
117115 },
116+ {
117+ Config : getMatchRuleRemovedBlock (),
118+ },
118119 },
119120 })
120121}
121122
123+ func getMatchRuleRemovedBlock () string {
124+ return fmt .Sprintf (`
125+ removed {
126+ from = sumologic_cse_match_rule.sumo_match_rule_test
127+ lifecycle {
128+ destroy = false
129+ }
130+ }
131+ ` )
132+ }
133+
122134func TestAccSumologicCSEMatchRule_failSuppressionValidation (t * testing.T ) {
123135 SkipCseTest (t )
124136
@@ -210,32 +222,28 @@ func testOverrideCSEMatchRuleConfig(descriptionExpression string) string {
210222resource "sumologic_cse_match_rule" "sumo_match_rule_test" {
211223 description_expression = "%s"
212224 enabled = true
213- expression = "hasThreatMatch([targetUser_email], confidence > 1 AND type='email-addr')"
214- is_prototype = true
215- name = "Threat Intel - Matched Target Email"
216- name_expression = "Threat Intel - Matched Target Email"
217- summary_expression = "The record contains a target email address associated with a threat intelligence feed: {{targetUser_email}}"
218- tags = []
225+ is_prototype = false
226+ name = ".NET Framework Remote Code Execution Vulnerability"
227+ name_expression = ".NET Framework Remote Code Execution Vulnerability"
228+ summary_expression = "Observed possible CVE-2017-8759 exploit on {{device_hostname}}"
229+ tags = [
230+ "_mitreAttackTactic:TA0002",
231+ "_mitreAttackTactic:TA0001",
232+ "_mitreAttackTechnique:T1203",
233+ ]
219234
220235 entity_selectors {
221- entity_type = "_username"
222- expression = "user_username"
223- }
224- entity_selectors {
225- entity_type = "_email"
226- expression = "user_email"
236+ entity_type = "_hostname"
237+ expression = "device_hostname"
227238 }
228239 entity_selectors {
229240 entity_type = "_username"
230- expression = "targetUser_username"
231- }
232- entity_selectors {
233- entity_type = "_email"
234- expression = "targetUser_email"
241+ expression = "user_username"
235242 }
236243
237244 severity_mapping {
238- default = 1
245+ default = 3
246+ field = null
239247 type = "constant"
240248 }
241249}
0 commit comments