1 Resources knowledge_file
Forgejo Actions edited this page 2026-11-26 06:34:52 +00:00

openwebui_knowledge_file (Resource)

Attaches an uploaded file to a knowledge base. Destroying this resource detaches the file; set delete_file = true to also delete the underlying file.

Example Usage

resource "openwebui_file" "doc" {
  source_path = "${path.module}/files/faq.pdf"
  process     = true
}

resource "openwebui_knowledge" "faq" {
  name        = "Support FAQ"
  description = "Knowledge base backing the support chatbot"
}

resource "openwebui_knowledge_file" "example" {
  knowledge_id = openwebui_knowledge.faq.id
  file_id      = openwebui_file.doc.id
  delete_file  = true
}

Schema

Required

  • file_id (String) UUID of the file to attach (from openwebui_file.id). Forces replacement.
  • knowledge_id (String) UUID of the knowledge base to attach the file to. Forces replacement.

Optional

  • delete_file (Boolean) When true, the underlying file is deleted when this resource is destroyed. Defaults to false.

Read-Only

  • file_json (String) JSON metadata for the attached file as returned by Open WebUI: identifiers, filename, hash, size, and timestamps. The knowledge file listing never carries the file's extracted content.
  • id (String) Composite identifier in the form knowledge_id:file_id.

Import

Import is supported using the following syntax:

The terraform import command can be used, for example:

# The attachment of a file to a knowledge base has no identifier of its own, so
# the import id names both sides, separated by a colon.
terraform import openwebui_knowledge_file.example 7a1b2c3d-4e5f-4061-8273-9a0b1c2d3e4f:3b2d5c7a-1e4f-4b8c-9d0a-6f5e4d3c2b1a