-
Couldn't load subscription status.
- Fork 122
Add Support for Kibana Security Detection Rules #1291
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Co-authored-by: nick-benoit <[email protected]>
Co-authored-by: nick-benoit <[email protected]>
This comment was marked as outdated.
This comment was marked as outdated.
…sive tests - Replace custom HTTP client with generated kbapi client from /generated/kbapi - Update transform_schema.go to include detection_engine/rules API endpoints - Regenerate Kibana client with detection rules API support - Handle proper type conversions for SecurityDetections API types - Add UUID handling for rule IDs using github.com/google/uuid - Expand acceptance tests to cover Create, Read, Update, and Delete operations - Add import state verification test Co-authored-by: nick-benoit <[email protected]>
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
|
|
||
| Creates or updates a Kibana security detection rule. See https://www.elastic.co/guide/en/security/current/rules-api-create.html | ||
|
|
||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add a terraform usage example
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
| func CreateSecurityDetectionRule(ctx context.Context, client *clients.ApiClient, spaceId string, rule *SecurityDetectionRuleRequest) (*SecurityDetectionRuleResponse, diag.Diagnostics) { | ||
| var diags diag.Diagnostics | ||
|
|
||
| kbClient, err := client.GetKibanaClient() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use GetKibanaOapiClient instead of GetKibanaClient
This comment was marked as outdated.
This comment was marked as outdated.
|
@copilot please review open PR comments |
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
|
@copilot Review open comments |
|
@nick-benoit Unfortunately I hit an unexpected error while processing your comment. I've automatically reported this to GitHub. You can ask me to try again later by mentioning me in a new comment. If you want to contact GitHub about this error, please mention the following identifier so they can better serve you: Sorry for the inconvenience! |
|
@nick-benoit do we close this one down? |
|
@tobio Unfortunately I hit an unexpected error while processing your comment. I've automatically reported this to GitHub. You can ask me to try again later by mentioning me in a new comment. If you want to contact GitHub about this error, please mention the following identifier so they can better serve you: Sorry for the inconvenience! |
This PR implements support for managing Kibana Security Detection Rules through the new
elasticstack_kibana_security_detection_ruleresource. This addresses the need for Infrastructure as Code management of security detection rules in Kibana.Overview
The implementation provides a complete Terraform Plugin Framework resource that supports full CRUD operations for Kibana Security Detection Rules. The resource follows the established patterns in the provider and integrates with the existing Kibana client infrastructure using the generated API client.
Key Features
Comprehensive Schema: Supports all major detection rule attributes including:
Multiple Rule Types: Supports all Kibana security rule types:
query- KQL/Lucene query-based ruleseql- Event Query Language rulesmachine_learning- ML-based anomaly detectionthreshold- Threshold-based rulesthreat_match- Threat intelligence matchingnew_terms- New terms detectionSpace-Aware Operations: Properly handles Kibana spaces with composite ID management
Plugin Framework Implementation: Built using the modern Terraform Plugin Framework, consistent with other new resources in the provider
Generated API Client Integration: Uses the generated Kibana API client from
/generated/kbapifor consistent and type-safe API interactionsImplementation Details
API Integration
The resource integrates with Kibana's Security Detection Rules API using the generated client:
The implementation leverages the
SecurityDetectionsAPItypes from the generated client for proper type safety and validation.Example Usage
Directory Structure
The implementation follows the established pattern for Plugin Framework resources:
Testing
The implementation includes:
Documentation
Auto-generated documentation is included following the provider's documentation standards, providing comprehensive attribute descriptions and usage examples.
Fixes #1290.
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.