1
0
Fork 0
mirror of https://github.com/ansible-collections/hetzner.hcloud.git synced 2026-02-04 08:01:49 +00:00

Allow creating resources with protection (#30)

* Allow all supporting resources to be created with protection

Signed-off-by: Lukas Kämmerling <lukas.kaemmerling@hetzner-cloud.de>
This commit is contained in:
Lukas Kämmerling 2020-10-01 11:09:51 +02:00 committed by GitHub
parent 87d989fcbe
commit fe84174cb6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 275 additions and 2 deletions

View file

@ -217,6 +217,11 @@ class AnsibleHcloudLoadBalancer(Hcloud):
resp = self.client.load_balancers.create(**params)
resp.action.wait_until_finished(max_retries=1000)
delete_protection = self.module.params.get("delete_protection")
if delete_protection is not None:
self._get_load_balancer()
self.hcloud_load_balancer.change_protection(delete=delete_protection).wait_until_finished()
self._mark_as_changed()
self._get_load_balancer()