-
Notifications
You must be signed in to change notification settings - Fork 55
Add cloudstack_pod & cloudstack_cluster resource
#217
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
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
|
Thanks @ianc769 could you please resolve the conflicts |
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 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.
- 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
- 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
Going to Open a new PR from a clean branch for this instead. 👍 |
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: