From d14a08dbcc2d6ce250ee51d51ed0059e5157adb8 Mon Sep 17 00:00:00 2001 From: jo Date: Wed, 5 Nov 2025 16:12:42 +0100 Subject: [PATCH] chore: comment --- plugins/modules/load_balancer_network.py | 2 ++ plugins/modules/server_network.py | 2 ++ 2 files changed, 4 insertions(+) diff --git a/plugins/modules/load_balancer_network.py b/plugins/modules/load_balancer_network.py index 508c368..a5304bb 100644 --- a/plugins/modules/load_balancer_network.py +++ b/plugins/modules/load_balancer_network.py @@ -192,6 +192,8 @@ class AnsibleHCloudLoadBalancerNetwork(AnsibleHCloud): if ip_range is not None: ip_range_network = ip_network(ip_range) if ip_range_network not in [ip_network(o.ip_range) for o in self.hcloud_network.subnets]: + # Validate before "detach" instead of relying on the "attach" API + # validation, leaving the resource in a half applied state. self.module.fail_json(msg=f"ip_range '{ip_range}' was not found in the network subnets") if ip_address(self.hcloud_load_balancer_network.ip) not in ip_range_network: diff --git a/plugins/modules/server_network.py b/plugins/modules/server_network.py index 3536792..58cf7e5 100644 --- a/plugins/modules/server_network.py +++ b/plugins/modules/server_network.py @@ -206,6 +206,8 @@ class AnsibleHCloudServerNetwork(AnsibleHCloud): if ip_range is not None: ip_range_network = ip_network(ip_range) if ip_range_network not in [ip_network(o.ip_range) for o in self.hcloud_network.subnets]: + # Validate before "detach" instead of relying on the "attach" API + # validation, leaving the resource in a half applied state. self.module.fail_json(msg=f"ip_range '{ip_range}' was not found in the network subnets") if ip_address(self.hcloud_server_network.ip) not in ip_range_network: