Skip to content

Commit 6a286a2

Browse files
committed
fix: use get_account_name
1 parent 29f729c commit 6a286a2

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

scripts/destroy/lib/common.sh

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -212,3 +212,25 @@ is_management_account() {
212212
current_account=$(get_current_account)
213213
[[ "$current_account" == "$MANAGEMENT_ACCOUNT_ID" ]]
214214
}
215+
216+
# Get account name/environment from account ID
217+
get_account_name() {
218+
local account_id="$1"
219+
220+
if [[ "$account_id" == "$DEV_ACCOUNT" ]]; then
221+
echo "Dev"
222+
elif [[ "$account_id" == "$STAGING_ACCOUNT" ]]; then
223+
echo "Staging"
224+
elif [[ "$account_id" == "$PROD_ACCOUNT" ]]; then
225+
echo "Prod"
226+
elif [[ "$account_id" == "$MANAGEMENT_ACCOUNT_ID" ]]; then
227+
echo "Management"
228+
else
229+
echo "Unknown"
230+
fi
231+
}
232+
233+
# Alias for compatibility with s3.sh
234+
get_env_name_for_account() {
235+
get_account_name "$1"
236+
}

0 commit comments

Comments
 (0)