fix: firewall port argument is required with udp or tcp (#345)

##### SUMMARY

When managing a tcp/udp firewall rule, provide a clear error message
when the port is missing from the rule.

Closes #344

##### ISSUE TYPE

- Bugfix Pull Request


##### COMPONENT NAME

hcloud_firewall
This commit is contained in:
Jonas L 2023-10-04 10:59:50 +02:00 committed by GitHub
parent dc6583157d
commit 76c1abf447
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 0 deletions

View file

@ -0,0 +1,2 @@
bugfixes:
- hcloud_firewall - The port argument is required when the firewall rule protocol is `udp` or `tcp`.

View file

@ -314,6 +314,10 @@ class AnsibleHCloudFirewall(AnsibleHCloud):
description={"type": "str"},
),
required_together=[["direction", "protocol"]],
required_if=[
["protocol", "udp", ["port"]],
["protocol", "tcp", ["port"]],
],
),
labels={"type": "dict"},
state={