Andrew 6b7430b67b Overhaul VirtFusion provider: 20 resources, 30 data sources, multipage pagination
Complete rewrite of the VirtFusion Terraform provider with full API coverage:

- 20 managed resources (server, build, SSH key, user, firewall, IP blocks, etc.)
- 30 data sources (hypervisors, packages, servers, IP blocks, self-service, etc.)
- New HTTP client with proper error handling, query parameter support, and
  automatic multipage pagination via GetAllPages (fetches all pages from
  Laravel-style paginated endpoints and merges into a single response)
- Fixed type mismatches against live API: ServerData.Suspended (int→bool),
  IPBlockData.Type (string→int), PackageData json tags (primaryStorage, etc.),
  ServerData nested CPU/Settings/Resources structure, HypervisorGroupResources
  array response
- Configurable results-per-page (default 300) on all list data sources
- Migrated CI from GitHub Actions to Gitea Actions
- Updated goreleaser config, go.mod dependencies, and examples

Verified against live VirtFusion instance at cp.vps.ezscale.tech:
all data sources return correct data with full pagination support.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-16 02:01:16 -04:00
2023-10-24 11:35:23 -04:00
2023-08-19 20:55:01 -04:00
2023-08-19 20:55:01 -04:00
2023-10-24 12:17:12 -04:00

Virtfusion Terraform Provider

NOTE: This is a work in progress and is not yet ready for production use.

Overview

This is a Terraform provider for the Virtfusion API. It allows you to manage your Virtfusion resources using Terraform.

What can I do with this provider?

Currently, you're able to manage the following resources:

  • Create and delete virtual machines
  • Create and delete SSH keys

How do I use this provider?

Below is an example of how to use this provider to create a virtual machine and an SSH key.

terraform {
  required_providers {
    virtfusion = {
      source = "ezscale/virtfusion"
        version = "0.0.3"
    }
  }
}

provider "virtfusion" {
  endpoint = "virtfusion.example.com"
  api_token = ""
}

variable "common" {
    type = map(string)
    default = {
        hypervisor_id = 1
        package_id = 12
        user_id = 1
    }
}

# Create a SSH key
resource "virtfusion_ssh" "key1" {
  name = "My Test Key"
  public_key = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIKWyBR+dk5M5MMfmH6Ss5QDSgcAvbCYu0DkqgPKH8O5T testkey@example.com"
  user_id = var.common["user_id"]
}

# Create a server
resource "virtfusion_server" "node1" {
  hypervisor_id = var.common["hypervisor_id"]
  package_id = var.common["package_id"]
  user_id = var.common["user_id"]
}

# Initialize the server with the OS we want, the SSH key we want, and the hostname we want.
resource "virtfusion_build" "node1" {
  server_id = virtfusion_server.node1.id
  name = "node1-demo"
  hostname = "node1.example.com"
  osid = 34
  vnc = true
  ipv6 = true
  ssh_keys = [virtfusion_ssh.key1.id]
  email = true
}

How can I contribute?

If you'd like to contribute, please feel free to open a pull request. If you're unsure of what to work on, please check the issues tab for any open issues.

Description
Terraform provider for the Virtfusion API.
Readme MPL-2.0 337 KiB
v1.0.0 Latest
2026-03-16 02:35:35 -04:00
Languages
Go 99.9%
Makefile 0.1%