diff --git a/changelogs/fragments/elasticache_info-ignore-CacheClusterNotFound-when-reading-tags.yaml b/changelogs/fragments/elasticache_info-ignore-CacheClusterNotFound-when-reading-tags.yaml new file mode 100644 index 00000000000..d8ef3c31c69 --- /dev/null +++ b/changelogs/fragments/elasticache_info-ignore-CacheClusterNotFound-when-reading-tags.yaml @@ -0,0 +1,3 @@ +--- +bugfixes: +- "elasticache_info - Ignore the CacheClusterNotFound exception when collecting tags (https://github.com/ansible-collections/community.aws/pull/1777)." diff --git a/plugins/modules/elasticache_info.py b/plugins/modules/elasticache_info.py index 1f8af9a330c..f6c34629edb 100644 --- a/plugins/modules/elasticache_info.py +++ b/plugins/modules/elasticache_info.py @@ -472,6 +472,9 @@ def get_elasticache_clusters(client, module): arn = "arn:aws:elasticache:%s:%s:cluster:%s" % (region, account_id, cluster['cache_cluster_id']) try: tags = get_elasticache_tags_with_backoff(client, arn) + except is_boto3_error_code("CacheClusterNotFound"): + # e.g: Cluster was listed but is in deleting state + continue except (botocore.exceptions.ClientError, botocore.exceptions.BotoCoreError) as e: module.fail_json_aws(e, msg="Couldn't get tags for cluster %s")