Skip to content
Merged
Show file tree
Hide file tree
Changes from 37 commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
4fc1308
Add security exception item resource
nick-benoit Nov 27, 2025
55c730b
Merge branch 'main' of github.com:elastic/terraform-provider-elastics…
nick-benoit Dec 1, 2025
807c6a3
Add resource to provider
nick-benoit Dec 1, 2025
0859414
Refactor to handle new exception client helper api
nick-benoit Dec 1, 2025
a2a4fbe
Merge branch 'main' of github.com:elastic/terraform-provider-elastics…
nick-benoit Dec 1, 2025
ae4fa04
Extract create / update request building to helper in models.go
nick-benoit Dec 1, 2025
cf369c6
Refactor to adhere to coding standards
nick-benoit Dec 1, 2025
ae3bcd8
Update coding standards to include typeutils
nick-benoit Dec 1, 2025
7d3df78
Add example
nick-benoit Dec 1, 2025
887793f
Fix tests for tags as set
nick-benoit Dec 1, 2025
308efad
Extract comment schema into helper
nick-benoit Dec 1, 2025
58c4fb7
Simplify os_types handling
nick-benoit Dec 1, 2025
00f815d
Add complex usage test
nick-benoit Dec 1, 2025
2f006fa
Add import test
nick-benoit Dec 1, 2025
d307795
Add check destroy to tests
nick-benoit Dec 1, 2025
1b8528f
Add resource testing standards
nick-benoit Dec 1, 2025
31b2ce5
Use utils.isKnown
nick-benoit Dec 1, 2025
f418a73
Refactor type specific handler into their own functions
nick-benoit Dec 1, 2025
b9a7935
Remove unfinished entry from CODING_STANDARDS
nick-benoit Dec 1, 2025
7123e60
Fix coding standards header
nick-benoit Dec 1, 2025
4034088
Cleanup extraneous null checks
nick-benoit Dec 1, 2025
53fa7c3
Fix tests
nick-benoit Dec 1, 2025
6f7f6f2
Add compId
nick-benoit Dec 1, 2025
f13df88
Add expire_time to test
nick-benoit Dec 1, 2025
ddebd35
Remove consolidated test
nick-benoit Dec 1, 2025
f228296
Support agnostic namespace
nick-benoit Dec 1, 2025
df0dfca
Add version gate
nick-benoit Dec 2, 2025
576c37f
Supprt version check for older kibanas
nick-benoit Dec 2, 2025
c146df6
Only set expire_time for supporting versions
nick-benoit Dec 2, 2025
08d9cc5
Fmt
nick-benoit Dec 2, 2025
a2566cc
Remove expire_time from basic test
nick-benoit Dec 2, 2025
4e4b02d
Add custom time serialization
nick-benoit Dec 2, 2025
bba11b9
Run tests with 8.7.2
nick-benoit Dec 2, 2025
6159792
Skip tests for 8.7.1
nick-benoit Dec 2, 2025
dda7bf1
Add basic usage spec
nick-benoit Dec 2, 2025
0652bf9
Add tests for all nested types
nick-benoit Dec 2, 2025
2ae421d
Refactor nested item handling to take references
nick-benoit Dec 2, 2025
bfc3557
Update internal/kibana/security_exception_item/update.go
nick-benoit Dec 2, 2025
321987a
Update internal/kibana/security_exception_item/create.go
nick-benoit Dec 2, 2025
2936a3d
Update CODING_STANDARDS.md
nick-benoit Dec 2, 2025
23f2de2
Update CODING_STANDARDS.md
nick-benoit Dec 2, 2025
f7fd99e
Update os_types handling
nick-benoit Dec 2, 2025
a4da71b
Extract shared code to setCommonProps
nick-benoit Dec 2, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions CODING_STANDARDS.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ This document outlines the coding standards and conventions used in the terrafor
- Prefer using existing util functions over longer form, duplicated code:
- `utils.IsKnown(val)` instead of `!val.IsNull() && !val.IsUnknown()`
- `utils.ListTypeAs` instead of `val.ElementsAs` or similar for other collection types
- `typeutils.StringishValue` instead of casting to a string eg `types.StringValue(string(apiResp.Id))`. Use `typeutils.StringishPointerValue` for pointers
- The final state for a resource should be derived from a read request following a mutative request (eg create or update). We should not use the response from a mutative request to build the final resource state.

## Schema Definitions
Expand Down Expand Up @@ -75,6 +76,12 @@ This document outlines the coding standards and conventions used in the terrafor
- Define any required variables within the module
- Reference the test code via `ConfigDirectory: acctest.NamedTestCaseDirectory("<step description>")`
- Define any required variables via `ConfigVariables`
- Resources should include tests for the following
- Creating a resource
- Updating a resource
- Deleting a resource
- Importing a resource
- Creating a resoure in another space (if applicable)

## API Client Usage

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
resource "elasticstack_kibana_security_exception_list" "example" {
list_id = "my-exception-list"
name = "My Exception List"
description = "List of exceptions"
type = "detection"
namespace_type = "single"
}

resource "elasticstack_kibana_security_exception_item" "complex_entry" {
list_id = elasticstack_kibana_security_exception_list.example.list_id
item_id = "complex-exception"
name = "Complex Exception with Multiple Entries"
description = "Exception with multiple conditions"
type = "simple"
namespace_type = "single"

# Multiple entries with different operators
entries = [
{
type = "match"
field = "host.name"
operator = "included"
value = "trusted-host"
},
{
type = "match_any"
field = "user.name"
operator = "excluded"
values = ["admin", "root"]
}
]

os_types = ["linux"]
tags = ["complex", "multi-condition"]
}

10 changes: 5 additions & 5 deletions generated/kbapi/kibana.gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions generated/kbapi/transform_schema.go
Original file line number Diff line number Diff line change
Expand Up @@ -870,6 +870,7 @@ func transformKibanaPaths(schema *Schema) {
},
"propertyName": "action_type_id",
})
schema.Components.Delete("schemas.Security_Exceptions_API_ExceptionListItemExpireTime.format")

}

Expand Down
4 changes: 3 additions & 1 deletion internal/clients/api_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -451,7 +451,9 @@ func (a *ApiClient) flavorFromKibana() (string, diag.Diagnostics) {

serverFlavor, ok := vMap["build_flavor"].(string)
if !ok {
return "", diag.Errorf("failed to get build flavor from Kibana status")
// build_flavor field is not present in older Kibana versions (pre-serverless)
// Default to empty string to indicate traditional/stateful deployment
return "", nil
}

return serverFlavor, nil
Expand Down
Loading