Skip to content
Snippets Groups Projects
Commit 2f4fb55f authored by Ravi Tripathi's avatar Ravi Tripathi
Browse files

Merge branch 'feat-fix-terraform-success-logic' into 'master'

Adding a logic for terraform apply

See merge request rc/terraform-openstack!16
parents aae19feb d8242942
No related branches found
No related tags found
No related merge requests found
......@@ -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
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment