Skip to content

Commit

Permalink
added destroy
Browse files Browse the repository at this point in the history
  • Loading branch information
schijioke-uche committed Mar 15, 2021
1 parent 88386f2 commit 8e5b29e
Showing 1 changed file with 98 additions and 0 deletions.
98 changes: 98 additions & 0 deletions AksTerraform/terradestroy.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@

#!/bin/bash

#Set the script for EOL
sed -i 's/\r//' terradestroy.sh

#Author: Jeffrey Solomon Chijioke-Uche (MSIT, MSIS) - United States
#Softwareid: MZ-68922876-0004
#Usage: Terraform Auto Deployment to Azure
#Model: AzureRM 1.36.0 = 2.0+
#Knowledgebase Number: [098126-2021]
#Strategy for updating Docker image when required.

# /\ M I C R O S O F T (C)
# / \ _____ _ _ ___ _
# / /\ \ |_ / | | | \'__/ _\
# / ____ \ / /| |_| | | | __/
# /_/ \_\/___|\__,_|_| \___| T E R R A F O R M S O F T W A R E (R)


#System Pre-requisites:
#-Terraform plugin.
#-Azure CLI plugin.
#-Bash (Bourne shell) plugin.
#-Az aks plugin.
#===================================================================================

function sa(){
#Service Account: [DO NOT USE SERVICE PRINCIPAL]
SA_USR="{SUPPLY}"
SA_PWD="{SUPPLY}"
}

function authenticate(){
#Authenticate
az login -u $SA_USR --p $SA_PWD
cProcesswait
}


function destroy(){
#Destroy
terraform destroy -auto-approve -input=false
cProcesswait
azure
}


#Process Wait:
function cProcesswait(){
sleep 10s & PID=$!
echo -e "Please wait..."
printf "["
while kill -0 $PID 2> /dev/null; do
printf ""
sleep 2
done
printf "] ${GREEN}done!${NOCOLOR}"
echo -e ""
}

#Process indicators:
function Indicators(){
NOCOLOR='\033[0m'
RED='\033[0;31m'
GREEN='\033[0;32m'
ORANGE='\033[0;33m'
BLUE='\033[0;34m'
PURPLE='\033[0;35m'
CYAN='\033[0;36m'
LIGHTGRAY='\033[0;37m'
DARKGRAY='\033[1;30m'
LIGHTRED='\033[1;31m'
LIGHTGREEN='\033[1;32m'
YELLOW='\033[1;33m'
LIGHTBLUE='\033[1;34m'
LIGHTPURPLE='\033[1;35m'
LIGHTCYAN='\033[1;36m'
WHITE='\033[1;37m'
}
#END: Optum-Z9773-2019
function azure(){
echo -e "${GREEN}Azure Cloud Deployment Completed!${NOCOLOR}"
echo -e "${GREEN}
/---\ M I C R O S O F T
/ _ \ __________ _________ ____
/ /_\ \\___ / | \_ __ \_/ __ \
/ | \/ /| | /| | \/\ ___/
\____|__ /_____ \____/ |__| \___ >
\/ \/ \/
I N F R A S T R U C T U R E AS C O D E D E P L O Y M E N T ${NOCOLOR}"
}
#Exec::::::::::::::::::::::#
Indicators
sa
authenticate
destroy
#Exec::::::::::::::::::::::#

0 comments on commit 8e5b29e

Please sign in to comment.