Skip to content
Snippets Groups Projects

Adding a logic for terraform apply

Merged Ravi Tripathi requested to merge feat-fix-terraform-success-logic into master
1 file
+ 10
1
Compare changes
  • Side-by-side
  • Inline
+ 10
1
@@ -85,7 +85,16 @@ 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 || terraform destroy -auto-approve && false
- |
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"
clean-up:
stage: cleanup
Loading