You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cloudstack.apache.org by "chrxmvtik (via GitHub)" <gi...@apache.org> on 2025/11/28 13:41:11 UTC

[I] data.cloudstack_instance filters not working [CS 4.21][CTP 0.6.0] [cloudstack-terraform-provider]

chrxmvtik opened a new issue, #266:
URL: https://github.com/apache/cloudstack-terraform-provider/issues/266

   Hi, recently moved to terraform provider v0.6.0 and wanted to obtain IP address of instance nic.
   
   I created instances using resource - works fine.
   ```hcl
   resource "cloudstack_instance" "controlplane" {
     count            = var.controlplane_count
     name             = "${var.cluster_name}-control-${count.index + 1}"
     service_offering = "CS"
     boot_mode        = "legacy"
     template         = cloudstack_template.talos.id
     zone             = var.zone
     project          = var.project
     uefi             = true
     network_id       = cloudstack_network.talos.id
     expunge          = true
     root_disk_size   = 200
   }
   ```
   
   Then I tried to obtain instance details using datasource:
   ```hcl
   data "cloudstack_instance" "controlplane" {
     count      = var.controlplane_count
     depends_on = [cloudstack_instance.controlplane]
     
     filter {
       name  = "display_name" # Tried also "name"
       value = "${var.cluster_name}-control-${count.index + 1}"
     }
   }
   ```
   
   But provider returns an error:
   ``Error: No instance is matching with the specified regex``
   
   While it certainly exists and should match.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@cloudstack.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] data.cloudstack_instance filters not working [CS 4.21][CTP 0.6.0] [cloudstack-terraform-provider]

Posted by "sureshanaparti (via GitHub)" <gi...@apache.org>.
sureshanaparti closed issue #266: data.cloudstack_instance filters not working [CS 4.21][CTP 0.6.0]
URL: https://github.com/apache/cloudstack-terraform-provider/issues/266


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] data.cloudstack_instance filters not working [CS 4.21][CTP 0.6.0] [cloudstack-terraform-provider]

Posted by "sudo87 (via GitHub)" <gi...@apache.org>.
sudo87 commented on issue #266:
URL: https://github.com/apache/cloudstack-terraform-provider/issues/266#issuecomment-5238969863

   @chrxmvtik looks like this isn’t a regression. I was able to reproduce the same issue on v0.5.0.
   
   The root cause seems to be that the VM is created with project = var.project, but the data source doesn’t support project and calls ListVirtualMachines() without projectid. So the project VM never makes it into the list, and the filter has nothing to match. The regex error is a bit misleading.
   
   ```
   data.cloudstack_instance.controlplane[0]: Reading...
   ╷
   │ Error: No instance is matching with the specified regex
   │
   │   with data.cloudstack_instance.controlplane[0],
   │   on main.tf line 47, in data "cloudstack_instance" "controlplane":
   │   47: data "cloudstack_instance" "controlplane" {
   │


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org