diff --git a/lab/iam/policies/labs3.yaml b/lab/iam/policies/labs3.yaml index db59d58a0..2bab241f5 100644 --- a/lab/iam/policies/labs3.yaml +++ b/lab/iam/policies/labs3.yaml @@ -13,7 +13,7 @@ Statement: - s3:DeleteObject - s3:DeleteObjectVersion Resource: - - arn:aws:s3:::eks-workshop-canary-artifacts* + - arn:aws:s3:::${Env}-* - arn:aws:s3:::aws-synthetics-library* - Effect: Allow Action: diff --git a/manifests/modules/fundamentals/storage/s3/.workshop/cleanup.sh b/manifests/modules/fundamentals/storage/s3/.workshop/cleanup.sh index 738c61225..42bff7e64 100644 --- a/manifests/modules/fundamentals/storage/s3/.workshop/cleanup.sh +++ b/manifests/modules/fundamentals/storage/s3/.workshop/cleanup.sh @@ -4,18 +4,18 @@ set -e +logmessage "Deleting assets-images folder..." + # Delete local directory of image files rm -rf ~/environment/assets-images/ -logmessage "Deleting assets-images folder..." - addon_exists=$(aws eks list-addons --cluster-name $EKS_CLUSTER_NAME --query "addons[? @ == 'aws-mountpoint-s3-csi-driver']" --output text) +logmessage "Scaling down assets deployment..." + # Scale down assets kubectl scale -n assets --replicas=0 deployment/assets -logmessage "Scaling down assets deployment..." - # Check if the S3 CSI driver addon exists if [ ! -z "$addon_exists" ]; then # Delete if addon exists @@ -26,10 +26,10 @@ if [ ! -z "$addon_exists" ]; then aws eks wait addon-deleted --cluster-name $EKS_CLUSTER_NAME --addon-name aws-mountpoint-s3-csi-driver fi +logmessage "Deleting PV and PVC that were created..." + # Delete PVC kubectl delete pvc s3-claim -n assets --ignore-not-found=true # Delete PV -kubectl delete pv s3-pv --ignore-not-found=true - -logmessage "Deleting PV and PVC that were created..." \ No newline at end of file +kubectl delete pv s3-pv --ignore-not-found=true \ No newline at end of file diff --git a/manifests/modules/fundamentals/storage/s3/.workshop/terraform/main.tf b/manifests/modules/fundamentals/storage/s3/.workshop/terraform/main.tf index 39a0b0f49..588700525 100644 --- a/manifests/modules/fundamentals/storage/s3/.workshop/terraform/main.tf +++ b/manifests/modules/fundamentals/storage/s3/.workshop/terraform/main.tf @@ -30,22 +30,4 @@ module "mountpoint_s3_csi_driver_irsa" { tags = var.tags force_detach_policies = true -} - -resource "aws_iam_role_policy" "eks_workshop_ide_s3_put_access" { - name = "eks-workshop-ide-s3-put-access" - role = "eks-workshop-ide-role" - - policy = <