fix: handle security group updates on ElastiCache modify operations - #2438
fix: handle security group updates on ElastiCache modify operations#2438kkonaparthi1 wants to merge 2 commits into
Conversation
Fix two issues with security group handling during cluster modifications:
1. CacheSecurityGroups KeyError: The _requires_modification() method
accessed self.data['CacheSecurityGroups'] directly, which raises a
KeyError for VPC-based clusters that don't have this key. Changed to
use self.data.get('CacheSecurityGroups', []) and only check when
cache_security_groups is specified.
2. Empty security group parameters: The modify() method always passed
CacheSecurityGroupNames and SecurityGroupIds even when empty, which
could cause API errors. Changed to only include these parameters in
the modify_cache_cluster call when they are actually specified.
Fixes ansible-collections#661
Signed-off-by: Karthik Konaparthi <konapk@amazon.com>
|
Build failed.
|
Signed-off-by: Karthik Konaparthi <konapk@amazon.com>
|
Build failed.
|
Fixes #661
Summary
Fix security group handling during ElastiCache cluster modifications that caused a
KeyError: 'SecurityGroups'and prevented security group updates from being applied.Changes
_requires_modification(): Use.get()with default empty list for bothCacheSecurityGroupsandSecurityGroupskeys to avoid KeyError on VPC-based clusters_requires_modification(): Only check cache security groups whencache_security_groupsis specified (matching the existing pattern for VPC security groups)modify(): Only includeCacheSecurityGroupNamesandSecurityGroupIdsin the API call when they are actually specified, avoiding errors from passing empty listsBackwards Compatible
No behavior change for existing playbooks. Clusters that already had matching security groups will continue to show no changes needed.