From a3feea79b1bed7d0c48fee555365814b59d17c2d Mon Sep 17 00:00:00 2001 From: travis Date: Mon, 19 Apr 2021 06:41:45 +1200 Subject: [PATCH 1/4] Collect arguments for application session stickiness and update docs --- elb_target_group.py | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/elb_target_group.py b/elb_target_group.py index 4980fc797ad..8d39fb3eae1 100644 --- a/elb_target_group.py +++ b/elb_target_group.py @@ -102,9 +102,21 @@ - The time period, in seconds, during which requests from a client should be routed to the same target. After this time period expires, the load balancer-generated cookie is considered stale. The range is 1 second to 1 week (604800 seconds). type: int + stickiness_app_cookie_duration: + description: + - The time period, in seconds, during which requests from a client + should be routed to the same target. After this time period expires, + the application-generated cookie is considered stale. The range is 1 second to 1 week (604800 seconds). + type: int + stickiness_app_cookie_name: + description: + - The name of the application cookie. Required if stickiness_type is + C(app_cookie). + type: string stickiness_type: description: - The type of sticky sessions. + - C(lb_cookie), C(app_cookie) or C(source_ip) - If not set AWS will default to C(lb_cookie) for Application Load Balancers or C(source_ip) for Network Load Balancers. type: str successful_response_codes: @@ -466,6 +478,8 @@ def create_or_update_target_group(connection, module): stickiness_enabled = module.params.get("stickiness_enabled") stickiness_lb_cookie_duration = module.params.get("stickiness_lb_cookie_duration") stickiness_type = module.params.get("stickiness_type") + stickiness_app_cookie_duration = module.params.get("stickiness_app_cookie_duration") + stickiness_app_cookie_name = module.params.get("stickiness_app_cookie_name") health_option_keys = [ "health_check_path", "health_check_protocol", "health_check_interval", "health_check_timeout", @@ -753,6 +767,12 @@ def create_or_update_target_group(connection, module): if stickiness_type is not None: if stickiness_type != current_tg_attributes.get('stickiness_type'): update_attributes.append({'Key': 'stickiness.type', 'Value': stickiness_type}) + if stickiness_app_cookie_name is not None: + if stickiness_app_cookie_name != current_tg_attributes.get('stickiness_app_cookie_name'): + update_attributes.append({'Key': 'stickiness.app_cookie.cookie_name', 'Value': str(stickiness_app_cookie_name)}) + if stickiness_app_cookie_duration is not None: + if str(stickiness_app_cookie_duration) != current_tg_attributes['stickiness_app_cookie_duration_seconds']: + update_attributes.append({'Key': 'stickiness.app_cookie.duration_seconds', 'Value': str(stickiness_app_cookie_duration)}) if update_attributes: try: @@ -833,6 +853,8 @@ def main(): stickiness_enabled=dict(type='bool'), stickiness_type=dict(), stickiness_lb_cookie_duration=dict(type='int'), + stickiness_app_cookie_duration=dict(type='int'), + stickiness_app_cookie_name=dict(), state=dict(required=True, choices=['present', 'absent']), successful_response_codes=dict(), tags=dict(default={}, type='dict'), From 9ffdb72dfe7ec525b6a0659219e3170f1e3a8006 Mon Sep 17 00:00:00 2001 From: Travis Holton Date: Mon, 19 Apr 2021 22:09:48 +1200 Subject: [PATCH 2/4] Fix datatype of docs --- elb_target_group.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/elb_target_group.py b/elb_target_group.py index 8d39fb3eae1..7cf1cef2a7e 100644 --- a/elb_target_group.py +++ b/elb_target_group.py @@ -110,9 +110,9 @@ type: int stickiness_app_cookie_name: description: - - The name of the application cookie. Required if stickiness_type is + - The name of the application cookie. Required if C(stickiness_type) is C(app_cookie). - type: string + type: str stickiness_type: description: - The type of sticky sessions. From 295f4cff99b53d4830cde39f1121b71f208c8d7d Mon Sep 17 00:00:00 2001 From: Travis Holton Date: Mon, 26 Apr 2021 12:28:13 +1200 Subject: [PATCH 3/4] Add version_added to docs and changelog entry --- elb_target_group.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/elb_target_group.py b/elb_target_group.py index 7cf1cef2a7e..42367323638 100644 --- a/elb_target_group.py +++ b/elb_target_group.py @@ -108,11 +108,13 @@ should be routed to the same target. After this time period expires, the application-generated cookie is considered stale. The range is 1 second to 1 week (604800 seconds). type: int + version_added: 1.5.0 stickiness_app_cookie_name: description: - The name of the application cookie. Required if C(stickiness_type) is C(app_cookie). type: str + version_added: 1.5.0 stickiness_type: description: - The type of sticky sessions. From c831cc49e963457963006a8a04fdb22608b5fc37 Mon Sep 17 00:00:00 2001 From: Mark Chappell Date: Mon, 26 Apr 2021 09:14:04 +0200 Subject: [PATCH 4/4] Minor docs tweaks --- elb_target_group.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/elb_target_group.py b/elb_target_group.py index 42367323638..53a25fa4419 100644 --- a/elb_target_group.py +++ b/elb_target_group.py @@ -111,14 +111,13 @@ version_added: 1.5.0 stickiness_app_cookie_name: description: - - The name of the application cookie. Required if C(stickiness_type) is - C(app_cookie). + - The name of the application cookie. Required if I(stickiness_type=app_cookie). type: str version_added: 1.5.0 stickiness_type: description: - The type of sticky sessions. - - C(lb_cookie), C(app_cookie) or C(source_ip) + - Valid values are C(lb_cookie), C(app_cookie) or C(source_ip). - If not set AWS will default to C(lb_cookie) for Application Load Balancers or C(source_ip) for Network Load Balancers. type: str successful_response_codes: