CtrlK
BlogDocsLog inGet started
Tessl Logo

nicholasjackson/opa-rego-language

Rego is the declarative policy language used by Open Policy Agent (OPA). This tile covers writing and testing Rego policies for Kubernetes admission control, Terraform and infrastructure-as-code plan validation, Docker container authorization, HTTP API authorization, RBAC and role-based access control, data filtering, metadata annotations with opa inspect, and OPA policy testing with opa test.

99

1.19x

Quality

Pending

Does it follow best practices?

Impact

99%

1.19x

Average score across 31 eval scenarios

SecuritybySnyk

Pending

The risk profile of this skill

Overview
Eval results
Files

task.mdevals/scenario-24/

Regal: Comprehensions — Tag Compliance Policy

Write a Rego policy in the package terraform.compliance that validates a Terraform resource's tags. The policy should:

  1. Use object.keys(input.resource.tags) to get the set of provided tag keys (not a comprehension)
  2. Define required_tags as {"environment", "owner", "cost_center"}
  3. Compute missing_tags using set subtraction
  4. Add a deny violation when any required tags are missing, using sprintf to list the missing tags

Input

{
  "resource": {
    "type": "aws_instance",
    "name": "web-server",
    "tags": {
      "environment": "production",
      "owner": "platform-team"
    }
  }
}

Expected behaviour

  • All tags present → no deny violations
  • Missing cost_center tag → deny message listing {"cost_center"}
  • Empty tags → deny listing all three required tags

README.md

rules.md

tile.json