Infrastructure Documentation¶
This section covers the infrastructure-as-code setup for Thoth.
Terraform Modules¶
The infrastructure is organized into three Terraform modules:
Module Structure¶
terraform/
├── main.tf # Root module configuration
├── variables.tf # Global variables
├── environments/
│ └── dev.tfvars # Development environment
├── shared/ # Shared resources module
├── mcp/ # MCP Server module
└── ingestion/ # Ingestion Worker module
MCP Module (terraform/mcp/)¶
Provisions the MCP Server Cloud Run service.
Resources¶
Resource |
Type |
Description |
|---|---|---|
|
Cloud Run |
MCP server service |
|
IAM |
Public access (if configured) |
Configuration¶
Variable |
Default |
Description |
|---|---|---|
|
|
CPU allocation |
|
|
Memory allocation |
|
|
Minimum instances |
|
|
Maximum instances |
Ingestion Module (terraform/ingestion/)¶
Provisions the Ingestion Worker and Cloud Tasks queue.
Resources¶
Resource |
Type |
Description |
|---|---|---|
|
Cloud Run |
Ingestion worker service |
|
Tasks |
Batch processing queue |
Configuration¶
Variable |
Default |
Description |
|---|---|---|
|
|
CPU allocation |
|
|
Memory allocation |
|
|
Max concurrent task dispatches |
|
|
Tasks per second |
Terraform Cloud Setup¶
The project uses Terraform Cloud for state management and remote execution.
Workspace Configuration¶
Setting |
Value |
|---|---|
Organization |
|
Workspace |
|
Execution Mode |
Remote |
Required Variables¶
Set these in Terraform Cloud workspace:
Variable |
Type |
Description |
|---|---|---|
|
Environment (sensitive) |
GCP service account JSON |
|
Terraform |
GCP project ID |
|
Terraform |
GCP region |
Generating Terraform Documentation¶
Use terraform-docs to generate module documentation:
# Install terraform-docs
brew install terraform-docs
# Generate docs for all modules
terraform-docs markdown table terraform/shared > docs/source/infrastructure/shared.md
terraform-docs markdown table terraform/mcp > docs/source/infrastructure/mcp.md
terraform-docs markdown table terraform/ingestion > docs/source/infrastructure/ingestion.md
terraform-docs Configuration¶
Add .terraform-docs.yml to each module:
formatter: markdown table
output:
file: README.md
mode: inject
sort:
enabled: true
by: required
settings:
indent: 2
escape: true
html: true