Repository navigation
Add kernel_audit_log_export_destination resource - #120
Merged
sjmiller609 merged 2 commits intoNov 6, 2026
Merged
Conversation
Manage the org-scoped S3 audit-log export destination: bucket, region, prefix, role_arn, optional kms_key_id and status, with computed external_id and kernel_role_arn for the role's trust policy. Delivery health fields stay out of state. Import by canonical ID.
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Want higher recall? High effort reviews run extra passes and find more bugs. A team admin can switch effort levels in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 32752b9. Configure here.
sjmiller609
self-requested a review
November 5, 2026 20:28
sjmiller609
reviewed
Nov 5, 2026
sjmiller609
left a comment
Contributor
There was a problem hiding this comment.
Looks good, just asking to apply this patch, then we can get it in. Thank you!
sjmiller609
approved these changes
Nov 6, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Summary
Adds a
kernel_audit_log_export_destinationresource for the org-level S3 destination that Kernel continuously exports audit logs to.bucket,region,prefix,role_arn(required); optionalkms_key_idandstatus(active/paused);type(s3) andformat(jsonl.gz) default and force replacement; computedid,external_id, andkernel_role_arn. Import by canonical ID.external_idandkernel_role_arnare exposed so the customer role's trust policy can be built in the same configuration. The example outputs that trust policy.status = "paused", attach the trust policy, verify access, then setstatus = "active"and apply again. A destination configured asactiveat create time is created and then activated; if activation fails, the created destination stays in state with an error explaining how to finish without replacement.prefix; the configured spelling is kept in state when equivalent.statusleaves it unmanaged, so a new destination stays paused. Removingkms_key_idsends"", which the API treats as clearing the key.consecutive_failures,last_error*,last_exported_cursor,last_success_at,next_attempt_at) stay out of state to avoid drift. Audit-log search, chunk download, and the destination test endpoint stay out of the client, and a test guards that.AuditLogExportDestinationServiceis already in v0.99.0.docs/architecture.mdnarrows the audit-log non-goal: search and download remain out of scope; durable export configuration is in.KERNEL_AUDIT_EXPORT_BUCKET,KERNEL_AUDIT_EXPORT_REGION, andKERNEL_AUDIT_EXPORT_ROLE_ARN. Locally the test skips when they are unset.Testing
go test -short ./...,go vet ./..., gofmt,terraform fmt -check -recursive examples,scripts/check-examples.sh,scripts/check-docs.sh, andscripts/check-markdown-links.shpass locally.TestAccAuditLogExportDestinationLifecyclehas not been run against a live API yet. It needs an S3 bucket and a role that trusts Kernel. Two behaviours it should confirm:kms_key_id(alias to ARN, for example), which would show as a perpetual diff;statuson its own (for example auto-pausing after repeated failures), which would show as drift whenstatusis set in configuration.Note
Medium Risk
Introduces org-level configuration for audit log export and AWS cross-account role assumptions; incorrect trust or activation timing could block delivery, though scope is limited to durable destination CRUD with extensive tests.
Overview
Adds
kernel_audit_log_export_destination, a fourth managed resource for org-scoped continuous audit-log export to S3 via a customer IAM role. Terraform exposes computedexternal_idandkernel_role_arn(the example outputs a trust policy), supports optionalstatus(active/paused) with a create-then-activate flow when Kernel returns destinations paused, and import by canonical ID.type/formatdefault and force replacement; delivery-health API fields stay out of state; runtime audit APIs remain excluded from the client.Wires
AuditLogExportDestinationServicethroughkernelclient, registers the resource on the provider, and extends docs, README, architecture boundaries, an example, and acceptance/release checklists. CI gains an eighth acceptance matrix job with required secretsKERNEL_AUDIT_EXPORT_*; local acceptance skips when those are unset.Reviewed by Cursor Bugbot for commit 24fd75d. Bugbot is set up for automated code reviews on this repo. Configure here.