From 8db1a9d0373d6334dc0127dded167fc5be2698e1 Mon Sep 17 00:00:00 2001 From: Sid Patel Date: Tue, 16 Jun 2020 10:57:34 -0400 Subject: [PATCH] only set shardid params when more shards --- plugins/modules/kinesis_stream.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/plugins/modules/kinesis_stream.py b/plugins/modules/kinesis_stream.py index e41a5fa6460..9ef1d040864 100644 --- a/plugins/modules/kinesis_stream.py +++ b/plugins/modules/kinesis_stream.py @@ -362,7 +362,8 @@ def find_stream(client, stream_name, check_mode=False): ) shards.extend(results.pop('Shards')) has_more_shards = results['HasMoreShards'] - params['ExclusiveStartShardId'] = shards[-1]['ShardId'] + if has_more_shards: + params['ExclusiveStartShardId'] = shards[-1]['ShardId'] results['Shards'] = shards num_closed_shards = len([s for s in shards if 'EndingSequenceNumber' in s['SequenceNumberRange']]) results['OpenShardsCount'] = len(shards) - num_closed_shards