Examples of IaC custom rules
Example of a simple boolean rule
resource "aws_redshift_cluster" "denied" {
cluster_identifier = "tf-redshift-cluster"
node_type = "dc1.large"
tags = {
}
}package rules
deny[msg] {
resource := input.resource.aws_redshift_cluster[name]
not resource.tags.owner
msg := {
"publicId": "CUSTOM-RULE-1",
"title": "Missing an owner from tag",
"severity": "medium",
"msg": sprintf("input.resource.aws_redshift_cluster[%s].tags", [name]),
"issue": "",
"impact": "",
"remediation": "",
"references": [],
}
}Example with logical AND
Example with logical OR
Example with strings
Example with XOR
Type
Email
ServiceDescription
Examples with grouped resources
Last updated
Was this helpful?

