Files
homelab/opentofu-bootstrap
k.rennerandClaude f2dc2ad86e feat: Separate RustFS to bootstrap project
Move RustFS cluster management to a separate OpenTofu project to break
the circular dependency (OpenTofu state stored in RustFS, which was
managed by OpenTofu).

Changes:
- Create opentofu-bootstrap/ with dedicated RustFS management
- Use local state for bootstrap project (cannot use S3 - that's circular)
- Remove RustFS from main opentofu/ project
- Re-enable S3 backend in main project
- Add comprehensive README for bootstrap project

The bootstrap project manages Layer 0 infrastructure that must exist
before the main OpenTofu project can initialize.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2026-02-17 00:09:32 +01:00
..

OpenTofu Bootstrap Infrastructure

This directory contains OpenTofu configuration for bootstrap infrastructure - resources that must exist before the main OpenTofu project can run.

Why Separate?

The main OpenTofu project stores its state in RustFS (S3-compatible storage). This creates a circular dependency:

  • OpenTofu needs S3 to store state
  • S3 (RustFS) is managed by OpenTofu

By separating RustFS into its own project with local state, we break this circular dependency.

Resources Managed

  • RustFS Cluster (LXC 800-802): S3-compatible storage for OpenTofu state

Usage

Prerequisites

Ensure you're in the nix-shell and direnv is allowed:

cd /home/krenner/homelab
direnv allow
cd opentofu-bootstrap

Commands

# Initialize (first time only)
tofu init

# Plan changes
tofu plan

# Apply changes (CAUTION: may affect state storage)
tofu apply

# Import existing containers (if needed)
tofu import 'proxmox_virtual_environment_container.rustfs["rustfs-1"]' jupiter/800
tofu import 'proxmox_virtual_environment_container.rustfs["rustfs-2"]' saturn/801
tofu import 'proxmox_virtual_environment_container.rustfs["rustfs-3"]' neptune/802

Important Notes

  1. Local State Only: This project intentionally uses local state. Never migrate to S3.

  2. Rare Changes: Changes to bootstrap infrastructure should be rare and carefully planned.

  3. Manual Application: Do not add this to CI/CD. Apply changes manually after careful review.

  4. Mount Points: Data volumes (/mnt/data) are managed outside OpenTofu via Ansible to prevent accidental data loss.

  5. Backup State: The terraform.tfstate file should be backed up manually or committed to git (it contains no secrets).

Recovery

If RustFS cluster needs recovery:

  1. Restore from Proxmox Backup Server (PBS)
  2. Or rebuild using Ansible: ansible-playbook -i inventory/ plays/install-rustfs.yml
  3. Re-import into this OpenTofu project if needed

Configuration Management

IMPORTANT: RustFS configuration is managed via Ansible, not OpenTofu.

  • Configuration template: ansible/roles/rustfs/templates/rustfs.cluster.j2
  • Default variables: ansible/roles/rustfs/defaults/main.yml
  • Playbook: ansible/plays/install-rustfs.yml

Key settings:

  • rustfs_storage_class_standard: "EC:1" - Enables 2-node quorum (1 parity drive)

To apply configuration changes:

cd ansible
ansible-playbook -i inventory/ plays/install-rustfs.yml --tags config