-
Notifications
You must be signed in to change notification settings - Fork 55
add cloudstack_cluster data source and documentation
#222
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
Merged
Conversation
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
kiranchavala
approved these changes
Sep 16, 2025
Collaborator
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"
}
}
data "cloudstack_pod" "pod" {
filter {
name = "name"
value = "Pod1"
}
}
# Create a cluster first
resource "cloudstack_cluster" "test_cluster" {
cluster_name = "terraform-test-cluster"
cluster_type = "CloudManaged"
hypervisor = "KVM"
pod_id = data.cloudstack_pod.pod.id
zone_id = data.cloudstack_zone.zone.id
}
# Then query it with the data source
data "cloudstack_cluster" "test" {
filter {
name = "name"
value = "terraform-test-cluster"
}
depends_on = [cloudstack_cluster.test_cluster]
}
output "cloudstack_cluster_details" {
description = "cluster_id"
value = data.cloudstack_cluster.test.id
}
terraform apply
data.cloudstack_zone.zone: Reading...
data.cloudstack_pod.pod: Reading...
data.cloudstack_pod.pod: Read complete after 0s [id=6079c0a3-e6d5-4eaf-ab47-551f657e5379]
data.cloudstack_zone.zone: Read complete after 0s [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
<= read (data resources)
Terraform will perform the following actions:
# data.cloudstack_cluster.test will be read during apply
# (depends on a resource or a module with changes pending)
<= data "cloudstack_cluster" "test" {
+ allocation_state = (known after apply)
+ arch = (known after apply)
+ capacity = (known after apply)
+ cluster_name = (known after apply)
+ cluster_type = (known after apply)
+ cpu_overcommit_ratio = (known after apply)
+ guest_vswitch_name = (known after apply)
+ guest_vswitch_type = (known after apply)
+ hypervisor = (known after apply)
+ id = (known after apply)
+ managed_state = (known after apply)
+ memory_overcommit_ratio = (known after apply)
+ name = (known after apply)
+ ovm3_cluster = (known after apply)
+ ovm3_pool = (known after apply)
+ ovm3_vip = (known after apply)
+ ovm3vip = (known after apply)
+ password = (sensitive value)
+ pod_id = (known after apply)
+ pod_name = (known after apply)
+ public_vswitch_name = (known after apply)
+ public_vswitch_type = (known after apply)
+ url = (known after apply)
+ username = (known after apply)
+ vsm_ip_address = (known after apply)
+ vsm_password = (sensitive value)
+ vsm_username = (known after apply)
+ zone_id = (known after apply)
+ zone_name = (known after apply)
+ filter {
+ name = "name"
+ value = "terraform-test-cluster"
}
}
# cloudstack_cluster.test_cluster will be created
+ resource "cloudstack_cluster" "test_cluster" {
+ allocation_state = (known after apply)
+ cluster_name = "terraform-test-cluster"
+ cluster_type = "CloudManaged"
+ hypervisor = "KVM"
+ id = (known after apply)
+ pod_id = "6079c0a3-e6d5-4eaf-ab47-551f657e5379"
+ zone_id = "05d9863d-bd94-41c2-bba8-251aab44637a"
}
Plan: 1 to add, 0 to change, 0 to destroy.
Changes to Outputs:
+ cloudstack_cluster_details = (known after apply)
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_cluster.test_cluster: Creating...
cloudstack_cluster.test_cluster: Creation complete after 0s [id=d576bb30-42e3-46a6-8d9f-2aad062a6245]
data.cloudstack_cluster.test: Reading...
data.cloudstack_cluster.test: Read complete after 1s [id=d576bb30-42e3-46a6-8d9f-2aad062a6245]
Apply complete! Resources: 1 added, 0 changed, 0 destroyed.
Outputs:
cloudstack_cluster_details = "d576bb30-42e3-46a6-8d9f-2aad062a6245"
DaanHoogland
approved these changes
Sep 16, 2025
Contributor
DaanHoogland
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.
clgtm
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.
Followup from #67
Comment Thread in #217
Adding Data Source