-
Notifications
You must be signed in to change notification settings - Fork 35
Returning dynamic IP-address from VRA to Terraform #136
Comments
@leander091 Yes, you are right, the ip_address is not assigned as soon as the resource creation is successful. Looking into this issue. |
Hi @leander091 I was looking if terraform provides a way to add a pause or delay. I have found this It says you can write a local_exec provisioner. Let me know if this helps your use case. Thanks, |
Hello @Prativa20 Thanks for the update. I am going to add a local_exec provisioner to pause the executing until the VRA data collection has finished en the IP is returned. I will keep you posted EDIT I think there could be a cleaner option at the provider level. Maybe a optional option to mark the resource as provisioned if the IP-address is available in VRA and not before. |
I have this exact problem. Replace |
I figured it out. I am now using the FQDN of the new VM. The key was understanding that my instance of vRA is set up so that the VMs are called There were definitely some mental leaps involved, and I'm sure I had to have seen all the other examples and made all the mistakes i did in order for my brain to put it all together at that moment. Whatever the mechanism, this code now WORKS: in resource block
in provisioner block
Now, of course, on to the next brick wall... but I figured this out. And I intend to pay it forward to the community. For others coming to this with the same question, you are looking for the Component Name in your vRa item's machine listing. Another note: If you are creating multiple machines using count > 1, to output or otherwise access those machine names outside of that block, you have to
|
Hi @Prativa20 Looks like the ip_address field in the resourceView is only loaded after a state collection. At least on vRealize Automation version 7.6 Could we use the NETWORK_ADDRESS from the NETWORK_LIST data map instead, which is available right away?
|
FYI Opened an issue on the terraform-providers git page Thanks! |
only terraform version with 0.11.8 and 0.11.13 are having the vra7 plugin as default. with the latest version or any other version of terraform will not work. |
I'm not sure what you're referring to here, could you please elaborate? |
Hello, Is there a work around to connecting in order to do a remote-exec in the newly vRA provisioned machine? |
@danf425 that sounds like a DNS issue outside of terraform. Are you using the patterns shown above? Can you use Also note that the |
@mcascone Thanks for the quick reply!
This is my connection:
I am able to get my machine's name. I've seen that some people were able to ssh with just this. So my only option seems to be to get that ip_address. Even within vRA (The UI), the ip_address takes ~10 minutes to populate. I'm currently trying to output the information without any
So far no luck, but I'm hoping somebody has figured out a way to do all of this. |
Can you connect to If it is, you could add the domain to the name string:
I haven't tested this exact code, obviously, but I use the join in my TF code elsewhere. As for the syntax change in TF 0.12,
Should become
I've found that 0.12 doesn't enforce removing the interpolations, but it's preferred. To access the
This new syntax took me a while to nail down. Happy to share! |
@mcascone My problem here seems to be with vRA/vSphere rather than my TF code, which is unfortunate. My initial thought was that if I did a simple I'm currently exploring the possibility of spinning up an instance with a static IP as a workaround. |
It sounds like the IP is assigned, but doesn't propagate to vRA right away. |
Hi @danf425 From what i understand, your virtual machine network is assigned by DHCP in your blueprint. If this is the case, then this behavior is normal. Since vRA doesn't assign the IP it won't be available to retrieve the IP until a State Collection is performed (every 15 minutes by default). This is explaining also the behavior your describing in the UI. If you use a static IP, then you will be able to retrieve the IP right within your deployment, you can refer to @mcascone examples. I would also suggest to use the latest and certified version of the provider which you can find here There's an issue with the way vRA poulates the ip_adress metadata on version 7.6.0 which you can read here In the case you wish to go with DNS, i've seen some issue with populating DNS (due to replication), you can add a sleep in your main.tf file if you want
|
vRA 7.x version
7.4
Terraform version
v0.11.11
terraform-provider-vra7 plugin version
master
Describe the bug
I'm trying to execute the remote-exec provisioner on a machine created with the provider. The machine has created successfully but the provisioner fails because of the missing ip-address.
Is it possible pause the executing until VRA has received the ip-address?
I can update my environment after deployment with
terraform refresh
but that is not useful in this case.To Reproduce
Steps to reproduce the behavior:
Logs
Attach logs to help debug the issue
Desktop (please complete the following information):
The text was updated successfully, but these errors were encountered: