Page:
Troubleshooting
Clone
1
Troubleshooting
gitea-admin edited this page 2025-10-29 07:31:36 +00:00
Troubleshooting Guide
Common Issues
Pipeline Failures
** ❌ Terraform format check failed**
- Cause: Code not formatted correctly
- Fix: Run
terraform fmt -recursivelocally and commit
❌ Terraform validate failed
- Cause: Syntax errors in Terraform code
- Fix: Run
terraform validatelocally and fix reported errors
┌ Workflow file not found
- Cause: Workflow file in wrong location
- Fix: Must be in
.gitea/workflows/terraform.yml
Authentication Issues
❌ AWP Certificates not configured
- Cause: Missing or incorrect secrets
- Fix:
- Go to Settings → Secrets → Actions
- Add:
AWS_ACCESS_KEY_ID,AWS_SECRET_ACCESS_KEY - Uncomment credentials in workflow (lines 103-104)
┌ Azure authentication failed
- Cause: Missing ARM variables
- Fix: Add all 4 secrets:
ARM_CLIENT_ID,ARM_CLIENT_SECRET,ARM_SUBSCRIPTION_ID,ARM_TENANT_ID
❌ GCP authentication failed
- Cause: Missing or invalid GCP credentials
- Fix: Add
GCP_CREDENTIALSsecret with full JSON service account key
Backend Problems
❌ Backend initialization failed
- Cause: Incorrect backend configuration or credentials
- Fix:
- Verify backend configuration in Terraform code
- Check backend bucket/container exists
- Verify
BACKEND_ACCESS_KEYandBACKEND_SECRET_KEYsecrets
┌ State file locked
- Cause: Previous operation didn't release lock
- Fix: Run
terraform force-unlock <LOCK_ID>(with ID from error message)
Security Scan Issues
❌ Checkov/tfsec found security issues
- Fix 1: Fix the security issue (recommended)
- Fix 2: Suppress specific check with justification:
#checkov:skip=CKV_AWS_20:MFA delete not required for dev environment - Fix 3: Set
soft_fail: truein workflow (not recommended for production)
Artifact Issues
❌ Artifact not found
- Cause: Artifacts expired or plan stage failed
- Fix: Re-run plan stage
Environment & Approval Issues
❌ Environment not found
- Cause: Environment not created in Gitea
- Fix:
- Go to Settings → Environments
- Create
productionenvironment - Add required reviewers
- Set deployment branch to
main
┌ No one can approve
- Cause: No reviewers configured
- Fix: Add reviewers to environment in Settings → Environments → production
Quick Fixes
| Error | Quick Fix |
|---|---|
| No valid credentials | Add provider secrets to repository |
| Backend init failed | Check backend configuration & credentials |
| State locked | Run terraform force-unlock <LOCK_ID> |
| Plan file stale | Re-run plan stage |
| Artifact not found | Re-run plan stage |
| Environment not found | Create environment in Settings |
| Formatting failed | Run terraform fmt -recursive |
Debug Mode
Enable debug output in workflow:
env:
TF_LOG: DEBUG # TRACE, DEBUG, INFO, WARN, ERROR
Getting Help
- Check workflow logs in Actions tab
- Run
terraform validatelocally - Verify secrets are configured
- Check backend access
- Review Terraform documentation