diff --git a/.gitignore b/.gitignore index 0c49583..1dcf0a3 100644 --- a/.gitignore +++ b/.gitignore @@ -5,3 +5,5 @@ venv/ .terraform.lock.hcl .terraform auth.yaml +tfplan +plan.log diff --git a/apply.sh b/apply.sh index c6c40bc..876cae8 100755 --- a/apply.sh +++ b/apply.sh @@ -26,6 +26,12 @@ if ! tofu plan -out=tfplan 2>&1 | tee plan.log; then fi fi +# Check if no changes are required +if grep -q "No changes" plan.log; then + echo "✅ No changes detected. Exiting." + exit 0 +fi + #applying a planfile skips confirmations... echo "✅ Plan successful. Ready to apply changes." echo "Do you want to apply these changes? (y/n)"