Skip to content

Conversation

TechDufus
Copy link
Owner

Summary

  • Implements comprehensive talos-cluster Terraform module for simplified Kubernetes deployments
  • Reorganizes dev environment Terraform configuration from monolithic main.tf into logical files
  • Adds beautiful Terraform state sync tool with 1Password integration

Changes

New Talos Cluster Module

Created a high-level Terraform module (terraform/proxmox/modules/talos-cluster/) that abstracts the complexity of deploying Talos Linux Kubernetes clusters on Proxmox:

  • Single-block configuration - Deploy complete clusters with minimal configuration
  • Automatic IP calculation - Workers get sequential IPs based on control plane IP
  • Flexible sizing - Predefined node types (cumulus/nimbus/stratus) or custom specs
  • CNI options - Support for Flannel (default), Calico, or Cilium
  • Comprehensive outputs - Kubeconfig, talosconfig, node IPs, and cluster details

Terraform Reorganization

Split the 459-line main.tf in the dev environment into logical, maintainable files:

  • versions.tf - Terraform and provider version requirements
  • backend.tf - Backend configuration
  • providers.tf - Provider configurations
  • data.tf - Data sources (1Password items)
  • locals.tf - Local values and common tags
  • clusters.tf - All Kubernetes cluster resources
  • variables.tf - Variable definitions with defaults
  • vms.tf - Placeholder for standalone VMs

State Sync Tool

Added scripts/tfstate - a Catppuccin-themed CLI tool for syncing Terraform state with 1Password:

  • Beautiful UI - Full Catppuccin Mocha color palette with icons and formatting
  • Smart sync - Automatically pushes/pulls based on timestamp comparison
  • Multiple commands - push, pull, sync, status, list, delete
  • SHA256 verification - Ensures state integrity
  • Location aware - Works correctly from any directory

Documentation Updates

  • Updated dev environment README to be more concise and operational
  • Removed handholding and basic explanations
  • Added state management documentation

Test Plan

  • terraform init successful in both module and dev environment
  • terraform validate passes
  • terraform fmt applied to all files
  • State sync tool tested with all commands
  • Security audit completed - no credentials exposed

Migration Notes

The reorganization maintains full compatibility with existing infrastructure. The main.tf was renamed to clusters.tf and all resources remain unchanged.

- Create comprehensive talos-cluster Terraform module for Proxmox
  - Single-block configuration for complete Kubernetes clusters
  - Supports control plane and worker node configurations
  - Automatic IP calculation for worker nodes
  - Configurable CNI, storage, and network settings
  - Comprehensive outputs for kubeconfig and talosconfig

- Reorganize dev environment Terraform configuration
  - Split 459-line main.tf into logical files
  - providers.tf: Provider configurations
  - backend.tf: Backend configuration
  - data.tf: Data sources (1Password items)
  - locals.tf: Local values
  - clusters.tf: Kubernetes cluster resources
  - variables.tf: Variable definitions
  - versions.tf: Version constraints
  - vms.tf: Placeholder for standalone VMs

- Add Terraform state sync tool with 1Password
  - Beautiful Catppuccin-themed CLI interface
  - Push/pull state to/from 1Password
  - Smart sync based on timestamp comparison
  - Status checking with SHA256 verification
  - Works from any directory location

- Update dev environment README
  - Remove handholding and basic explanations
  - Focus on operational commands
  - Add state management documentation
@TechDufus TechDufus requested a review from Copilot July 16, 2025 22:04
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR implements a comprehensive talos-cluster Terraform module for simplified Kubernetes deployments and reorganizes the development environment configuration for better maintainability. The module provides single-block cluster configuration with automatic IP calculation, flexible storage distribution, and comprehensive outputs.

  • New talos-cluster module for simplified Kubernetes cluster deployment
  • Terraform reorganization splitting monolithic main.tf into logical files
  • State sync tool with 1Password integration and Catppuccin UI

Reviewed Changes

Copilot reviewed 14 out of 18 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
terraform/proxmox/modules/talos-cluster/variables.tf Variable definitions with validation for the new cluster module
terraform/proxmox/modules/talos-cluster/outputs.tf Comprehensive outputs for cluster access and metadata
terraform/proxmox/modules/talos-cluster/main.tf Core module logic for Talos cluster creation
terraform/proxmox/modules/talos-cluster/README.md Detailed documentation for module usage
terraform/proxmox/environments/dev/* Reorganized dev environment files from monolithic structure
scripts/tfstate New CLI tool for Terraform state synchronization with 1Password
Files not reviewed (3)
  • terraform/proxmox/.terraform.lock.hcl: Language not supported
  • terraform/proxmox/environments/dev/.terraform.lock.hcl: Language not supported
  • terraform/proxmox/modules/talos-cluster/.terraform.lock.hcl: Language not supported

- Replace regex IPv4 validation with cidrhost() for proper octet range validation
- Fix IP calculation logic to work correctly with any subnet size
- Simplify worker IP generation using cidrhost() with offset

The previous implementation had two critical issues:
1. IPv4 validation would accept invalid IPs like 999.999.999.999
2. IP calculation only used the last octet, breaking on non-/24 subnets
- Replace 386 lines of individual resource definitions with single module
- Simplify cluster deployment to ~90 lines total
- Update outputs to use module-provided values
- Add example terraform.tfvars with minimal configuration
- All functionality preserved with cleaner implementation
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant