diff --git a/plugins/modules/hcloud_load_balancer.py b/plugins/modules/hcloud_load_balancer.py index 521162c..33a1b66 100644 --- a/plugins/modules/hcloud_load_balancer.py +++ b/plugins/modules/hcloud_load_balancer.py @@ -216,9 +216,9 @@ class AnsibleHcloudLoadBalancer(Hcloud): self._mark_as_changed() delete_protection = self.module.params.get("delete_protection") - if delete_protection is not None and delete_protection != self.hcloud_network.protection["delete"]: + if delete_protection is not None and delete_protection != self.hcloud_load_balancer.protection["delete"]: if not self.module.check_mode: - self.hcloud_network.change_protection(delete=delete_protection).wait_until_finished() + self.hcloud_load_balancer.change_protection(delete=delete_protection).wait_until_finished() self._mark_as_changed() self._get_load_balancer() except APIException as e: diff --git a/tests/integration/targets/hcloud_load_balancer/tasks/main.yml b/tests/integration/targets/hcloud_load_balancer/tasks/main.yml index 283adf5..46ce15e 100644 --- a/tests/integration/targets/hcloud_load_balancer/tasks/main.yml +++ b/tests/integration/targets/hcloud_load_balancer/tasks/main.yml @@ -70,7 +70,6 @@ that: - result_after_test is changed - result_after_test.hcloud_load_balancer.delete_protection is sameas true - - result_after_test.hcloud_load_balancer.rebuild_protection is sameas true - name: test Load Balancer without protection set to be idempotent hcloud_load_balancer: @@ -81,7 +80,6 @@ that: - result_after_test is not changed - result_after_test.hcloud_load_balancer.delete_protection is sameas true - - result_after_test.hcloud_load_balancer.rebuild_protection is sameas true - name: test delete Load Balancer fails if it is protected hcloud_load_balancer: