-
Notifications
You must be signed in to change notification settings - Fork 576
Expand file tree
/
Copy pathcommon-env.sh
More file actions
37 lines (27 loc) · 1.02 KB
/
common-env.sh
File metadata and controls
37 lines (27 loc) · 1.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
environment=${environment:-""}
set -x
if [ -z "$environment" ]; then
export EKS_CLUSTER_NAME="eks-workshop"
export EKS_CLUSTER_AUTO_NAME="eks-workshop-auto"
else
export EKS_CLUSTER_NAME="eks-workshop-${environment}"
export EKS_CLUSTER_AUTO_NAME="eks-workshop-${environment}-auto"
fi
AWS_REGION=${AWS_REGION:-""}
if [ -z "$AWS_REGION" ]; then
echo "Warning: Defaulting region to us-west-2"
export AWS_REGION="us-west-2"
fi
SKIP_CREDENTIALS=${SKIP_CREDENTIALS:-""}
USE_CURRENT_USER=${USE_CURRENT_USER:-""}
AWS_ACCESS_KEY_ID=${AWS_ACCESS_KEY_ID:-""} # We check the access key
if [ -z "$SKIP_CREDENTIALS" ]; then
ACCOUNT_ID=$(aws sts get-caller-identity --query Account --output text)
IDE_ROLE_NAME="${EKS_CLUSTER_NAME}-ide-role"
IDE_ROLE_ARN="arn:aws:iam::${ACCOUNT_ID}:role/${IDE_ROLE_NAME}"
fi
# Set RESOURCE_CODEBUILD_ROLE_ARN if not already provided (e.g. by Workshop Studio)
if [ -z "${RESOURCE_CODEBUILD_ROLE_ARN:-}" ]; then
export RESOURCE_CODEBUILD_ROLE_ARN="${IDE_ROLE_ARN:-}"
fi
export DOCKER_CLI_HINTS="false"