Skip to content

Commit

Permalink
adding firewall_id field
Browse files Browse the repository at this point in the history
  • Loading branch information
jriddle-linode committed Sep 18, 2023
1 parent 5f0a010 commit bac59de
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
1 change: 1 addition & 0 deletions docs/modules/nodebalancer.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ Manage a Linode NodeBalancer.
| `state` | <center>`str`</center> | <center>**Required**</center> | The desired state of the target. **(Choices: `present`, `absent`)** |
| `client_conn_throttle` | <center>`int`</center> | <center>Optional</center> | Throttle connections per second. Set to 0 (zero) to disable throttling. **(Updatable)** |
| `region` | <center>`str`</center> | <center>Optional</center> | The ID of the Region to create this NodeBalancer in. |
| `firewall_id` | <center>`int`</center> | <center>Optional</center> | The ID of the Firewall to assign this NodeBalancer to. |
| [`configs` (sub-options)](#configs) | <center>`list`</center> | <center>Optional</center> | A list of configs to apply to the NodeBalancer. **(Updatable)** |

### configs
Expand Down
7 changes: 6 additions & 1 deletion plugins/modules/nodebalancer.py
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,10 @@
type=FieldType.string,
description=["The ID of the Region to create this NodeBalancer in."],
),
"firewall_id": SpecField(
type=FieldType.integer,
description=["The ID of the Firewall to assign this NodeBalancer to."],
),
"state": SpecField(
type=FieldType.string,
description=["The desired state of the target."],
Expand Down Expand Up @@ -342,9 +346,10 @@ def _create_nodebalancer(self) -> Optional[NodeBalancer]:
params = self.module.params
label = params.get("label")
region = params.get("region")
firewall_id = params.get("firewall_id")

try:
return self.client.nodebalancer_create(region, label=label)
return self.client.nodebalancer_create(region, label=label, firewall_id=firewall_id)
except Exception as exception:
return self.fail(
msg="failed to create nodebalancer: {0}".format(exception)
Expand Down

0 comments on commit bac59de

Please sign in to comment.