Skip to content

Commit

Permalink
Ignore errors in grep
Browse files Browse the repository at this point in the history
  • Loading branch information
niallthomson authored Jul 16, 2024
1 parent 9f41578 commit 1825c5c
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions manifests/modules/security/cam/.workshop/cleanup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,20 @@ logmessage "Cleaning up cluster access entries..."

kubectl delete -k ~/environment/eks-workshop/modules/security/cam/rbac --ignore-not-found

read_only_check=$(aws eks list-access-entries --cluster-name $EKS_CLUSTER_NAME --output text | grep $READ_ONLY_IAM_ROLE)
read_only_check=$(aws eks list-access-entries --cluster-name $EKS_CLUSTER_NAME --output text | grep $READ_ONLY_IAM_ROLE || true)

if [ ! -z "$read_only_check" ]; then
aws eks delete-access-entry --cluster-name $EKS_CLUSTER_NAME --principal-arn $READ_ONLY_IAM_ROLE
fi

carts_check=$(aws eks list-access-entries --cluster-name $EKS_CLUSTER_NAME --output text | grep $CARTS_TEAM_IAM_ROLE)
carts_check=$(aws eks list-access-entries --cluster-name $EKS_CLUSTER_NAME --output text | grep $CARTS_TEAM_IAM_ROLE || true)

if [ ! -z "$carts_check" ]; then
aws eks delete-access-entry --cluster-name $EKS_CLUSTER_NAME --principal-arn $CARTS_TEAM_IAM_ROLE
fi

admins_check=$(aws eks list-access-entries --cluster-name $EKS_CLUSTER_NAME --output text | grep $ADMINS_IAM_ROLE)
admins_check=$(aws eks list-access-entries --cluster-name $EKS_CLUSTER_NAME --output text | grep $ADMINS_IAM_ROLE || true)

if [ ! -z "$admins_check" ]; then
aws eks delete-access-entry --cluster-name $EKS_CLUSTER_NAME --principal-arn $ADMINS_IAM_ROLE
fi
fi

0 comments on commit 1825c5c

Please sign in to comment.