Damans227 opened a new pull request, #34:
URL: https://github.com/apache/cloudstack-terraform-provider/pull/34

   Hello @Pearl1594 and @harikrishna-patnala. I'm opening this up as a draft PR 
to get some feedback. 
   
   I'm implementing a very basic data source to read Virtual Machine (Instance) 
resource, using the `instance_id` as an input in the terraform configuration 
file. Once I have this working successfully, I'll write different filters to 
extend its functionality and also remove all `log.Printf()` calls to make the 
code cleaner. 
   
   So, at the moment, I am able to associate resource data with 
`*schema.ResourceData`. This has been confirmed by running the `DEBUG` trace on 
the Terraform configuration file (main.tf) but when I try to read instance data 
using Terraform, the output block always returns `null`. I am trying to figure 
out why is that the case. Could you also pleas etake a look and suggest 
something? 
   
   I am attaching the main.tf and the logs I have captured. 
   
   From `main.tf`:
   
   ```
   data "cloudstack_instance" "my_instance" {
     instance_id="153aa39d-5f61-4cf8-8e17-687ee25807ff"
   
   
   }
   
   output "instance-output" {
     value = "${data.cloudstack_instance.my_instance}"
   }
   
   ```
   
   `terraform apply` output:
   
   ```
   ╷
   │ Warning: Provider development overrides are in effect
   │ 
   │ The following provider development overrides are set in the CLI 
configuration:
   │  - cloudstack/cloudstack in 
/home/darora/.terraform.d/plugins/cloudstack-dev/bin
   │  - edu/hashicups in 
/home/darora/.terraform.d/plugins/hashicorp.com/edu/hashicups/0.3.1/amd64
   │ 
   │ The behavior may therefore not match any released version of the provider 
and applying changes may cause the state to become incompatible
   │ with published releases.
   ╵
   data.cloudstack_instance.my_instance: Reading...
   cloudstack_instance.instance-test-a: Refreshing state... 
[id=153aa39d-5f61-4cf8-8e17-687ee25807ff]
   cloudstack_instance.instance-test-c: Refreshing state... 
[id=9e68b9b1-5434-4cce-bfcf-d7d42b86adc8]
   cloudstack_instance.instance-test-b: Refreshing state... 
[id=ed55a876-f434-4aa1-840e-2e40249bf199]
   data.cloudstack_instance.my_instance: Read complete after 0s
   
   No changes. Your infrastructure matches the configuration.
   
   Terraform has compared your real infrastructure against your configuration 
and found no differences, so no changes are needed.
   
   Apply complete! Resources: 0 added, 0 changed, 0 destroyed.
   
   Outputs:
   
   instance-output = {
     "account" = tostring(null)
     "created" = tostring(null)
     "display_name" = tostring(null)
     "host_id" = tostring(null)
     "id" = tostring(null)
     "instance_id" = tostring(null)
     "name" = tostring(null)
     "state" = tostring(null)
     "zone_id" = tostring(null)
   }
   
   ```
   
   
   
[Terraform_Refresh.log](https://github.com/apache/cloudstack-terraform-provider/files/8819723/Terraform_Refresh.log)
   
   


-- 
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-unsubscr...@cloudstack.apache.org

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

Reply via email to