Menu

1 / 2

Terraform in CI/CD: Plan/Apply Gates with GitHub Actions

DEV Community: terraform·Manoj Kumar Kagitha·about 15 hours ago
#jzaqPfOH
#devtoterraform#devto#dev#plan#terraform
Reading 0:00
15s threshold

Versioned modules mean nothing if engineers still run apply from their laptops. Laptop applies are unreviewed, unlogged, and unrepeatable. The fix is a pipeline: every change goes through plan on pull request, review, then apply from CI with short-lived credentials. This post builds that pipeline on GitHub Actions from scratch.

Why CI/CD runs apply

Four reasons, in order of how much pain each one prevents.

Review. A plan posted as a PR comment lets reviewers see exactly what will change before it changes. No more "I applied and something broke, let me check what I did."

Audit trail. Every apply is tied to a commit, a PR, and a GitHub Actions run. When something breaks at 2 AM, you know exactly which change did it and who approved it.

No credential sprawl. Engineers do not need cloud credentials on their laptops. The pipeline assumes a role with OIDC. Credentials live for the duration of the run, then vanish.

Repeatability.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.