From eda1442560e9883d768c05e75f0b573e1e9992f3 Mon Sep 17 00:00:00 2001 From: Adam <1392689+coffeegist@users.noreply.github.com> Date: Thu, 27 Jun 2024 15:17:56 -0500 Subject: [PATCH] * Delete each instance if multiple IDs returned --- providers/aws-functions.sh | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/providers/aws-functions.sh b/providers/aws-functions.sh index ccdba72d..cf805ad0 100644 --- a/providers/aws-functions.sh +++ b/providers/aws-functions.sh @@ -99,9 +99,11 @@ get_image_id() { #deletes instance, if the second argument is set to "true", will not prompt delete_instance() { name="$1" - id="$(instance_id "$name")" - echo "$id" - aws ec2 terminate-instances --instance-ids "$id" 2>&1 >> /dev/null + ids=($(instance_id "$name")) + for id in "${ids[@]}"; do + echo "$id" + aws ec2 terminate-instances --instance-ids "$id" 2>&1 >> /dev/null + done } # TBD