Skip to content

Commit 7accde3

Browse files
author
Arnas Navašinskas
committed
Make fields supporting a single value optional, final cleanup
1 parent b2f5938 commit 7accde3

File tree

5 files changed

+7
-12
lines changed

5 files changed

+7
-12
lines changed

castai/resource_security_runtime_rule.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@ var supportedSeverities = []string{
4242

4343
var supportedRuleEngineTypes = []string{
4444
string(sdk.RULEENGINETYPECEL),
45-
string(sdk.RULEENGINETYPEGO),
4645
}
4746

4847
var rulesPageLimit = "50"
@@ -82,8 +81,9 @@ func resourceSecurityRuntimeRule() *schema.Resource {
8281
},
8382
FieldRuntimeRuleCategory: {
8483
Type: schema.TypeString,
85-
Required: true,
84+
Optional: true,
8685
Description: "Category of the rule.",
86+
Default: "event",
8787
ForceNew: true, // update is not supported
8888
},
8989
FieldRuntimeRuleSeverity: {
@@ -105,9 +105,10 @@ func resourceSecurityRuntimeRule() *schema.Resource {
105105
},
106106
FieldRuntimeRuleRuleEngineType: {
107107
Type: schema.TypeString,
108-
Required: true,
109-
Description: "The engine type used to evaluate the rule. One of RULE_ENGINE_TYPE_CEL, RULE_ENGINE_TYPE_GO.",
108+
Optional: true,
109+
Description: "The engine type used to evaluate the rule. Only RULE_ENGINE_TYPE_CEL is currently supported.",
110110
ValidateDiagFunc: validation.ToDiagFunc(validation.StringInSlice(supportedRuleEngineTypes, true)),
111+
Default: sdk.RULEENGINETYPECEL,
111112
ForceNew: true, // update is not supported
112113
},
113114
FieldRuntimeRuleResourceSelector: {

docs/resources/security_runtime_rule.md

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

examples/aks/aks_cluster_with_security_runtime_rules/castai_runtime_rules.tf

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,11 @@
33

44
resource "castai_security_runtime_rule" "example_rule__dns_to_crypto_mining_" {
55
name = "Example rule AKS: DNS to crypto mining"
6-
category = "event"
76
severity = "SEVERITY_LOW"
87
enabled = false
98
rule_text = <<EOT
109
event.type == event_dns && event.dns.network_details.category == category_crypto
1110
EOT
12-
rule_engine_type = "RULE_ENGINE_TYPE_CEL"
1311
resource_selector = <<EOT
1412
resource.namespace == "default"
1513
EOT

examples/eks/eks_cluster_with_security_runtime_rules/castai_runtime_rules.tf

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,11 @@
33

44
resource "castai_security_runtime_rule" "example_rule__dns_to_crypto_mining_" {
55
name = "Example rule: DNS to crypto mining"
6-
category = "event"
76
severity = "SEVERITY_LOW"
87
enabled = false
98
rule_text = <<EOT
109
event.type == event_dns && event.dns.network_details.category == category_crypto
1110
EOT
12-
rule_engine_type = "RULE_ENGINE_TYPE_CEL"
1311
resource_selector = <<EOT
1412
resource.namespace == "default"
1513
EOT

examples/gke/gke_cluster_with_security_runtime_rules/castai_runtime_rules.tf

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,11 @@
33

44
resource "castai_security_runtime_rule" "example_rule__dns_to_crypto_mining_" {
55
name = "Example rule: DNS to crypto mining"
6-
category = "event"
76
severity = "SEVERITY_LOW"
87
enabled = false
98
rule_text = <<EOT
109
event.type == event_dns && event.dns.network_details.category == category_crypto
1110
EOT
12-
rule_engine_type = "RULE_ENGINE_TYPE_CEL"
1311
resource_selector = <<EOT
1412
resource.namespace == "default"
1513
EOT

0 commit comments

Comments
 (0)