-
Notifications
You must be signed in to change notification settings - Fork 55
feat: Add service_offering_details support for GPU configuration #247
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Add service_offering_details support for GPU configuration #247
Conversation
- Add service_offering_details attribute to cloudstack_service_offering resource - Support for GPU configuration with pciDevice and vgpuType parameters - Include comprehensive test coverage and documentation - Add practical examples for GPU service offerings - Addresses issue apache#246
- Update service offering documentation with GPU examples - Add service_offering_details parameter documentation - Update CHANGELOG with new feature entry - Include practical examples for GPU configuration
- Fix code formatting to comply with Go standards - Align map fields and remove trailing whitespace - Required for CI/CD pipeline to pass
add missing cpu_speed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hitting the following exception on
Terraform v1.12.1
on darwin_arm64
+ provider localdomain/provider/cloudstack v0.4.0
Your version of Terraform is out of date! The latest version
is 1.13.4. You can update by downloading from https://developer.hashicorp.com/terraform/install
TF_LOG=DEBUG terraform apply
2025-10-16T14:04:01.142+0530 [INFO] Terraform version: 1.12.1
2025-10-16T14:04:01.142+0530 [DEBUG] using github.com/hashicorp/go-tfe v1.74.1
2025-10-16T14:04:01.142+0530 [DEBUG] using github.com/hashicorp/hcl/v2 v2.23.1-0.20250203194505-ba0759438da2
2025-10-16T14:04:01.142+0530 [DEBUG] using github.com/hashicorp/terraform-svchost v0.1.1
2025-10-16T14:04:01.142+0530 [DEBUG] using github.com/zclconf/go-cty v1.16.2
2025-10-16T14:04:01.142+0530 [INFO] Go runtime version: go1.24.2
2025-10-16T14:04:01.142+0530 [INFO] CLI args: []string{"terraform", "apply"}
2025-10-16T14:04:01.142+0530 [DEBUG] Attempting to open CLI config file: /Users/kiranchavala/.terraformrc
2025-10-16T14:04:01.142+0530 [DEBUG] File doesn't exist, but doesn't need to. Ignoring.
2025-10-16T14:04:01.143+0530 [DEBUG] checking for credentials in "/Users/kiranchavala/.terraform.d/plugins"
2025-10-16T14:04:01.143+0530 [DEBUG] ignoring non-existing provider search directory terraform.d/plugins
2025-10-16T14:04:01.143+0530 [DEBUG] will search for provider plugins in /Users/kiranchavala/.terraform.d/plugins
2025-10-16T14:04:01.143+0530 [DEBUG] ignoring non-existing provider search directory /Users/kiranchavala/Library/Application Support/io.terraform/plugins
2025-10-16T14:04:01.143+0530 [DEBUG] ignoring non-existing provider search directory /Library/Application Support/io.terraform/plugins
2025-10-16T14:04:01.143+0530 [INFO] CLI command args: []string{"apply"}
2025-10-16T14:04:01.179+0530 [DEBUG] checking for provisioner in "."
2025-10-16T14:04:01.183+0530 [DEBUG] checking for provisioner in "/opt/homebrew/bin"
2025-10-16T14:04:01.183+0530 [DEBUG] checking for provisioner in "/Users/kiranchavala/.terraform.d/plugins"
2025-10-16T14:04:01.184+0530 [INFO] backend/local: starting Apply operation
2025-10-16T14:04:01.186+0530 [DEBUG] created provider logger: level=debug
2025-10-16T14:04:01.186+0530 [INFO] provider: configuring client automatic mTLS
2025-10-16T14:04:01.195+0530 [DEBUG] provider: starting plugin: path=.terraform/providers/localdomain/provider/cloudstack/0.4.0/darwin_arm64/terraform-provider-cloudstack args=[".terraform/providers/localdomain/provider/cloudstack/0.4.0/darwin_arm64/terraform-provider-cloudstack"]
2025-10-16T14:04:01.197+0530 [DEBUG] provider: plugin started: path=.terraform/providers/localdomain/provider/cloudstack/0.4.0/darwin_arm64/terraform-provider-cloudstack pid=73586
2025-10-16T14:04:01.197+0530 [DEBUG] provider: waiting for RPC address: plugin=.terraform/providers/localdomain/provider/cloudstack/0.4.0/darwin_arm64/terraform-provider-cloudstack
╷
│ Error: Failed to load plugin schemas
│
│ Error while loading schemas for plugin components: Failed to obtain provider schema: Could not load the schema for provider localdomain/provider/cloudstack: failed to instantiate provider
│ "localdomain/provider/cloudstack" to obtain schema: timeout while waiting for plugin to start..
╵
2025-10-16T14:05:01.204+0530 [WARN] provider: plugin failed to exit gracefully
kiranchavala
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, tested with Ubuntu 24.04 and terraform version 1.13.4
root@ubuntu2404:~/terrfomconfig# terraform -version
Terraform v1.13.4
on linux_amd64
root@ubuntu2404:~/terrfomconfig# cat main.tf
provider "cloudstack" {
api_url = var.cloudstack_api_url
api_key = var.cloudstack_api_key
secret_key = var.cloudstack_secret_key
}
resource "cloudstack_service_offering" "gpu_offering" {
name = "gpu-a6000"
display_text = "GPU A6000 Instance"
cpu_number = 4
cpu_speed = 1000
memory = 16384
service_offering_details = {
pciDevice = "Group of NVIDIA A6000 GPUs"
vgpuType = "A6000-8A"
}
}
root@ubuntu2404:~/terrfomconfig# terraform apply
Terraform used the selected providers to generate the following execution plan. Resource actions are indicated with the following symbols:
+ create
Terraform will perform the following actions:
# cloudstack_service_offering.gpu_offering will be created
+ resource "cloudstack_service_offering" "gpu_offering" {
+ cpu_number = 4
+ cpu_speed = 1000
+ customized = (known after apply)
+ display_text = "GPU A6000 Instance"
+ id = (known after apply)
+ limit_cpu_use = false
+ memory = 16384
+ name = "gpu-a6000"
+ offer_ha = false
+ service_offering_details = {
+ "pciDevice" = "Group of NVIDIA A6000 GPUs"
+ "vgpuType" = "A6000-8A"
}
+ storage_type = "shared"
}
Plan: 1 to add, 0 to change, 0 to destroy.
Do you want to perform these actions?
Terraform will perform the actions described above.
Only 'yes' will be accepted to approve.
Enter a value: yes
cloudstack_service_offering.gpu_offering: Creating...
cloudstack_service_offering.gpu_offering: Creation complete after 0s [id=cbe41998-c205-403a-a0c2-91ec5829c249]
Apply complete! Resources: 1 added, 0 changed, 0 destroyed.
mysql> select * from service_offering_details;
+----+---------------------+-----------+----------------------------+---------+
| id | service_offering_id | name | value | display |
+----+---------------------+-----------+----------------------------+---------+
| 1 | 15 | vgpuType | A6000-8A | 1 |
| 2 | 15 | pciDevice | Group of NVIDIA A6000 GPUs | 1 |
+----+---------------------+-----------+----------------------------+---------+
2 rows in set (0.00 sec)
Description
This PR implements support for
service_offering_detailsin thecloudstack_service_offeringresource, enabling GPU configuration and other advanced settings through the CloudStack API.Changes Made
service_offering_detailsschema attribute as TypeMapTesting
Example Usage