diff --git a/ai-ml/emr-spark-rapids/install.sh b/ai-ml/emr-spark-rapids/install.sh index 00de9d7b5..45d0a5e0e 100755 --- a/ai-ml/emr-spark-rapids/install.sh +++ b/ai-ml/emr-spark-rapids/install.sh @@ -20,9 +20,8 @@ targets=( for target in "${targets[@]}" do echo "Applying module $target..." - terraform apply -target="$target" -auto-approve - apply_output=$(terraform apply -target="$target" -auto-approve 2>&1) - if [[ $? -eq 0 && $apply_output == *"Apply complete"* ]]; then + apply_output=$(terraform apply -target="$target" -auto-approve 2>&1 | tee /dev/tty) + if [[ ${PIPESTATUS[0]} -eq 0 && $apply_output == *"Apply complete"* ]]; then echo "SUCCESS: Terraform apply of $target completed successfully" else echo "FAILED: Terraform apply of $target failed" @@ -32,9 +31,8 @@ done # Final apply to catch any remaining resources echo "Applying remaining resources..." -terraform apply -auto-approve -apply_output=$(terraform apply -auto-approve 2>&1) -if [[ $? -eq 0 && $apply_output == *"Apply complete"* ]]; then +apply_output=$(terraform apply -auto-approve 2>&1 | tee /dev/tty) +if [[ ${PIPESTATUS[0]} -eq 0 && $apply_output == *"Apply complete"* ]]; then echo "SUCCESS: Terraform apply of all modules completed successfully" else echo "FAILED: Terraform apply of all modules failed" diff --git a/ai-ml/ray/terraform/install.sh b/ai-ml/ray/terraform/install.sh index 68a79fcea..4f3be27fa 100755 --- a/ai-ml/ray/terraform/install.sh +++ b/ai-ml/ray/terraform/install.sh @@ -5,9 +5,8 @@ terraform init || echo "\"terraform init\" failed" echo "Applying ..." -terraform apply -auto-approve -apply_output=$(terraform apply -auto-approve 2>&1) -if [[ $? -eq 0 && $apply_output == *"Apply complete"* ]]; then +apply_output=$(terraform apply -auto-approve 2>&1 | tee /dev/tty) +if [[ ${PIPESTATUS[0]} -eq 0 && $apply_output == *"Apply complete"* ]]; then echo "SUCCESS: Terraform apply completed successfully" else echo "FAILED: Terraform apply failed" diff --git a/analytics/terraform/datahub-on-eks/install.sh b/analytics/terraform/datahub-on-eks/install.sh index a5ef585f2..7c6840b31 100755 --- a/analytics/terraform/datahub-on-eks/install.sh +++ b/analytics/terraform/datahub-on-eks/install.sh @@ -24,9 +24,8 @@ targets=( for target in "${targets[@]}" do echo "Applying module $target..." - terraform apply -target="$target" -auto-approve - apply_output=$(terraform apply -target="$target" -auto-approve 2>&1) - if [[ $? -eq 0 && $apply_output == *"Apply complete"* ]]; then + apply_output=$(terraform apply -target="$target" -auto-approve 2>&1 | tee /dev/tty) + if [[ ${PIPESTATUS[0]} -eq 0 && $apply_output == *"Apply complete"* ]]; then echo "SUCCESS: Terraform apply of $target completed successfully" else echo "FAILED: Terraform apply of $target failed" @@ -36,9 +35,8 @@ done # Final apply to catch any remaining resources echo "Applying remaining resources..." -terraform apply -auto-approve -apply_output=$(terraform apply -auto-approve 2>&1) -if [[ $? -eq 0 && $apply_output == *"Apply complete"* ]]; then +apply_output=$(terraform apply -auto-approve 2>&1 | tee /dev/tty) +if [[ ${PIPESTATUS[0]} -eq 0 && $apply_output == *"Apply complete"* ]]; then echo "SUCCESS: Terraform apply of all modules completed successfully" else echo "FAILED: Terraform apply of all modules failed" diff --git a/analytics/terraform/emr-eks-ack/install.sh b/analytics/terraform/emr-eks-ack/install.sh index dee38fbfa..1d586b5c4 100755 --- a/analytics/terraform/emr-eks-ack/install.sh +++ b/analytics/terraform/emr-eks-ack/install.sh @@ -21,9 +21,8 @@ targets=( for target in "${targets[@]}" do echo "Applying module $target..." - terraform apply -target="$target" -var="region=$region" -auto-approve - apply_output=$(terraform apply -target="$target" -var="region=$region" -auto-approve 2>&1) - if [[ $? -eq 0 && $apply_output == *"Apply complete"* ]]; then + apply_output=$(terraform apply -target="$target" -var="region=$region" -auto-approve 2>&1 | tee /dev/tty) + if [[ ${PIPESTATUS[0]} -eq 0 && $apply_output == *"Apply complete"* ]]; then echo "SUCCESS: Terraform apply of $target completed successfully" else echo "FAILED: Terraform apply of $target failed" @@ -33,9 +32,8 @@ done # Final apply to catch any remaining resources echo "Applying remaining resources..." -terraform apply -var="region=$region" -auto-approve -apply_output=$(terraform apply -var="region=$region" -auto-approve 2>&1) -if [[ $? -eq 0 && $apply_output == *"Apply complete"* ]]; then +apply_output=$(terraform apply -var="region=$region" -auto-approve 2>&1 | tee /dev/tty) +if [[ ${PIPESTATUS[0]} -eq 0 && $apply_output == *"Apply complete"* ]]; then echo "SUCCESS: Terraform apply of all modules completed successfully" else echo "FAILED: Terraform apply of all modules failed" diff --git a/analytics/terraform/emr-eks-fargate/install.sh b/analytics/terraform/emr-eks-fargate/install.sh index 1c041306a..9a138e1d0 100755 --- a/analytics/terraform/emr-eks-fargate/install.sh +++ b/analytics/terraform/emr-eks-fargate/install.sh @@ -16,9 +16,8 @@ targets=( for target in "${targets[@]}" do echo "Applying module $target..." - terraform apply -target="$target" -var="region=$region" -auto-approve - apply_output=$(terraform apply -target="$target" -var="region=$region" -auto-approve 2>&1) - if [[ $? -eq 0 && $apply_output == *"Apply complete"* ]]; then + apply_output=$(terraform apply -target="$target" -var="region=$region" -auto-approve 2>&1 | tee /dev/tty) + if [[ ${PIPESTATUS[0]} -eq 0 && $apply_output == *"Apply complete"* ]]; then echo "SUCCESS: Terraform apply of $target completed successfully" else echo "FAILED: Terraform apply of $target failed" @@ -28,9 +27,8 @@ done # Final apply to catch any remaining resources echo "Applying remaining resources..." -terraform apply -var="region=$region" -auto-approve -apply_output=$(terraform apply -var="region=$region" -auto-approve 2>&1) -if [[ $? -eq 0 && $apply_output == *"Apply complete"* ]]; then +apply_output=$(terraform apply -var="region=$region" -auto-approve 2>&1 | tee /dev/tty) +if [[ ${PIPESTATUS[0]} -eq 0 && $apply_output == *"Apply complete"* ]]; then echo "SUCCESS: Terraform apply of all modules completed successfully" else echo "FAILED: Terraform apply of all modules failed" diff --git a/analytics/terraform/emr-eks-karpenter/install.sh b/analytics/terraform/emr-eks-karpenter/install.sh index 58ebaafc9..8a37646d5 100755 --- a/analytics/terraform/emr-eks-karpenter/install.sh +++ b/analytics/terraform/emr-eks-karpenter/install.sh @@ -21,9 +21,8 @@ targets=( for target in "${targets[@]}" do echo "Applying module $target..." - terraform apply -target="$target" -auto-approve - apply_output=$(terraform apply -target="$target" -auto-approve 2>&1) - if [[ $? -eq 0 && $apply_output == *"Apply complete"* ]]; then + apply_output=$(terraform apply -target="$target" -auto-approve 2>&1 | tee /dev/tty) + if [[ ${PIPESTATUS[0]} -eq 0 && $apply_output == *"Apply complete"* ]]; then echo "SUCCESS: Terraform apply of $target completed successfully" else echo "FAILED: Terraform apply of $target failed" @@ -33,9 +32,8 @@ done # Final apply to catch any remaining resources echo "Applying remaining resources..." -terraform apply -auto-approve -apply_output=$(terraform apply -auto-approve 2>&1) -if [[ $? -eq 0 && $apply_output == *"Apply complete"* ]]; then +apply_output=$(terraform apply -auto-approve 2>&1 | tee /dev/tty) +if [[ ${PIPESTATUS[0]} -eq 0 && $apply_output == *"Apply complete"* ]]; then echo "SUCCESS: Terraform apply of all modules completed successfully" else echo "FAILED: Terraform apply of all modules failed" diff --git a/analytics/terraform/spark-k8s-operator/install.sh b/analytics/terraform/spark-k8s-operator/install.sh index 4c323781a..c0747926b 100755 --- a/analytics/terraform/spark-k8s-operator/install.sh +++ b/analytics/terraform/spark-k8s-operator/install.sh @@ -21,9 +21,8 @@ terraform init --upgrade for target in "${targets[@]}" do echo "Applying module $target..." - terraform apply -target="$target" -var="region=$region" -auto-approve - apply_output=$(terraform apply -target="$target" -var="region=$region" -auto-approve 2>&1) - if [[ $? -eq 0 && $apply_output == *"Apply complete"* ]]; then + apply_output=$(terraform apply -target="$target" -var="region=$region" -auto-approve 2>&1 | tee /dev/tty) + if [[ ${PIPESTATUS[0]} -eq 0 && $apply_output == *"Apply complete"* ]]; then echo "SUCCESS: Terraform apply of $target completed successfully" else echo "FAILED: Terraform apply of $target failed" @@ -33,9 +32,8 @@ done # Final apply to catch any remaining resources echo "Applying remaining resources..." -terraform apply -var="region=$region" -auto-approve -apply_output=$(terraform apply -var="region=$region" -auto-approve 2>&1) -if [[ $? -eq 0 && $apply_output == *"Apply complete"* ]]; then +apply_output=$(terraform apply -var="region=$region" -auto-approve 2>&1 | tee /dev/tty) +if [[ ${PIPESTATUS[0]} -eq 0 && $apply_output == *"Apply complete"* ]]; then echo "SUCCESS: Terraform apply of all modules completed successfully" else echo "FAILED: Terraform apply of all modules failed" diff --git a/distributed-databases/cloudnative-postgres/install.sh b/distributed-databases/cloudnative-postgres/install.sh index 6a1f7ad23..7b3a2a969 100755 --- a/distributed-databases/cloudnative-postgres/install.sh +++ b/distributed-databases/cloudnative-postgres/install.sh @@ -21,9 +21,8 @@ targets=( for target in "${targets[@]}" do echo "Applying module $target..." - terraform apply -target="$target" -var="region=$region" -auto-approve - apply_output=$(terraform apply -target="$target" -var="region=$region" -auto-approve 2>&1) - if [[ $? -eq 0 && $apply_output == *"Apply complete"* ]]; then + apply_output=$(terraform apply -target="$target" -var="region=$region" -auto-approve 2>&1 | tee /dev/tty) + if [[ ${PIPESTATUS[0]} -eq 0 && $apply_output == *"Apply complete"* ]]; then echo "SUCCESS: Terraform apply of $target completed successfully" else echo "FAILED: Terraform apply of $target failed" @@ -33,9 +32,8 @@ done # Final apply to catch any remaining resources echo "Applying remaining resources..." -terraform apply -var="region=$region" -auto-approve -apply_output=$(terraform apply -var="region=$region" -auto-approve 2>&1) -if [[ $? -eq 0 && $apply_output == *"Apply complete"* ]]; then +apply_output=$(terraform apply -var="region=$region" -auto-approve 2>&1 | tee /dev/tty) +if [[ ${PIPESTATUS[0]} -eq 0 && $apply_output == *"Apply complete"* ]]; then echo "SUCCESS: Terraform apply of all modules completed successfully" else echo "FAILED: Terraform apply of all modules failed" diff --git a/streaming/flink/install.sh b/streaming/flink/install.sh index ebde346ad..f167f2cd9 100755 --- a/streaming/flink/install.sh +++ b/streaming/flink/install.sh @@ -20,9 +20,8 @@ terraform init --upgrade for target in "${targets[@]}" do echo "Applying module $target..." - terraform apply -target="$target" -var="region=$region" -auto-approve - apply_output=$(terraform apply -target="$target" -var="region=$region" -auto-approve 2>&1) - if [[ $? -eq 0 && $apply_output == *"Apply complete"* ]]; then + apply_output=$(terraform apply -target="$target" -var="region=$region" -auto-approve 2>&1 | tee /dev/tty) + if [[ ${PIPESTATUS[0]} -eq 0 && $apply_output == *"Apply complete"* ]]; then echo "SUCCESS: Terraform apply of $target completed successfully" else echo "FAILED: Terraform apply of $target failed" @@ -32,9 +31,8 @@ done # Final apply to catch any remaining resources echo "Applying remaining resources..." -terraform apply -var="region=$region" -auto-approve -apply_output=$(terraform apply -var="region=$region" -auto-approve 2>&1) -if [[ $? -eq 0 && $apply_output == *"Apply complete"* ]]; then +apply_output=$(terraform apply -var="region=$region" -auto-approve 2>&1 | tee /dev/tty) +if [[ ${PIPESTATUS[0]} -eq 0 && $apply_output == *"Apply complete"* ]]; then echo "SUCCESS: Terraform apply of all modules completed successfully" else echo "FAILED: Terraform apply of all modules failed" diff --git a/streaming/kafka/install.sh b/streaming/kafka/install.sh index df5117646..fec65d05a 100755 --- a/streaming/kafka/install.sh +++ b/streaming/kafka/install.sh @@ -15,9 +15,8 @@ targets=( for target in "${targets[@]}" do echo "Applying module $target..." - terraform apply -target="$target" -auto-approve - apply_output=$(terraform apply -target="$target" -auto-approve 2>&1) - if [[ $? -eq 0 && $apply_output == *"Apply complete"* ]]; then + apply_output=$(terraform apply -target="$target" -auto-approve 2>&1 | tee /dev/tty) + if [[ ${PIPESTATUS[0]} -eq 0 && $apply_output == *"Apply complete"* ]]; then echo "SUCCESS: Terraform apply of $target completed successfully" else echo "FAILED: Terraform apply of $target failed" @@ -27,9 +26,8 @@ done # Final apply to catch any remaining resources echo "Applying remaining resources..." -terraform apply -auto-approve -apply_output=$(terraform apply -auto-approve 2>&1) -if [[ $? -eq 0 && $apply_output == *"Apply complete"* ]]; then +apply_output=$(terraform apply -auto-approve 2>&1 | tee /dev/tty) +if [[ ${PIPESTATUS[0]} -eq 0 && $apply_output == *"Apply complete"* ]]; then echo "SUCCESS: Terraform apply of all modules completed successfully" else echo "FAILED: Terraform apply of all modules failed" diff --git a/workshop/emr-eks/install.sh b/workshop/emr-eks/install.sh index 69dfd738b..5a60558d7 100755 --- a/workshop/emr-eks/install.sh +++ b/workshop/emr-eks/install.sh @@ -15,9 +15,8 @@ targets=( for target in "${targets[@]}" do echo "Applying module $target..." - terraform apply -target="$target" -auto-approve - apply_output=$(terraform apply -target="$target" -auto-approve 2>&1) - if [[ $? -eq 0 && $apply_output == *"Apply complete"* ]]; then + apply_output=$(terraform apply -target="$target" -auto-approve 2>&1 | tee /dev/tty) + if [[ ${PIPESTATUS[0]} -eq 0 && $apply_output == *"Apply complete"* ]]; then echo "SUCCESS: Terraform apply of $target completed successfully" else echo "FAILED: Terraform apply of $target failed" @@ -27,9 +26,8 @@ done # Final apply to catch any remaining resources echo "Applying remaining resources..." -terraform apply -auto-approve -apply_output=$(terraform apply -auto-approve 2>&1) -if [[ $? -eq 0 && $apply_output == *"Apply complete"* ]]; then +apply_output=$(terraform apply -auto-approve 2>&1 | tee /dev/tty) +if [[ ${PIPESTATUS[0]} -eq 0 && $apply_output == *"Apply complete"* ]]; then echo "SUCCESS: Terraform apply of all modules completed successfully" else echo "FAILED: Terraform apply of all modules failed"