When building CI/CD pipelines, keep them scope-focused and deterministic, and add explicit quality gates so failures stop the deployment.
Apply:
.github/workflows/main.yml).terraform fmt + terraform validate), and structure steps in a clear order (init → plan → apply-style).Example (GitHub Actions):
name: CI/CD
on: [push]
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Build/Test
run: |
echo "run tests/build here"
- name: Validate (fail fast)
run: |
terraform fmt -check
terraform validate
- name: Deploy
if: success()
run: |
terraform init
terraform plan -out=tfplan
terraform apply -auto-approve tfplan
Enter the URL of a public GitHub repository