Description
Code of Conduct
This project has a Code of Conduct that all participants are expected to understand and follow:
- I have read and agree to the project's Code of Conduct
Description
Our vRA imposes a lifetime on all deployments, i.e. they expire after 30 days. Afterwards the deployed VMs are powered off and not useable anymore until being deleted some time after.
For terraform, however, they still exist "in good state" -- attributes like last_request
and lease_expire_at
tell it has been expired and allow failing such a VM early using a postcondition, but I'm looking for a way to re-create such expired deployments.
Context is a scheduled CI pipeline which runs terraform followed by config management to ensure certain infrastructure (VM + application) is always present. Currently it fails in config management due to the expired VM being powered off, requiring manual destruction of the VM to recreate the setup.
This is a follow-up to #436 since even with it solved in #462 (thank you!) a workaround seems not to be possible (see hashicorp/terraform#31702).
Possible solutions
Adding a parameter to the resource (or provider?) recreate_expired: bool
is probably the best way to go
Describe alternatives you've considered
- workaround using
postcondition
withself.last_request.action_id != "Deployment.Expire"
-- works, but only fails plan/apply and requires manual action to trigger recreation replace_triggered_by
: cannot be applied to self, see linked terraform issue abovereplace_triggered_by
→data "vra_resource" { (same ID as the resource) }
(full example see linked tf issue above): data source fails when resource not yet exists
References
Community Note
- Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
- Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request
- If you are interested in working on this issue or have submitted a pull request, please leave a comment