Skip to content

Streams support POC#1473

Draft
rStelmach wants to merge 3 commits intomainfrom
feat/streams-poc
Draft

Streams support POC#1473
rStelmach wants to merge 3 commits intomainfrom
feat/streams-poc

Conversation

@rStelmach
Copy link
Copy Markdown

Summary

Add a new elasticstack_kibana_stream Terraform resource backed by the main kbapi Kibana client, plus a small internal condition model and Streams API helpers, to validate the first end‑to‑end integration between Terraform and Streams.
This POC focuses on group streams, base‑stream creation, and a read‑only view of ingest, without committing yet to a final public Terraform schema for all Streams features.

What this PR changes

  • Streams API helpers (internal/clients/kibana_oapi/streams.go)

    • Wrap the existing kbapi.ClientWithResponses on top of the Kibana HTTP client.
    • Provide focused helpers for:
      • EnableStreams / DisableStreams (POST /api/streams/_enable|_disable),
      • GetStreamJSON, PutStreamRaw, DeleteStream (with the "Expected undefined, received null" quirk handled),
      • GetStreamIngestJSON / PutStreamIngest,
      • GetStreamGroupJSON / PutStreamGroup.
  • New Terraform resource: elasticstack_kibana_stream (internal/kibana/streams)

    • Registered in provider/plugin_framework.go via streams.NewResource.
    • Schema + models:
      • Top‑level: id, name, space_id, description, type, create_if_missing.
      • group { members, metadata, tags } – managed via /api/streams/{name}/_group.
      • ingest { type } – computed, read‑only from /api/streams/{name}/_ingest in this POC.
    • CRUD behavior:
      • Group streams: optionally create the base stream, upsert _group, round‑trip members/metadata/tags, and delete via DELETE /api/streams/{name} with quirks handled.
      • Ingest streams: read‑only (Terraform reads _ingest but does not write it yet) .
  • Internal condition expression model (internal/kibana/streams/conditions.go)

    • Small internal tree (Condition, FieldComparison, And, Or) plus MarshalCondition helper.
    • Unit tests in conditions_test.go verify JSON output for simple and nested trees.

Testing

Kibana's side :

  • generate logs

Terraform side

  • Unit tests:
    • go test ./internal/kibana/streams/... (condition model + flatten/expand helpers).
  • Manual POC validation:
    • Adjust kibana url in new main.tf
    • Build the provider: make build.
    • cd streams then run:
      • terraform init
      • terraform apply
    • Confirm:
      • Group streams: base stream creation via create_if_missing = true, _group upsert, and round‑trip of members / metadata / tags.
      • Ingest streams: read‑only ingest behavior (ingest.type populated from _ingest, no writes to _ingest).

@rStelmach rStelmach changed the title Feat/streams poc Streams support POC Nov 21, 2025
@insukcho
Copy link
Copy Markdown

insukcho commented Mar 9, 2026

@rStelmach Do we have any progress on this feature? This is critical for us to begin wide adoption of the new capabilities introduced by steams.

@CoenWarmer
Copy link
Copy Markdown
Contributor

@rStelmach Do we have any progress on this feature? This is critical for us to begin wide adoption of the new capabilities introduced by steams.

Hi @insukcho, we're awaiting a few PRs to be merged on the Kibana side. Once they're in we will Terraform support for Streams merged very soon!

@rStelmach
Copy link
Copy Markdown
Author

@insukcho Unfortunately we had to put this on hold as we needed to do some changes in Streams OpenAPI spec

Right now as @CoenWarmer mentioned, it's in progress. We will keep you updated 🙂
cc: @flash1293 @LucaWintergerst

@insukcho
Copy link
Copy Markdown

@CoenWarmer @rStelmach https://github.com/elastic/streams-program/issues/683 has been merged a month ago! Are we resuming this issue now? Any rough ETA I can share to the customer?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants