Skip to content

Commit

Permalink
Reduce the number of times we run apply (#233)
Browse files Browse the repository at this point in the history
  • Loading branch information
raykrueger authored Jun 30, 2023
1 parent fa1ad3e commit f05d172
Show file tree
Hide file tree
Showing 11 changed files with 42 additions and 63 deletions.
10 changes: 4 additions & 6 deletions ai-ml/emr-spark-rapids/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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"
Expand Down
5 changes: 2 additions & 3 deletions ai-ml/ray/terraform/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
10 changes: 4 additions & 6 deletions analytics/terraform/datahub-on-eks/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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"
Expand Down
10 changes: 4 additions & 6 deletions analytics/terraform/emr-eks-ack/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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"
Expand Down
10 changes: 4 additions & 6 deletions analytics/terraform/emr-eks-fargate/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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"
Expand Down
10 changes: 4 additions & 6 deletions analytics/terraform/emr-eks-karpenter/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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"
Expand Down
10 changes: 4 additions & 6 deletions analytics/terraform/spark-k8s-operator/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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"
Expand Down
10 changes: 4 additions & 6 deletions distributed-databases/cloudnative-postgres/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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"
Expand Down
10 changes: 4 additions & 6 deletions streaming/flink/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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"
Expand Down
10 changes: 4 additions & 6 deletions streaming/kafka/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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"
Expand Down
10 changes: 4 additions & 6 deletions workshop/emr-eks/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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"
Expand Down

0 comments on commit f05d172

Please sign in to comment.