feat: Add detection resources (Rule, Policy, ScheduledRule, SimpleRule) #67
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.
Background
This PR adds support for managing all four types of Panther detections as Terraform resources. This is part of breaking up the larger PR (#59) into smaller, more focused PRs as requested in the review feedback at #59 (comment).
Changes
This PR implements all four detection resource types available in Panther:
1. Rule Resource (
panther_rule)log_typesarray to specify which logs to analyzebodyfield contains the rule logic2. Policy Resource (
panther_policy)resource_typesarray to specify which resources to checkbodyfield contains the policy logic3. ScheduledRule Resource (
panther_scheduled_rule)scheduled_queriesarray instead of log_typesbodyfield evaluates aggregated query results4. SimpleRule Resource (
panther_simple_rule)detectionfield with YAML syntax (compiles to Python automatically)log_typeslike standard Rulepython_bodyfield shows compiled Python codeImplementation Details
REST Client Implementation:
/rules,/policies,/scheduled-rules,/simple-rulesGenerated Schema:
Configuration Files:
generator_config.ymlto include all detection resourcesprovider-code-spec.jsonwith all schemasComprehensive Documentation:
Test Coverage:
Testing
go buildsuccessfulPANTHER_API_URLandPANTHER_API_TOKEN)Related
Part of breaking up #59 into focused PRs:
AI Usage
This PR was developed with assistance from Claude Code for: