All Tools View Categories About Contact Privacy

Terraform GitHub Actions Generator

Build a GitHub Actions workflow that runs terraform init, fmt and validate.

Runs entirely in your browser - nothing is uploaded and no cloud connection is made.
0
steps
0
triggers
Your generated workflow YAML will appear here.

About Terraform GitHub Actions Generator

GitHub Actions gives Terraform a safe, automatic CI gate so that formatting and validation problems are caught before a human reviews a pull request. The GitHub Actions Generator scaffolds a complete workflow file that checks out your code, sets up a pinned Terraform version, and runs terraform init, terraform fmt -check and terraform validate on the branches and events you choose. You never have to remember the exact YAML indentation or the correct action versions, which are easy to mistype when you assemble a pipeline by hand. The generator takes the guesswork out of the most common Terraform CI setup and produces something you can commit immediately.

The generated workflow is deliberately conservative. It runs only read-only, side-effect-free steps, which means it is safe to run on untrusted pull requests from forks without exposing cloud credentials. If you supply an AWS region, a Configure AWS Credentials step is added, but you still provide the secrets through repository settings; the tool never sees them. You can set a non-root working directory when your modules live in a sub folder, and the steps are emitted with that directory applied. Everything is assembled in your browser, so the YAML is built locally and nothing is uploaded. This keeps your repository conventions consistent across teams and gives new contributors a trustworthy starting point that follows the Terraform team recommendations without any research.

Use this generator when you are bootstrapping a repository, standardising CI across many modules, or writing documentation that shows a recommended Terraform pipeline. Because the output is plain YAML, you can paste it into .github/workflows, commit it, and immediately get feedback on every future change. It is a scaffold, not a full pipeline, so you can extend it later with plan and apply steps once you have trusted runners and credentials in place. Treat the output as the dependable foundation, then layer on the cloud specific stages your environment requires.

Features

  • Triggers - push and/or pull_request, select either or both.
  • Setup Terraform - pinned version via hashicorp/setup-terraform.
  • Safe steps - init, fmt -check, validate run by default.
  • AWS optional - configure-aws-credentials step when a region is set.
  • Working dir - set a non-root module path for every step.
  • Permissions block - a minimal read-only permissions section is included.
  • Live stats - see the step count and trigger count after building.
  • Word wrap toggle - wrap the YAML preview for comfortable reading.
  • Copy / Download / Print - export the workflow wherever you need it.
  • Private - assembled locally, nothing leaves the page.
  • Reproducible - the same inputs produce the same workflow.
  • Extensible - add plan or apply steps once credentials exist.
  • Validated inputs - a name, triggers and version are required before build.
  • Branch aware - push is wired to the main branch automatically.

How to Use

  1. Name the workflow in the Workflow name field.
  2. Set the Terraform version you want pinned, for example 1.9.0.
  3. Pick triggers by checking push and/or pull_request.
  4. Add an AWS region if you want the credentials step, or leave it blank.
  5. Set a working directory such as a dot for the repo root or ./infra for a sub folder.
  6. Click Generate workflow to build the YAML in the preview.
  7. Read the live stats to confirm the step and trigger counts.
  8. Toggle word wrap if the YAML is wider than your screen.
  9. Review the error panel if a name, trigger or version is missing.
  10. Export with Copy, Download as terraform.yml, or Print.
  11. Start over with Clear, or reload a realistic setup with Load sample.

Examples

Example - push plus pull request. Workflow name Terraform CI, version 1.9.0, both triggers checked, region us-east-1 and working directory ./infra produces a workflow that checks out code, configures AWS, sets up Terraform 1.9.0, then runs init, fmt -check and validate inside ./infra. Because both triggers are enabled, contributors get feedback on every pull request and every push to main.

Example - validate only. With no AWS region the credentials step is omitted entirely, leaving a leaner workflow that still enforces formatting and validity without any cloud dependency. This is ideal for open source repositories where forks open pull requests.

Example - monorepo module. A working directory of ./modules/network scopes every step to that folder, so a change in one module validates in isolation without touching sibling code.

Benefits

  • Safe CI - fmt and validate run without cloud writes.
  • Reproducible - a pinned Terraform version avoids surprises.
  • Flexible - optional AWS and working directory support.
  • Private - runs fully in the browser.
  • Consistent - every repo gets the same reliable gate.
  • Teachable - the workflow shape is explicit and reviewable.
  • Fast onboarding - new repos get CI in seconds.

Frequently Asked Questions

What does this tool generate?
It builds a GitHub Actions workflow YAML that checks out code, sets up Terraform, and runs terraform init, terraform fmt -check and terraform validate, on push and/or pull_request.
Which triggers are supported?
push (to main) and pull_request. Select either or both.
Does it run plan or apply?
This scaffold runs fmt and validate only, which are safe on untrusted PRs. Add a plan/apply step manually when you have trusted runners and credentials.
What about AWS credentials?
If you provide an AWS region, a Configure AWS Credentials step is added (you still supply the secrets in the repository).
Does this upload anything?
No. Everything is assembled in your browser and nothing leaves your machine.
Can I download the result?
Yes. Copy the workflow YAML, download it, or print it.