Skip to content

Commit c25ced8

Browse files
authored
feat: Add runbook to policy resource (#213)
1 parent cdb79e1 commit c25ced8

File tree

5 files changed

+14
-3
lines changed

5 files changed

+14
-3
lines changed

CODEOWNERS

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,9 @@
44
# compliance
55
*benchmark* @haresh-suresh @nkraemer-sysdig
66

7-
87
# monitor
9-
*monitor*dashboard* @brokenpip3
108
*monitor*alert* @arturodilecce
9+
*monitor*dashboard* @brokenpip3
1110

11+
# policies/rules
12+
*secure*policy* @jacklongsd @kmvachhani @rbaderts

sysdig/internal/client/secure/models.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ type Policy struct {
2020
Version int `json:"version,omitempty"`
2121
NotificationChannelIds []int `json:"notificationChannelIds"`
2222
Type string `json:"type"`
23+
Runbook string `json:"runbook"`
2324
}
2425

2526
type Action struct {

sysdig/resource_sysdig_secure_policy.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,10 @@ func resourceSysdigSecurePolicy() *schema.Resource {
8282
Type: schema.TypeInt,
8383
},
8484
},
85+
"runbook": {
86+
Type: schema.TypeString,
87+
Optional: true,
88+
},
8589
"actions": {
8690
Type: schema.TypeList,
8791
Optional: true,
@@ -150,6 +154,7 @@ func policyToResourceData(policy *secure.Policy, d *schema.ResourceData) {
150154
_ = d.Set("enabled", policy.Enabled)
151155
_ = d.Set("version", policy.Version)
152156
_ = d.Set("severity", policy.Severity)
157+
_ = d.Set("runbook", policy.Runbook)
153158
if policy.Type != "" {
154159
_ = d.Set("type", policy.Type)
155160
} else {
@@ -187,6 +192,7 @@ func policyFromResourceData(d *schema.ResourceData) secure.Policy {
187192
Severity: d.Get("severity").(int),
188193
Enabled: d.Get("enabled").(bool),
189194
Type: d.Get("type").(string),
195+
Runbook: d.Get("runbook").(string),
190196
}
191197

192198
scope := d.Get("scope").(string)

sysdig/resource_sysdig_secure_policy_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ resource "sysdig_secure_policy" "sample" {
7474
severity = 4
7575
scope = "container.id != \"\""
7676
rule_names = [sysdig_secure_rule_falco.terminal_shell.name]
77+
runbook = "https://sysdig.com"
7778
7879
actions {
7980
container = "stop"

website/docs/r/secure_policy.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@ resource "sysdig_secure_policy" "write_apt_database" {
2020
description = "an attempt to write to the dpkg database by any non-dpkg related program"
2121
severity = 4
2222
enabled = true
23-
23+
runbook = "https://runbook.com
24+
2425
// Scope selection
2526
scope = "container.id != \"\""
2627
@@ -53,6 +54,7 @@ resource "sysdig_secure_policy" "write_apt_database" {
5354

5455
* `type` - (Optional) Specifies the type of the runtime policy. Must be one of: `falco`, `list_matching`, `k8s_audit`, `aws_cloudtrail`. By default it is `falco`.
5556

57+
* `runbook` - (Optional) Customer provided url that provides a runbook for a given policy.
5658
- - -
5759

5860
### Scope selection

0 commit comments

Comments
 (0)