-
Notifications
You must be signed in to change notification settings - Fork 50
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
Difficulty adding Exceptions to existing Falco rules #584
Comments
I don't know how feasible is to add single rule exceptions as resources in the terraform provider. The main reason is that the API does not support single exception creation throw API calls, they are added to existing rules. Terraform expects that each managed resource has CRUD endpoints to manage its lifetime. |
Thank you for the explanation, @tembleking. It initially made more sense to me to treat exceptions as independent resources to avoid needing to recreate the entire rule from scratch. However, I may have misunderstood how to create Falco rules using the provider. Could you clarify the process? Specifically:
When I try to use the Data Source for existing Falco rules, I noticed it doesn't return the exception values. Here’s an example of the output I’m getting:
The exceptions are shown in the Sysdig UI, so they do exist. This Falco rule is one already provided by the Sysdig Team. Is this expected behavior from the Terraform provider? Or is there additional configuration required to retrieve these exception values correctly? |
Regarding your questions:
You can
Yes, you can reference an existing rule using the sysdig_secure_rule_falco data source. If you need more help to understand how to do it, I can create a code example for you in terraform. |
There's already an example in the tests we have to validate the provider: terraform-provider-sysdig/sysdig/resource_sysdig_secure_rule_falco_test.go Lines 453 to 463 in fa105cf
|
A couple more examples: terraform-provider-sysdig/sysdig/resource_sysdig_secure_rule_falco_test.go Lines 526 to 536 in fa105cf
terraform-provider-sysdig/sysdig/resource_sysdig_secure_rule_falco_test.go Lines 555 to 565 in fa105cf
|
Description
It’s unclear how to add an exception to an existing Falco rule using the Sysdig Terraform provider. Currently, it seems that to add an exception to an existing Falco rule (e.g., "Delete DB Snapshot"), I need to create a new copy of the rule from scratch and then add the exception.
This process requires copying every field from the existing rule, which can lead to redundancy and makes it difficult to maintain parity with the rule updates provided by Sysdig. To simplify this, I attempted to use the sysdig_secure_rule_falco data source to extract the values from the existing rule and avoid hard-coding them.
Here's an example:
While this works for copying most of the rule's fields, I could not find a way to properly copy and reuse the exceptions block. This means I need to recreate the rule entirely, which feels cumbersome and counterintuitive.
Proposed Improvement
I suggest allowing exceptions to be managed as individual resources within the Terraform provider. This would enable referencing existing rules directly and appending or modifying their exceptions without duplicating the rule itself.
Advantages of This Approach
Example Usage
Here's how I envision managing exceptions as separate resources:
This would:
Questions
Let me know if additional details or clarifications are needed! Thank you!
The text was updated successfully, but these errors were encountered: