New to Kestra?
Use blueprints to kickstart your first workflows.
Audit AWS and Kubernetes against a central Open Policy Agent (OPA) policy on a schedule, then alert Slack on every violation, orchestrated in Kestra.
Run a recurring, cross-stack compliance audit that treats Open Policy Agent (OPA) as the single source of truth for what "compliant" means. This blueprint collects real configuration facts from AWS and Kubernetes, sends them to OPA as the input document for a central policy, and notifies Slack the moment the decision returns any violations. Instead of scattering compliance checks across cloud-native tools, IaC linters, and ad hoc scripts, you evaluate everything against one declarative policy and get a single, auditable verdict with a decision ID you can trace.
collect_aws runs io.kestra.plugin.aws.cli.AwsCLI to gather AWS facts, here listing S3 bucket names with aws s3api list-buckets.collect_k8s runs io.kestra.plugin.kubernetes.kubectl.Get with resourceType: deployments and fetchType: FETCH to pull the Deployments in the audited namespace (inputs.k8s_namespace, default production).evaluate runs io.kestra.plugin.ee.opa.policy.Evaluate against policyPath (inputs.opa_policy_path, default compliance/violations), passing the collected facts as the OPA input document.alert_on_violations is an io.kestra.plugin.core.flow.If that checks whether outputs.evaluate.result is non-empty and, when it is, runs notify_violations to post a summary and the OPA decisionId to Slack via io.kestra.plugin.slack.notifications.SlackIncomingWebhook.io.kestra.plugin.core.trigger.Schedule trigger (daily_audit, cron 0 7 * * *, shipped disabled) runs the audit every morning once you enable it.decisionId for every evaluation when OPA decision logging is on.OPA evaluates policy but does not schedule, gather facts, or notify on its own. Kestra fills that gap: an event or schedule trigger drives the audit, retries handle transient AWS or Kubernetes API failures, and full execution lineage records exactly which facts produced which decision. The entire pipeline is declarative YAML you can version, review, and reuse, so the fact collection, policy evaluation, and alerting live together instead of in disconnected cron jobs and scripts.
AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, AWS_DEFAULT_REGION: AWS access for the CLI step.K8S_MASTER_URL, K8S_TOKEN: Kubernetes API access for kubectl.OPA_URL, OPA_TOKEN: OPA server URL and token (set via pluginDefaults).SLACK_WEBHOOK_URL: Slack incoming webhook URL.opa_policy_path) returns a violations array.k8s_namespace to the namespace you want to audit.daily_audit trigger to run it on a schedule.aws CLI calls) or other kubectl resource types as your policy grows.input.If condition and Slack payload to match your policy's output shape.