From dab53408d9df99e22e52e94333a22ea0f0d0d588 Mon Sep 17 00:00:00 2001 From: Eesaan Atluri <atlurie@uab.edu> Date: Sat, 9 Dec 2023 03:08:01 -0600 Subject: [PATCH] Remove code that destroys TF resources after failure TF apply failure leads to pipeline exiting so TF destroy doesn't run --- .gitlab-ci.yml | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 0928648..c9cefd2 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -88,16 +88,7 @@ tf-apply: echo "image_ohpc defined as ${TF_VAR_image_ohpc}" fi - export TF_VAR_keypair_name="os-gen-keypair-$BUILD_DATE" - - | - terraform apply -auto-approve - if [ $? -ne 0 ]; then - echo "Terraform apply failed. Running terraform destroy..." - terraform destroy -auto-approve - TF_SUCCESS=false - else - TF_SUCCESS=true - fi - echo "Terraform success: $TF_SUCCESS" + - terraform apply -auto-approve - export instance_floating_ip=$(terraform output -raw floating_ip_ohpc) - export instance_id=$(terraform output -raw xdmod_instance_id) - echo "instance_floating_ip=${instance_floating_ip}" | tee -a $CI_PROJECT_DIR/vars.env -- GitLab