Closed BerryR-RBA closed 6 months ago
@BerryR-RBA [I'm going to preface this by saying it's been a while since I worked directly with vRA] but this tickled a memory. If memory serves, once the cloud account is configured/created it may be a few minutes before the inventory of all the resources in the vCenter occurs, so if you create the Zone immediately after it may not know about the compute resources yet, so you might need a delay between the creation of the cloud account and the zone (maybe using something like time_sleep?)
I think you are correct.
If I create the cloud account on its own, then add the cloud zone in a second pass, it works.
Adding a 60 second delay to the cloud account resource works around the issue:
resource "vra_cloud_account_vsphere" "demo" {
name = "Demo Account"
hostname = var.vcenter_hostname
username = var.vcenter_username
password = var.vcenter_password
regions = [var.vcenter_region]
accept_self_signed_cert = true
provisioner "local-exec" {
interpreter = ["pwsh", "-Command"]
command = "Start-Sleep -Seconds 60"
}
}
It would be ideal if we could wait for a resource to be ready, not just created. But there is no interface in Terraform or the vRA provider to support that, so this workaround will have to do.
Also noting that a time_sleep resource is preferred to the local-exec provisioner. We've avoided it because the provider is not currently available in our environment.
Thanks @cars for the help.
Code of Conduct
This project has a Code of Conduct that all participants are expected to understand and follow:
vRA Version
VMware Aria Automation 8.14.1.33478
Terraform Version
Terraform v1.7.2 on windows_amd64
vRA Terraform Provider Version
local/vmware/vra v0.8.6
Affected Resource(s)
vra_zone
Terraform Configuration Files
Expected Behavior
Newly created Cloud Zones have compute resources
Actual Behavior
Newly created Cloud Zones do not have compute resources
Steps to Reproduce
Apply the config to an empty Aria Automation instance:
Debug log is https://gist.github.com/BerryR-RBA/ea0975a819c05116414883f64c9c37ac#file-20240214-36-debug
Inspect the Cloud Zone in Assembler, which shows 0 compute resources.
Reapply the config multiple times. Results are identical.
Delete the zone from the config:
Reapply:
Confirm that the Cloud Zone is deleted from Assembler.
Restore the previous version of the config, and reapply:
Debug log is https://gist.github.com/BerryR-RBA/ea0975a819c05116414883f64c9c37ac#file-20240214-40-debug
Inspect the Cloud Zone in Assembler, which shows 5 compute resources.
Why does an identical config produce different results?
Screenshots
See above
Debug Output
See above
Panic Output
N/A
Important Factoids
References
N/A
Community Note