Open Sourcing my Homelab

I am going to begin the process of open sourcing my homelab. I use Azure Dev Ops and figured my work might benefit others. The process for removing any identifiable information is ongoing, but here is a preview of what you can expect.

Terraform plan for deploying a server on Proxmox:

terraform {
  required_providers {
    proxmox = {
      source = "Telmate/proxmox"
      version = "2.9.14"
    }
  }
}

variable "proxmoxapikey" {
  type = string
  default = ""
}

# Define the provider and the API credentials
provider "proxmox" {
  pm_api_url = "https://192.168.1.234:8006/api2/json"
  pm_api_token_id = "root@pam!doco"
  pm_api_token_secret = var.proxmoxapikey
}



# Create a VM by cloning the template
resource "proxmox_vm_qemu" "vm" {
  name = "my-vm"
  target_node = "theark"
  clone = "Ubuntu2204base"
  os_type = "cloud-init"
  cores = 2
  sockets = 1
  memory = 4096
  network {
    model = "virtio"
    bridge = "vmbr0"
  }
  # Use the default disk info from the template
  disk {
    type = "scsi"
    storage = "local-lvm"
    size = "32G"
    format = "raw"
  }
}

Terraform .vars file for the above plan:

variable "proxmoxapikey" {
  type = string
  default = "${proxmoxapikey}"
}

Pipeline code for deploying the server automatically:

trigger:
  branches:
    include:
    - main
  paths:
    include:
    - Deploy/Terraform

pool:
  name: default
  demands:
  - agent.name -equals DO-CO2

variables:
    TF_VAR_proxmoxapikey: $(proxmoxapikey)

steps:

- task: TerraformCLI@0
  displayName: 'Terraform init'
  inputs:
    command: 'init'
    workingDirectory: '$(System.DefaultWorkingDirectory)/Deploy/Terraform'

- task: TerraformCLI@0
  displayName: 'Terraform plan'
  inputs:
    command: 'plan'
    workingDirectory: '$(System.DefaultWorkingDirectory)/Deploy/Terraform'
    commandOptions: '-var "proxmoxapikey=$(TF_VAR_proxmoxapikey)"'
    


- task: TerraformCLI@0
  displayName: 'Terraform apply'
  inputs:
    command: 'apply'
    workingDirectory: '$(System.DefaultWorkingDirectory)/Deploy/Terraform'
    commandOptions: '-var "proxmoxapikey=$(TF_VAR_proxmoxapikey)"'