Skip to content

Conversation

ianc769
Copy link

@ianc769 ianc769 commented Jul 10, 2025

Adding cloudstack_domain as a data source:

data "cloudstack_domain" "foo" {
  filter {
    value = "name"
    name = "ROOT"
  }
}

output "domain_id" {
  value = data.cloudstack_domain.foo.id
}
output "domain_name" {
  value = data.cloudstack_domain.foo.name
}
output "network_domain" {
  value = data.cloudstack_domain.foo.network_domain
}
output "parent_domain_id" {
  value = data.cloudstack_domain.foo.parent_domain_id
}
data.cloudstack_domain.foo: Reading...
data.cloudstack_domain.foo: Read complete after 0s [id=65c9befb-1a1c-11f0-85c0-460f7764ea25]

Changes to Outputs:
  + domain_id        = "65c9befb-1a1c-11f0-85c0-460f7764ea25"
  + domain_name      = "ROOT"
  + network_domain   = ""
  + parent_domain_id = ""

You can apply this plan to save these new output values to the Terraform state, without changing any real infrastructure.
{7DB24F15-D08F-4039-91E1-08A4CE85F3A1}

Copy link
Member

@vishesh92 vishesh92 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clgtm. Didn't test.

@vishesh92 vishesh92 closed this Aug 26, 2025
@vishesh92 vishesh92 reopened this Aug 26, 2025
Copy link
Collaborator

@kiranchavala kiranchavala left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ianc769

I have provided incorrect domain name but still getting the root domain id

data "cloudstack_domain" "foo" {
  filter {
    value = "name"
    name = "sagfasgha"
  }
}

output "domain_id" {
  value = data.cloudstack_domain.foo.id
}
output "domain_name" {
  value = data.cloudstack_domain.foo.name
}
output "network_domain" {
  value = data.cloudstack_domain.foo.network_domain
}
output "parent_domain_id" {
  value = data.cloudstack_domain.foo.parent_domain_id
}

terraform apply
data.cloudstack_domain.foo: Reading...
data.cloudstack_domain.foo: Read complete after 1s [id=f8f8593c-7730-11f0-9a5b-1e00900003a2]

Changes to Outputs:
  + domain_id        = "f8f8593c-7730-11f0-9a5b-1e00900003a2"
  + domain_name      = "ROOT"
  + network_domain   = ""
  + parent_domain_id = ""

You can apply this plan to save these new output values to the Terraform state, without changing any real infrastructure.

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


Apply complete! Resources: 0 added, 0 changed, 0 destroyed.

Outputs:

domain_id = "f8f8593c-7730-11f0-9a5b-1e00900003a2"
domain_name = "ROOT"
network_domain = ""
parent_domain_id = ""

Also could you please check by providing the sub domain id

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants