-
Notifications
You must be signed in to change notification settings - Fork 35
Call a vRA Resource Actions on a provisioned resource #26
Comments
I've been kind of wondering about this too, and about how this would be represented in Terraform esp wrt to #23 . It looks like there's some thought about this in the code... but it's not clear to me whether it's intended to be a general purpose way to call actions (much less how it's actually activated) or specifically just destroy and poweroff. https://github.com/vmware/terraform-provider-vra7/blob/083b54e79ab4c84022eb3b36f1d528beb5768420/vrealize/actions.go#L7-L20 I'm not familiar enough with Terraform to know if any other providers have a similar idea of actions and/or how they're referenced/presented? |
I did a bit of research already and didn't find much, every object for other providers (AWS/Azure/Others) are represented by a Resource Type. However a vRA Resource Action seems more like a one time execution kind of thing that we might/might now want to track in the tfstate file and that fits much better into the mold of a Terraform Provisioner. This seems to be a good fit for Resource Actions in my opinion. |
Hi, Would anyone happen to have made progress on this? Thanks to all |
I haven't really looked at doing any work around this but wonder if maybe provisioners aren't the right approach since it looks like they're invoked at creation or destruction of the resource? I think it'd be better if you were able to call the action at any/some point during the lifecycle of the resource. This might entail a new resource type that would maybe leverage depends_on or be targeted at a deployed vRA resource.
A quick look at the code makes it seem like this isn't a trivial undertaking since actions (esp custom ones might be complicated)? |
Hey Carlos, what you're suggesting makes sense. Maybe it could be simpified if running the resource action could be completely detached from a resource and in the action's configuration block, you would specify the action name and the resource type and resource name you want to run it on. That way you could potentially run actions on items that are provisioned outside of the current TF deployment. |
Hello, |
@afurlani24 I have created a PR-27 which is under review now. It has same feature extension what you are expecting. |
Thank You! |
That's awesome Viraj, thanks! Would you be able to show an example of code that calls a resource action? |
@Marcvd316 Simply update the values of resource_configuration schema and it will update the deployment accordingly. No need to add any extra action parameter. |
Viraj, |
Hello, I'm also very interested in this feature, would this also allow the update of storage to say extend the disk for a VM? Thank you, Vincenzo |
@markpeek Hello do you know when you will be able to review PR-27? Excited to be able to start using these features. |
@virajindasrao Any update on this been sitting in Review for a long time? Thanks, |
@virajindasrao Hello will be able to use this anytime soon? Thanks |
@afurlani24 PR is under review right now. It will probably get merged by EOW or earlier next week. |
@virajindasrao So is this feature completed now? I noticed the PR was merged. |
@virajindasrao Hello should this be now working? I have provisioned a server using terraform then went in and change CPU count from 2 to 4 and says it changed however when I go out to vRA it still says 2 CPU.. is there something that I missing here? Thanks for your help! |
@afurlani24 Did you see any request placed on vRA against the CPU update? |
@virajindasrao Hello so had to place the binary in that Roaming folder under plugins so that it would work however now when I run my apply it kicks off the build in vRA and the build actually finishes in vRA but the command line throws an error.. so if I try and run a Plan again thinks it is not finished. When I used to run an apply it would say created pretty quickly and return the command prompt now it gives me the Still creating messages.. 1 error(s) occurred:
Terraform does not automatically rollback in the face of errors. C:\terraformvra>terraform plan vra7_resource.Linux: Refreshing state... (ID: c548882e-7a1c-43c1-a120-bd005401c945)
C:\terraformvra> |
@virajindasrao Seems to always fail at the 15m10s mark so something timing out? 1 error(s) occurred:
|
@virajindasrao I also added the wait_timeout and put it too 120 and it goes that long that fails.. |
@afurlani24 What do you see on vRA request tab? Is provisioning went through for the same request which is failed after 120 mins? |
@virajindasrao The requests always complete successfully on the vRA side regardless of the wait_timeout however I am never getting my terraform command line back it just keeps saying vra7_resource.Linux: Still creating... until it reaches the timeout set. I am never getting the creation complete message that I have always gotten "vra7_resource.RHEL_7_Full_Support: Creation complete (ID: 504686b1-83e3-4a14-aebc-a83cb4706137) |
@afurlani24 I tried and it went through for me. |
@virajindasrao No I am only creating one resource and the server builds in vRA but the command line never comes back and says Creation Complete it goes on until it reaches the timeout. So even when the server is done in vRA the terraform command line keeps going and does not think the build is done. Never had this problem before until downloaded new plugin. I will keep testing. Thanks |
Thanks for the updates @afurlani24 |
@virajindasrao Here is my config.. |
@virajindasrao I just ran one now and the server is complete in vRA and successful however my command line is still going.. |
@Marcvd316 Have you used the new plugin without any issues? |
I think this could be a great functionality to have.
An example use case is that I create a VM and once it is created, I then run a Resource Action on it.
Maybe this could be implemented in the form of a Terraform Provisioner of type "null_resource"?
https://www.terraform.io/docs/provisioners/null_resource.html
The text was updated successfully, but these errors were encountered: