mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Fail when attempting to modify unmodifiable target group parameters (#33246)
* Fail when attempting to modify unmodifiable target group parameters As you can't modify Port, Protocol or VPC id for a target group, fail when this happens rather than pretending to do it. One could argue that the target group could be recreated rather than failing, but this has massive knock on implications to other resources that depend on the TG (all ASGs would need to be updated, the ELB listener would need to be updated, etc) * Use `.get()` instead of direct dictionary access
This commit is contained in:
parent
55cd1f3377
commit
d13d7e9404
1 changed files with 5 additions and 0 deletions
|
@ -384,6 +384,11 @@ def create_or_update_target_group(connection, module):
|
|||
tg = get_target_group(connection, module)
|
||||
|
||||
if tg:
|
||||
diffs = [param for param in ('Port', 'Protocol', 'VpcId')
|
||||
if tg.get(param) != params.get(param)]
|
||||
if diffs:
|
||||
module.fail_json(msg="Cannot modify %s parameter(s) for a target group" %
|
||||
", ".join(diffs))
|
||||
# Target group exists so check health check parameters match what has been passed
|
||||
health_check_params = dict()
|
||||
|
||||
|
|
Loading…
Reference in a new issue