terraform-provider-vcd icon indicating copy to clipboard operation
terraform-provider-vcd copied to clipboard

Add ability of reading/setting deployment and storage lease policy for vApps

Open dataclouder opened this issue 5 years ago • 1 comments

With PR #432, we have the ability to see and modify the lease policy of an organization, thus influencing the underlying vApps. We need the ability of seeing the lease policy for the vApp, and eventually changing it, as allowed by the Org rules (an expiration set in the Org can only be reduced, but not extended, in the vApp).

This feature requires an addition to go-vcloud-director, as our SDK doesn't currently provide visibility on the vApp lease.

The data structure is defined in the API manual. The operations needed are:

With the above functionalities in place, we will be able to update the vApp structure, with the following block:

 lease_policy {
    maximum_runtime_lease_in_sec          = 3600  # 1 hour
    maximum_storage_lease_in_sec          = 86400 # 1 day
  }

Note that power_off_on_runtime_lease_expiration and delete_on_storage_lease_expiration are inherited from the Org policy and can't be changed at vApp level.

dataclouder avatar Jan 22 '20 10:01 dataclouder

I'd love this feature addition.

I don't have direct control or access to modify the policy at my Org level. But I do have full control over my vApps. This feature would be great as I create and destroy vapps through AzDO pipeline, sometimes the pipelines fail at a level I don't directly control, leaving an orphaned vApp. Policy would auto nuke them at say 24 hours.

Cheers

ghost avatar Apr 14 '21 09:04 ghost

This was implemented in 3.5 -> https://registry.terraform.io/providers/vmware/vcd/latest/docs/resources/vapp#lease

Didainius avatar Jan 19 '23 08:01 Didainius