Skip to content

Commit 2f930e2

Browse files
committed
Fix: change so we can set USE_CURRENT_USER=0
1 parent 105a97a commit 2f930e2

2 files changed

Lines changed: 11 additions & 5 deletions

File tree

hack/create-infrastructure.sh

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,15 @@ bash $SCRIPT_DIR/update-iam-role.sh $environment
1616

1717
sleep 5
1818

19+
pids=()
20+
1921
cluster_exists=0
2022
aws eks describe-cluster --name "${EKS_CLUSTER_NAME}" &> /dev/null || cluster_exists=$?
2123

2224
if [ $cluster_exists -ne 0 ] && [[ "$cluster" == "standard" || "$cluster" == "all" ]]; then
2325
echo "Creating cluster ${EKS_CLUSTER_NAME}"
24-
bash $SCRIPT_DIR/exec.sh "${environment}" 'cat /cluster/eksctl/cluster.yaml /cluster/eksctl/access-entries.yaml | envsubst | eksctl create cluster -f -'&
26+
bash $SCRIPT_DIR/exec.sh "${environment}" 'cat /cluster/eksctl/cluster.yaml /cluster/eksctl/access-entries.yaml | envsubst | eksctl create cluster -f -' &
27+
pids+=($!)
2528
else
2629
echo "Cluster ${EKS_CLUSTER_NAME} already exists"
2730
fi
@@ -31,9 +34,12 @@ aws eks describe-cluster --name "${EKS_CLUSTER_AUTO_NAME}" &> /dev/null || auto_
3134

3235
if [ $auto_cluster_exists -ne 0 ] && [[ "$cluster" == "auto" || "$cluster" == "all" ]]; then
3336
echo "Creating auto mode cluster ${EKS_CLUSTER_AUTO_NAME}"
34-
bash $SCRIPT_DIR/exec.sh "${environment}" 'cat /cluster/eksctl/cluster-auto.yaml /cluster/eksctl/access-entries.yaml | envsubst | eksctl create cluster -f -'&
37+
bash $SCRIPT_DIR/exec.sh "${environment}" 'cat /cluster/eksctl/cluster-auto.yaml /cluster/eksctl/access-entries.yaml | envsubst | eksctl create cluster -f -' &
38+
pids+=($!)
3539
else
3640
echo "Auto mode cluster ${EKS_CLUSTER_AUTO_NAME} already exists"
3741
fi
3842

39-
wait
43+
for pid in "${pids[@]}"; do
44+
wait "$pid" || exit 1
45+
done

hack/exec.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,10 @@ container_image='eks-workshop-environment'
2020
(cd $SCRIPT_DIR/../lab && $CONTAINER_CLI build -q -t $container_image .)
2121

2222

23-
if [ -z "$SKIP_CREDENTIALS" -a -z "$USE_CURRENT_USER" ]; then
23+
if [ "${SKIP_CREDENTIALS:-0}" = "0" ] && [ "${USE_CURRENT_USER:-0}" = "0" ]; then
2424
echo "Passing temp AWS credentials"
2525
source $SCRIPT_DIR/lib/generate-aws-creds.sh
26-
elif [ -n "${USE_CURRENT_USER:-}" ]; then
26+
elif [ "${USE_CURRENT_USER:-0}" != "0" ]; then
2727
if [ -z "$AWS_ACCESS_KEY_ID" ]; then
2828
echo "No AWS_ACCESS_KEY_ID found, please check your AWS credentials"
2929
exit 1

0 commit comments

Comments
 (0)