poddm opened a new pull request, #315:
URL: https://github.com/apache/cloudstack-terraform-provider/pull/315
## 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
```hcl
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
}
}
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]