vmware / terraform-provider-vra

Terraform Provider for VMware Aria Automation
https://registry.terraform.io/providers/vmware/vra/
Mozilla Public License 2.0
103 stars 90 forks source link

lease_expire_at null in tfstate, but date in webapi #436

Closed azrdev closed 1 year ago

azrdev commented 2 years ago

Code of Conduct

This project has a Code of Conduct that all participants are expected to understand and follow:

vRA Version

vRealize Automation 8.8.0.22148 (19691889)

Terraform Version

Terraform v1.1.9

vRA Terraform Provider Version

Affected Resource(s)

Terraform Configuration Files

# Copy-paste your Terraform configurations here.
# For large Terraform configs, please use a service like Dropbox and share a link to the ZIP file.

Expected Behavior

Our vRA imposes a lifetime on all deployments, i.e. they expire after 30 days. This is displayed in the web UI, and the browser console shows the displayed date comes in an API response from https://vra.example.com/deployment/api/deployments like

{
  "content": [
    {
      "name": "test",
      "leaseExpireAt": "2022-05-26T10:54:00Z",
      ...

However the terraform.tfstate contains among instance properties "lease_expire_at": null,.

Actual Behavior

Terraform knowing the expiration date (and better yet the expiration state -- the underlying issue is that our VMs are known to terraform as existing fine, although they are expired and thus inaccessible to users)

Steps to Reproduce

  1. terraform import vra_deployment $UUID
  2. grep expire terraform.tfstate

Screenshots

Debug Output

Important Factoids

References

Community Note

azrdev commented 2 years ago

looks like the relevant code is at https://github.com/vmware/terraform-provider-vra/blob/690aa71fe1fb3a81a767cde0dc7a7c95ce589f04/vra/resource_deployment.go#L399 but to get further s/o with more go (and the auto-generated api client code) knowledge would be needed

azrdev commented 2 years ago

I'm frequently running into my VMs expiring and terraform still returning them just fine, requiring manual interaction. I believe fixing this issue would allow me to build a workaround (using replace_triggered_by), what would it take to fix it?