Skip to content

verbose partial rule output #216

Discussion options

You must be logged in to vote

Hi @stevend-15

There are couple things that would help here.

  1. To set a default value you can use the default keyword: Default Keyword
  2. Splitting some of the logic into helper functions.

I've shown this as an example here: https://play.openpolicyagent.org/p/IPLoeC7Awy

What would be more common, is to set a policy that compiles a list of deny messages, each one checking one specific piece of the input.

package play

deny[msg] {
    input.Resources[_].Type == "AWS::EC2::Subnet"
    msg := "type Subnet is not expected"
}

deny[msg] {
    input.Resources[_].Properties.MapPublicIpOnLaunch == false
    msg := "MapPublicIp is set to false"
}

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@stevend-15
Comment options

Answer selected by stevend-15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants