@@ -121,11 +121,7 @@ func commonPolicyToResourceData(policy *v2.Policy, d *schema.ResourceData) {
121121
122122 actions := []map [string ]interface {}{{}}
123123 for _ , action := range policy .Actions {
124- if action .Type != "POLICY_ACTION_CAPTURE" {
125- action := strings .Replace (action .Type , "POLICY_ACTION_" , "" , 1 )
126- actions [0 ]["container" ] = strings .ToLower (action )
127- // d.Set("actions.0.container", strings.ToLower(action))
128- } else {
124+ if action .Type == "POLICY_ACTION_CAPTURE" {
129125 actions [0 ]["capture" ] = []map [string ]interface {}{{
130126 "seconds_after_event" : action .AfterEventNs / 1000000000 ,
131127 "seconds_before_event" : action .BeforeEventNs / 1000000000 ,
@@ -134,6 +130,12 @@ func commonPolicyToResourceData(policy *v2.Policy, d *schema.ResourceData) {
134130 "bucket_name" : action .BucketName ,
135131 "folder" : action .Folder ,
136132 }}
133+
134+ } else if action .Type == "POLICY_ACTION_KILL_PROCESS" {
135+ actions [0 ]["kill_process" ] = true
136+ } else {
137+ action := strings .Replace (action .Type , "POLICY_ACTION_" , "" , 1 )
138+ actions [0 ]["container" ] = strings .ToLower (action )
137139 }
138140 }
139141
@@ -214,6 +216,11 @@ func addActionsToPolicy(d *schema.ResourceData, policy *v2.Policy) {
214216 policy .Actions = append (policy .Actions , v2.Action {Type : "POLICY_ACTION_PREVENT_MALWARE" })
215217 }
216218
219+ killProcessAction , ok := d .GetOk ("actions.0.kill_process" )
220+ if ok && killProcessAction .(bool ) {
221+ policy .Actions = append (policy .Actions , v2.Action {Type : "POLICY_ACTION_KILL_PROCESS" })
222+ }
223+
217224 containerAction := d .Get ("actions.0.container" ).(string )
218225 if containerAction != "" {
219226 containerAction = strings .ToUpper ("POLICY_ACTION_" + containerAction )
0 commit comments