Skip to content

Commit

Permalink
automate-project-destroy
Browse files Browse the repository at this point in the history
  • Loading branch information
JohnyDev committed Oct 1, 2023
1 parent 80b18fe commit cbf0fa2
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions DevOps-Pipeline-Nodejs/Deploy-EKS/destroy.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#!/bin/bash

# Variables
cluster_name="cluster-1-test"
namespace="nodejs-app"
region="eu-central-1"
repo_name="nodejs-app"
# End Variables

# delete Docker-img from ECR
echo "--------------------Deleting ECR-IMG--------------------"
aws ecr batch-delete-image --repository-name $repo_name --image-ids imageTag=latest

# delete database secret
echo "--------------------Deleting DB Secret--------------------"
kubectl delete -n $namespace secret db-password-secret

# delete deployment
echo "--------------------Deleting Deployment--------------------"
kubectl delete -n $namespace -f k8s/

# delete namespace
echo "--------------------Deleting Namespace--------------------"
kubectl delete ns $namespace

# delete AWS resources
echo "--------------------Deleting AWS Resources--------------------"
cd terraform && \
terraform destroy -auto-approve

0 comments on commit cbf0fa2

Please sign in to comment.