Skip to content

Commit 7b1538b

Browse files
committed
Fix bugs in import_cluster_creator_values.sh, check output before trying
to apply.
1 parent 042fe8b commit 7b1538b

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

dev_env/utils/import_cluster_creator_values.sh

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,24 @@
22

33
cluster_name=$(terraform output -raw eks_cluster_name)
44
principal_arn=$(aws eks list-access-entries --cluster-name ${cluster_name} | jq -r '.accessEntries[]' | grep mcp-tenantOperator | head -n 1)
5-
policy_arn=$(aws eks list-associated-access-policies --cluster-name uads-venue-dev-jupyter --principal-arn ${principal_arn} | jq -r .associatedAccessPolicies[0].policyArn)
5+
policy_arn=$(aws eks list-associated-access-policies --cluster-name ${cluster_name} --principal-arn ${principal_arn} | jq -r .associatedAccessPolicies[0].policyArn)
66

77
echo "cluster_name=${cluster_name}"
88
echo "principal_arn=${principal_arn}"
99
echo "policy_arn=${policy_arn}"
1010

11+
if [ -z "$principal_arn" ]; then
12+
echo "No value determined for principal_arn"
13+
exit 1
14+
fi
15+
16+
if [ -z "$policy_arn" ]; then
17+
echo "No value determined for policy_arn"
18+
exit 1
19+
fi
20+
21+
echo "Waiting 5 seconds for you to abort..."
22+
sleep 5
23+
1124
terraform import 'module.eks.aws_eks_access_entry.this["cluster_creator"]' "${cluster_name}:${principal_arn}"
1225
terraform import 'module.eks.aws_eks_access_policy_association.this["cluster_creator_admin"]' "${cluster_name}#${principal_arn}#${policy_arn}"

0 commit comments

Comments
 (0)