Repository navigation
Add disk_offering & override_disk_offering to instance resource - #208
Merged
kiranchavala merged 2 commits intoAug 29, 2025
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR adds support for disk offering configuration in CloudStack instance resources by introducing two new optional parameters: disk_offering and override_disk_offering. These fields allow users to specify disk offerings for virtual machines when deploying from templates or ISO images.
Key changes:
- Added two new optional fields to the instance resource schema with ForceNew behavior
- Implemented parameter handling in the instance creation logic
- Added documentation for the new fields explaining their usage with templates vs ISO images
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
website/docs/r/instance.html.markdown |
Added documentation for the new disk_offering and override_disk_offering parameters |
cloudstack/resource_cloudstack_instance.go |
Added schema definitions and creation logic for the new disk offering fields |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
kiranchavala
approved these changes
Aug 29, 2025
kiranchavala
left a comment
Member
There was a problem hiding this comment.
LGTM Tested manually
resource "cloudstack_instance" "web" {
name = "server-1"
service_offering = "6bf9d0ab-49fd-4bae-937b-286f54532474"
network_id = "1eb73b50-1db5-42f5-8938-8592df101d61"
template = "CentOS 5.5(64-bit) no GUI (KVM)"
zone = "ref-trl-9219-k-Mol8-kiran-chavala"
disk_offering = "2c8a9190-3099-4598-95b1-19560bd40210"
override_disk_offering = "90383b87-f8f9-419a-8b90-4e0a03898c25"
}
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_instance.web will be created
+ resource "cloudstack_instance" "web" {
+ disk_offering = "2c8a9190-3099-4598-95b1-19560bd40210"
+ display_name = (known after apply)
+ expunge = false
+ group = (known after apply)
+ id = (known after apply)
+ ip_address = (known after apply)
+ name = "server-1"
+ network_id = "1eb73b50-1db5-42f5-8938-8592df101d61"
+ override_disk_offering = "90383b87-f8f9-419a-8b90-4e0a03898c25"
+ project = (known after apply)
+ root_disk_size = (known after apply)
+ service_offering = "6bf9d0ab-49fd-4bae-937b-286f54532474"
+ start_vm = true
+ tags = (known after apply)
+ template = "CentOS 5.5(64-bit) no GUI (KVM)"
+ uefi = false
+ zone = "ref-trl-9219-k-Mol8-kiran-chavala"
}
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_instance.web: Creating...
cloudstack_instance.web: Still creating... [00m10s elapsed]
cloudstack_instance.web: Creation complete after 18s [id=c132df8e-4e0d-4994-b0c1-ee6167aeae78]
Apply complete! Resources: 1 added, 0 changed, 0 destroyed.
╭─ ~/Desktop/cloudstack-India-demo/cloudstack-terraform copy ✔ ╱ 21s ╱ Azure subscription 1 ╱ 03:11:37 PM
╰─ terraform destroy
cloudstack_instance.web: Refreshing state... [id=c132df8e-4e0d-4994-b0c1-ee6167aeae78]
Terraform used the selected providers to generate the following execution plan. Resource actions are indicated with the following symbols:
- destroy
Terraform will perform the following actions:
# cloudstack_instance.web will be destroyed
- resource "cloudstack_instance" "web" {
- disk_offering = "90383b87-f8f9-419a-8b90-4e0a03898c25" -> null
- display_name = "server-1" -> null
- expunge = false -> null
- id = "c132df8e-4e0d-4994-b0c1-ee6167aeae78" -> null
- ip_address = "10.1.1.212" -> null
- name = "server-1" -> null
- network_id = "1eb73b50-1db5-42f5-8938-8592df101d61" -> null
- override_disk_offering = "90383b87-f8f9-419a-8b90-4e0a03898c25" -> null
- root_disk_size = 20 -> null
- service_offering = "6bf9d0ab-49fd-4bae-937b-286f54532474" -> null
- start_vm = true -> null
- tags = {} -> null
- template = "CentOS 5.5(64-bit) no GUI (KVM)" -> null
- uefi = false -> null
- zone = "ref-trl-9219-k-Mol8-kiran-chavala" -> null
# (2 unchanged attributes hidden)
}
Plan: 0 to add, 0 to change, 1 to destroy.
Do you really want to destroy all resources?
Terraform will destroy all your managed infrastructure, as shown above.
There is no undo. Only 'yes' will be accepted to confirm.
Enter a value: yes
cloudstack_instance.web: Destroying... [id=c132df8e-4e0d-4994-b0c1-ee6167aeae78]
cloudstack_instance.web: Still destroying... [id=c132df8e-4e0d-4994-b0c1-ee6167aeae78, 00m10s elapsed]
cloudstack_instance.web: Still destroying... [id=c132df8e-4e0d-4994-b0c1-ee6167aeae78, 00m20s elapsed]
cloudstack_instance.web: Still destroying... [id=c132df8e-4e0d-4994-b0c1-ee6167aeae78, 00m30s elapsed]
cloudstack_instance.web: Still destroying... [id=c132df8e-4e0d-4994-b0c1-ee6167aeae78, 00m40s elapsed]
cloudstack_instance.web: Destruction complete after 48s
Destroy complete! Resources: 1 destroyed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #68
Changes in these fields is ignored as of now.