Skip to content

Commit

Permalink
azure_rm_loadbalancecer - Add support enable_tcp_reset to `load_b…
Browse files Browse the repository at this point in the history
…alancing_rules` (#1774)

* Add support 'enable_tcp_reset' to azure_rm_loadbalancecer

* small change
  • Loading branch information
Fred-sun authored Dec 6, 2024
1 parent 6bd15a1 commit 6e4a9af
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
9 changes: 9 additions & 0 deletions plugins/modules/azure_rm_loadbalancer.py
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,11 @@
description:
- Configures a virtual machine's endpoint for the floating IP capability required to configure a SQL AlwaysOn Availability Group.
type: bool
enable_tcp_reset:
description:
- Receive bidirectional TCP Reset on TCP flow idle timeout or unexpected connection termination.
- This element is only used when the protocol is set to TCP.
type: bool
disable_outbound_snat:
description:
- Configure outbound source network address translation (SNAT).
Expand Down Expand Up @@ -560,6 +565,9 @@
type='bool',
default=False
),
enable_tcp_reset=dict(
type='bool'
)
)


Expand Down Expand Up @@ -745,6 +753,7 @@ def exec_module(self, **kwargs):
backend_port=item.get('backend_port'),
idle_timeout_in_minutes=item.get('idle_timeout'),
enable_floating_ip=item.get('enable_floating_ip'),
enable_tcp_reset=item.get('enable_tcp_reset'),
disable_outbound_snat=item.get('disable_outbound_snat'),
) for item in self.load_balancing_rules] if self.load_balancing_rules else None

Expand Down
15 changes: 15 additions & 0 deletions tests/integration/targets/azure_rm_loadbalancer/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@
idle_timeout: 4
load_distribution: Default
protocol: Tcp
enable_tcp_reset: true
register: output

- name: Assert complex load balancer created
Expand Down Expand Up @@ -165,6 +166,7 @@
idle_timeout: 4
load_distribution: Default
protocol: Tcp
enable_tcp_reset: true
register: output

- name: Assert that output has not changed
Expand Down Expand Up @@ -205,13 +207,26 @@
idle_timeout: 4
load_distribution: Default
protocol: Tcp
enable_tcp_reset: false
register: output

- name: Assert that output has changed
ansible.builtin.assert:
that:
- output.changed

- name: Get the load balancer facts
azure_rm_loadbalancer_info:
resource_group: '{{ resource_group }}'
name: "{{ lbname_b }}"
register: output

- name: Assert the load balancer facts
ansible.builtin.assert:
that:
- output.loadbalancers[0].load_balancing_rules[0].enable_tcp_reset is false
- output.loadbalancers[0].load_balancing_rules[0].frontend_port == 81

- name: Delete load balancer
azure_rm_loadbalancer:
resource_group: '{{ resource_group }}'
Expand Down

0 comments on commit 6e4a9af

Please sign in to comment.