@@ -3,6 +3,10 @@ package kms.policy
33import input as tfplan
44import rego.v1
55
6+ # Global variables
7+ required_tags := {" environment" , " owner" , " data-classification" }
8+ max_del_days := 30
9+
610# Rule 1: Check mandatory tags
711deny contains msg if {
812 # Iterate over all resources
@@ -14,7 +18,6 @@ deny contains msg if {
1418 " create" in resource.change.actions
1519
1620 # --- Logic ---
17- required_tags := {" environment" , " owner" , " data-classification" }
1821 provided_tags := object.get (resource.change.after, " tags" , {})
1922 provided_keys := object.keys (provided_tags)
2023 missing_tags := required_tags - provided_keys
@@ -49,9 +52,8 @@ deny contains msg if {
4952 # --- Logic ---
5053 deletion_window := object.get (resource.change.after, " deletion_window_in_days" , null )
5154
52- # If deletion_window less then 7 or not a number
53- # not is_number(deletion_window)
54- deletion_window < 30
55+ # If deletion_window less then max_del_days
56+ deletion_window < max_del_days
5557 msg := sprintf (
5658 " KMS key '%s' deletion window must be at least 30 days, but is set to %v." ,
5759 [resource.address, deletion_window],
0 commit comments