Skip to content

Commit

Permalink
Redirect both stderr and stdout to both console and log file (#431)
Browse files Browse the repository at this point in the history
Co-authored-by: Yevhen Ivantsov <[email protected]>
  • Loading branch information
bianchi2 and Yevhen Ivantsov authored Oct 2, 2024
1 parent 45a97c5 commit 7ecab24
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -336,9 +336,9 @@ create_tfstate_resources() {
# create s3 bucket to be used for keep state of the terraform project
log "Creating '${S3_BUCKET}' bucket for storing the terraform state..."
if ! test -d "${STATE_FOLDER}/.terraform" ; then
terraform -chdir="${STATE_FOLDER}" init -no-color | tee -a "${LOG_FILE}"
terraform -chdir="${STATE_FOLDER}" init -no-color 2>&1 | tee -a "${LOG_FILE}"
fi
terraform -chdir="${STATE_FOLDER}" apply -auto-approve "${OVERRIDE_CONFIG_FILE}" | tee -a "${LOG_FILE}"
terraform -chdir="${STATE_FOLDER}" apply -auto-approve "${OVERRIDE_CONFIG_FILE}" 2>&1 | tee -a "${LOG_FILE}"
sleep 5
fi
}
Expand All @@ -348,8 +348,8 @@ create_update_infrastructure() {
log "Starting to analyze the infrastructure..."
if [ -n "${DIFFERENT_ENVIRONMENT}" ]; then
log "Migrating the terraform state to S3 bucket..."
terraform -chdir="${ROOT_PATH}" init -migrate-state -no-color | tee -a "${LOG_FILE}"
terraform -chdir="${ROOT_PATH}" init -no-color | tee -a "${LOG_FILE}"
terraform -chdir="${ROOT_PATH}" init -migrate-state -no-color 2>&1 | tee -a "${LOG_FILE}"
terraform -chdir="${ROOT_PATH}" init -no-color 2>&1 | tee -a "${LOG_FILE}"
fi
set +e
terraform -chdir="${ROOT_PATH}" apply -auto-approve -no-color "${OVERRIDE_CONFIG_FILE}" | tee -a "${LOG_FILE}"
Expand Down Expand Up @@ -489,7 +489,7 @@ verify_configuration_file

if [ "${SKIP_PRE_FLIGHT_FLAG}" == "" ]; then
# verify snapshots if any
pre_flight_checks | tee -a "${LOG_FILE}"
pre_flight_checks 2>&1 | tee -a "${LOG_FILE}"
fi

# Generates ./terraform-backend.tf and ./modules/tfstate/tfstate-local.tf
Expand Down

0 comments on commit 7ecab24

Please sign in to comment.