Skip to content

Add GPU support: gpu_card / vgpu_profile data sources and GPU on service offerings - #315

Open
poddm wants to merge 2 commits into
apache:mainfrom
poddm:mp/service_gpus_clean
Open

Add GPU support: gpu_card / vgpu_profile data sources and GPU on service offerings#315
poddm wants to merge 2 commits into
apache:mainfrom
poddm:mp/service_gpus_clean

Conversation

@poddm

@poddm poddm commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds GPU support to the provider, aligned with the GPU/vGPU APIs introduced in
recent CloudStack releases. This lets operators discover GPU cards and vGPU
profiles and attach GPUs to service offerings.

What's included

New data sources

  • cloudstack_gpu_card — looks up a GPU card via the listGpuCards API.
    Exposes id, name, device_id, device_name, vendor_id, vendor_name.

  • cloudstack_vgpu_profile — looks up a vGPU profile via the listVgpuProfiles
    API. Exposes id, name, description, device_id, device_name,
    gpu_card_id, gpu_card_name, max_heads, max_resolution_x,
    max_resolution_y, max_vgpu_per_physical_gpu, vendor_id, vendor_name,
    video_ram.

    Both data sources support the standard filter block (regex matching on
    returned fields).

Service offering GPU configuration

  • Adds an optional gpu nested block to the service offering resources
    (constrained / fixed / unconstrained), with:
    • vgpu_profile_id (required) — vGPU profile to associate with the offering
    • count (optional) — number of GPUs assigned to the guest VM
    • display (optional) — whether the GPU is presented as a display device
    • All three force replacement when changed.

Docs

  • Website documentation for gpu_card and vgpu_profile data sources.

Dependency

  • Bumps github.com/apache/cloudstack-go/v2 from v2.18.1 to v2.19.1 for the
    GPU API bindings.

Example usage

data "cloudstack_gpu_card" "main" {
  filter {
    name  = "name"
    value = "Example Corp EX100GL \\[ExampleGPU 32GB\\]"
  }
}

data "cloudstack_vgpu_profile" "main" {
  filter {
    name  = "gpu_card_id"
    value = data.cloudstack_gpu_card.main.id
  }
  filter {
    name  = "name"
    value = "passthrough"
  }
}

resource "cloudstack_service_offering_constrained" "example" {
  name         = "example.gpu.offering"
  display_text = "Example GPU offering, vCPU 2-32, Memory 2G-128G"

  // compute
  cpu_speed      = 1024
  max_cpu_number = 32
  min_cpu_number = 2
  max_memory     = 131072
  min_memory     = 2048
  network_rate   = 10000

  // other
  disk_offering_id = var.disk_offering_id
  zone_ids         = var.zone_ids
  tags             = "EXAMPLE_STORAGE"
  host_tags        = "EXAMPLE_GPU"

  // Feature flags
  dynamic_scaling_enabled = true
  is_volatile             = false
  limit_cpu_use           = false
  offer_ha                = true

  gpu = {
    vgpu_profile_id = data.cloudstack_vgpu_profile.main.id
    count           = 1
    display         = true
  }
}

poddm added 2 commits August 12, 2026 12:57
(cherry picked from commit 0f8167f)
(cherry picked from commit b6de735)
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