agnes-the-ai-analyst/infra/examples/minimal/main.tf
ZdenekSrotyr a2c05a5d97 infra: refactor Terraform into reusable customer-instance module
Breaking changes:
- infra/main.tf, variables.tf, outputs.tf, terraform.tfvars.example removed
- Single-file monolith replaced by reusable module + example

New structure:
- infra/modules/customer-instance/ — the module:
  - main.tf: VMs, disks, firewall, Secret Manager, dedicated VM SA
  - variables.tf: prod_instance + dev_instances flexible schema
  - outputs.tf: IPs, SA email, JWT secret reference
  - startup-script.sh.tpl: bootstraps VM, fetches secrets, runs compose,
    adds Watchtower for auto-upgrade
- infra/examples/minimal/ — OSS self-host quickstart using the module

Supports:
- Per-customer GCP project isolation
- Branch-aware dev VMs via dev_instances list (any image_tag)
- Persistent /data disk (rebuild-safe)
- OS Login (no per-user SSH keys)
- Caddy TLS mode (opt-in via tls_mode="caddy" + domain)
- Watchtower auto-upgrade (opt-in via upgrade_mode="auto")
2026-04-21 16:18:35 +02:00

54 lines
1.1 KiB
HCL

# Minimal example: single-VM Agnes deploy.
# Pro OSS self-hoster, co chce prod VM bez dev, bez TLS.
terraform {
required_version = ">= 1.5"
required_providers {
google = {
source = "hashicorp/google"
version = "~> 5.0"
}
}
}
provider "google" {
project = var.gcp_project_id
region = "europe-west1"
}
variable "gcp_project_id" {
description = "GCP project ID (must have billing enabled)"
type = string
}
variable "admin_email" {
description = "Email for first admin user"
type = string
}
module "agnes" {
source = "../../modules/customer-instance"
gcp_project_id = var.gcp_project_id
customer_name = "self-hosted"
seed_admin_email = var.admin_email
prod_instance = {
name = "agnes"
machine_type = "e2-small"
data_disk_gb = 30
image_tag = "stable"
upgrade_mode = "auto"
tls_mode = "none"
domain = ""
}
dev_instances = []
# Customize below for your setup
data_source = "keboola"
}
output "agnes_ip" {
description = "SSH in via: ssh <user>@<ip>; UI at http://<ip>:8000"
value = module.agnes.prod_ip
}