Skip to content

Commit 2110a5c

Browse files
committed
Test
1 parent bfa9aaa commit 2110a5c

File tree

1 file changed

+47
-0
lines changed

1 file changed

+47
-0
lines changed

sysdig/resource_sysdig_secure_custom_policy_test.go

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,14 @@ func TestAccCustomPolicy(t *testing.T) {
2424
},
2525
},
2626
Steps: []resource.TestStep{
27+
{
28+
Config: customPolicyWithName(rText()),
29+
},
30+
{
31+
ResourceName: "sysdig_secure_custom_policy.sample",
32+
ImportState: true,
33+
ImportStateVerify: true,
34+
},
2735
{
2836
Config: customPolicyWithName(rText()),
2937
},
@@ -75,10 +83,49 @@ resource "sysdig_secure_custom_policy" "sample" {
7583
scope = "container.id != \"\""
7684
runbook = "https://sysdig.com"
7785
86+
rules {
87+
name = "sysdig_secure_rule_falco.termimal_shell_in_container"
88+
enabled = true
89+
}
90+
rules {
91+
name = sysdig_secure_rule_falco.terminal_shell.name
92+
enabled = true
93+
}
94+
95+
actions {
96+
container = "stop"
97+
capture {
98+
seconds_before_event = 5
99+
seconds_after_event = 10
100+
name = "testcapture"
101+
}
102+
}
103+
104+
notification_channels = [sysdig_secure_notification_channel_email.sample_email.id]
105+
}
106+
`, secureNotificationChannelEmailWithName(name), ruleFalcoTerminalShell(name), name, name)
107+
}
108+
109+
func customPolicyWithRulesOrderChange(name string) string {
110+
return fmt.Sprintf(`
111+
%s
112+
%s
113+
resource "sysdig_secure_custom_policy" "sample" {
114+
name = "TERRAFORM TEST 1 %s"
115+
description = "TERRAFORM TEST %s"
116+
enabled = true
117+
severity = 4
118+
scope = "container.id != \"\""
119+
runbook = "https://sysdig.com"
120+
78121
rules {
79122
name = sysdig_secure_rule_falco.terminal_shell.name
80123
enabled = true
81124
}
125+
rules {
126+
name = "sysdig_secure_rule_falco.termimal_shell_in_container"
127+
enabled = true
128+
}
82129
83130
actions {
84131
container = "stop"

0 commit comments

Comments
 (0)