@@ -67,6 +67,7 @@ func resourceSysdigSecureVulnerabilityPolicy() *schema.Resource {
6767 "pipeline" ,
6868 "registry" ,
6969 "runtime" ,
70+ "admission_control" ,
7071 }, false )),
7172 },
7273 "configuration" : {
@@ -79,6 +80,18 @@ func resourceSysdigSecureVulnerabilityPolicy() *schema.Resource {
7980 Required : true ,
8081 Description : "Scope expression for this stage" ,
8182 },
83+ "failure_action" : {
84+ Type : schema .TypeString ,
85+ Optional : true ,
86+ Description : "Required for `admission_control` stage only. Policy Failure Action. What should happen if the policy fails (aka: there's a rule vioation)" ,
87+ ValidateFunc : validation .StringInSlice ([]string {"reject" , "warn" }, false ),
88+ },
89+ "unknown_image_action" : {
90+ Type : schema .TypeString ,
91+ Optional : true ,
92+ Description : "Required for `admission_control` stage only. Unknown Image Action. What should happen if the image is unknown." ,
93+ ValidateFunc : validation .StringInSlice ([]string {"reject" , "rejectAndScan" , "warn" }, false ),
94+ },
8295 },
8396 },
8497 },
@@ -193,6 +206,14 @@ func vulnerabilityPolicyStagesToMap(policyStages []v2.Stage) []map[string]any {
193206 newConfig := map [string ]any {
194207 "scope" : stageconfig .Scope ,
195208 }
209+
210+ if stageconfig .Behaviour != "" {
211+ newConfig ["failure_action" ] = stageconfig .Behaviour
212+ }
213+
214+ if stageconfig .UnknownImageAction != "" {
215+ newConfig ["unknown_image_action" ] = stageconfig .UnknownImageAction
216+ }
196217 configsMap = append (configsMap , newConfig )
197218 }
198219
@@ -297,7 +318,11 @@ func vulnerabilityPolicyConfigsFromSet(set *schema.Set) []v2.Configuration {
297318 for _ , raw := range set .List () {
298319 rawMap := raw .(map [string ]any )
299320
300- out = append (out , v2.Configuration {Scope : rawMap ["scope" ].(string )})
321+ out = append (out , v2.Configuration {
322+ Scope : rawMap ["scope" ].(string ),
323+ Behaviour : rawMap ["failure_action" ].(string ),
324+ UnknownImageAction : rawMap ["unknown_image_action" ].(string ),
325+ })
301326 }
302327
303328 return out
0 commit comments