diff --git a/examples/advanced/main.tf b/examples/advanced/main.tf index 50139935..3992db30 100644 --- a/examples/advanced/main.tf +++ b/examples/advanced/main.tf @@ -169,7 +169,7 @@ module "ocp_base" { # Enable if using worker autoscaling. Stops Terraform managing worker count. ignore_worker_pool_size_changes = true addons = { - "cluster-autoscaler" = "1.2.0" + "cluster-autoscaler" = "1.2.1" } kms_config = { instance_id = module.kp_all_inclusive.kms_guid diff --git a/scripts/reset_iks_api_key.sh b/scripts/reset_iks_api_key.sh index 6aae0c02..0935581e 100755 --- a/scripts/reset_iks_api_key.sh +++ b/scripts/reset_iks_api_key.sh @@ -54,14 +54,25 @@ if [ "${reset}" == true ]; then if [ "$PRIVATE_ENV" = true ]; then if [ "$CLUSTER_ENDPOINT" == "private" ] || [ "$CLUSTER_ENDPOINT" == "default" ]; then RESET_URL="https://private.$REGION.containers.cloud.ibm.com/v1/keys" - curl -H "accept: application/json" -H "Authorization: $IAM_TOKEN" -H "X-Auth-Resource-Group: $RESOURCE_GROUP_ID" -X POST "$RESET_URL" + result=$(curl -i -H "accept: application/json" -H "Authorization: $IAM_TOKEN" -H "X-Auth-Resource-Group: $RESOURCE_GROUP_ID" -X POST "$RESET_URL" 2>/dev/null) + status_code=$(echo "$result" | head -n 1 | cut -d$' ' -f2) elif [ "$CLUSTER_ENDPOINT" == "vpe" ]; then RESET_URL="https://api.$REGION.containers.cloud.ibm.com/v1/keys" - curl -H "accept: application/json" -H "Authorization: $IAM_TOKEN" -H "X-Auth-Resource-Group: $RESOURCE_GROUP_ID" -X POST "$RESET_URL" + result=$(curl -i -H "accept: application/json" -H "Authorization: $IAM_TOKEN" -H "X-Auth-Resource-Group: $RESOURCE_GROUP_ID" -X POST "$RESET_URL" 2>/dev/null) + status_code=$(echo "$result" | head -n 1 | cut -d$' ' -f2) fi else RESET_URL="https://containers.cloud.ibm.com/global/v1/keys" - curl -H "accept: application/json" -H "X-Region: $REGION" -H "Authorization: $IAM_TOKEN" -H "X-Auth-Resource-Group: $RESOURCE_GROUP_ID" -X POST "$RESET_URL" -d '' + result=$(curl -i -H "accept: application/json" -H "X-Region: $REGION" -H "Authorization: $IAM_TOKEN" -H "X-Auth-Resource-Group: $RESOURCE_GROUP_ID" -X POST "$RESET_URL" -d '' 2>/dev/null) + status_code=$(echo "$result" | head -n 1 | cut -d$' ' -f2) + fi + + if [ "${status_code}" == "204" ]; then + echo "The IAM API key is successfully reset." + else + echo "ERROR:: FAILED TO RESET THE IAM API KEY" + echo "$result" + exit 1 fi # sleep for 10 secs to allow the new key to be replicated across backend DB instances before attempting to create cluster sleep 10