Skip to content

Repository with reusable workflows for terraform lint, plan and apply

License

Notifications You must be signed in to change notification settings

entur/gha-terraform

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation


entur/gha-terraform

Entur/Terraform/CI

GitHub Actions for working with Terraform

Terraform version management

These reusable workflows will try to automatically determine the terraform version from your terraform code. You can override this by setting the version input property.

Golden Path

Example

Let's look at an example, assume our repo is called amazing-app:

λ amazing-app ❯ tree
.
├── README.md
├── terraform
│   ├── env
│   │   ├──dev.tf
│   │   ├──tst.tf
│   │   └──prd.tf
│   ├── backend.tf
│   ├── main.tf
│   ├── variables.tf
│   └── versions.tf
└── .github
    └── workflows
        ├── cd.yml
        └── ci.yml

ci.yml

name: CI

on:
  pull_request:

jobs:
  terraform-lint:
    uses: entur/gha-terraform/.github/workflows/lint.yml@v2

  terraform-plan:
    uses: entur/gha-terraform/.github/workflows/plan.yml@v2

cd.yml

name: CD

on:
  pull_request:

jobs:
  terraform-apply:
    uses: entur/gha-terraform/.github/workflows/apply.yml@v2

Approval steps

If you don't want to use a third party application to create an approval step before apply, you can use Github Environments, For inspiration: https://github.com/entur/thanos/blob/main/.github/workflows/cd.yml