Add cloudstack_pod & cloudstack_cluster resource#217
Closed
ianc769 wants to merge 2 commits intoapache:mainfrom
Closed
Add cloudstack_pod & cloudstack_cluster resource#217ianc769 wants to merge 2 commits intoapache:mainfrom
cloudstack_pod & cloudstack_cluster resource#217ianc769 wants to merge 2 commits intoapache:mainfrom
Conversation
This commit adds support for managing CloudStack Pods and Clusters through Terraform. It implements the following new resources and data sources: Resources: - cloudstack_pod: Allows creation and management of CloudStack Pods - cloudstack_cluster: Allows creation and management of CloudStack Clusters Data Sources: - cloudstack_cluster: Provides lookup capabilities for existing Clusters Implementation details: - Added resource_cloudstack_pod.go with CRUD operations for Pods - Added resource_cloudstack_cluster.go with CRUD operations for Clusters - Added data_source_cloudstack_cluster.go for Cluster data source - Created corresponding test files for all resources and data sources - Added documentation for all new resources and data sources - Updated provider.go to register the new resources and data sources - Added import functionality to both resources
Member
|
Thanks @ianc769 could you please resolve the conflicts |
kiranchavala
approved these changes
Sep 12, 2025
Member
kiranchavala
left a comment
There was a problem hiding this comment.
LGTM, Tested manually
data "cloudstack_zone" "zone" {
filter {
name = "name"
value = "ref-trl-9433-k-Mol8-kiran-chavala"
}
}
resource "cloudstack_pod" "foopod" {
name = "terraform-pod"
zone_id = data.cloudstack_zone.zone.id
gateway = "192.168.56.1"
netmask = "255.255.255.0"
start_ip = "192.168.56.2"
end_ip = "192.168.56.254"
}
resource "cloudstack_cluster" "foo" {
name = "terraform-cluster"
cluster_type = "CloudManaged"
hypervisor = "KVM"
pod_id = cloudstack_pod.foopod.id
zone_id = data.cloudstack_zone.zone.id
arch = "x86_64"
}
terraform apply
data.cloudstack_zone.zone: Reading...
data.cloudstack_zone.zone: Read complete after 1s [id=05d9863d-bd94-41c2-bba8-251aab44637a]
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_cluster.foo will be created
+ resource "cloudstack_cluster" "foo" {
+ allocation_state = (known after apply)
+ arch = "x86_64"
+ cluster_type = "CloudManaged"
+ cpu_overcommit_ratio = (known after apply)
+ hypervisor = "KVM"
+ id = (known after apply)
+ managed_state = (known after apply)
+ memory_overcommit_ratio = (known after apply)
+ name = "terraform-cluster"
+ ovm3vip = (known after apply)
+ pod_id = (known after apply)
+ pod_name = (known after apply)
+ zone_id = "05d9863d-bd94-41c2-bba8-251aab44637a"
+ zone_name = (known after apply)
}
# cloudstack_pod.foopod will be created
+ resource "cloudstack_pod" "foopod" {
+ allocation_state = (known after apply)
+ end_ip = "192.168.56.254"
+ gateway = "192.168.56.1"
+ id = (known after apply)
+ name = "terraform-pod"
+ netmask = "255.255.255.0"
+ start_ip = "192.168.56.2"
+ vlan_id = (known after apply)
+ zone_id = "05d9863d-bd94-41c2-bba8-251aab44637a"
+ zone_name = (known after apply)
}
Plan: 2 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_pod.foopod: Creating...
cloudstack_pod.foopod: Creation complete after 3s [id=fc2a152e-a97e-4d67-964d-368b256afd70]
cloudstack_cluster.foo: Creating...
cloudstack_cluster.foo: Creation complete after 0s [id=d76ba5d3-7316-4d6f-ad00-cd436122332d]
Apply complete! Resources: 2 added, 0 changed, 0 destroyed.
Member
sidshas03
added a commit
to sidshas03/cloudstack-terraform-provider
that referenced
this pull request
Sep 15, 2025
- Merged PR apache#217 implementation with main branch - Used PR branch implementation for cluster and pod resources as it has better error handling and validation - Resolved conflicts in provider.go, resource files, test files, and documentation - All tests compile successfully
sidshas03
added a commit
to sidshas03/cloudstack-terraform-provider
that referenced
this pull request
Sep 15, 2025
- Add cloudstack_pod resource with full CRUD operations - Add cloudstack_cluster resource with full CRUD operations - Add data sources for both resources - Include comprehensive validation and error handling - Add complete test coverage - Add documentation for both resources - Resolve all merge conflicts from original PR apache#217
Contributor
Author
Going to Open a new PR from a clean branch for this instead. 👍 |
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.
Adding
cloudstack_podas a terraform managed resource option -> https://cloudstack.apache.org/api/apidocs-4.20/apis/createPod.htmlAdding
cloudstack_clusteras a terraform managed resource option -> https://cloudstack.apache.org/api/apidocs-4.20/apis/addCluster.htmlUsing this code for example: