terraform-provider-stackgen

sg_knowledge_document (Resource)

⚠️ Experimental — This resource is part of the Guild platform and may change in future releases.

Manages a knowledge document ingested into the Guild knowledge hub. The provider downloads source_url, uploads the file to Guild, then the server parses it via Docling, chunks it, and indexes it for semantic search by agents. Use knowledge_base_id to target a user-defined base from sg_knowledge_base.

Example Usage

# The provider downloads from source_url and uploads bytes to Guild for indexing.
resource "sg_knowledge_document" "example" {
  source_url = "https://example.com/docs/runbook.pdf"
}
# Optional knowledge_base_id targets a user base; omit to use the built-in organization default.
resource "sg_knowledge_document" "into_base" {
  source_url        = "https://example.com/docs/runbook.pdf"
  knowledge_base_id = sg_knowledge_base.example.id
}

Import

Import an existing sg_knowledge_document using its document UUID or document_id source_url:
terraform import sg_knowledge_document.example '123e4567-e89b-12d3-a456-426614174000|https://example.com/runbook.md'

Prefer document_id|source_url so HCL source_url matches state after import.

Operational notes

Guild does not return the original Terraform source_url. Prefer import ID document_id|source_url so the first plan does not force replacement. Document bytes cannot be reconstructed from the API.

Schema

Required

Optional

Read-Only