GithubHelp home page GithubHelp logo

fenikks / gh-actions-terragrunt Goto Github PK

View Code? Open in Web Editor NEW

This project forked from dflook/terraform-github-actions

0.0 0.0 0.0 9.62 MB

GitHub actions for terragrunt

Shell 11.65% Python 87.51% Dockerfile 0.84%

gh-actions-terragrunt's Introduction

Terragrunt GitHub Actions

Terragrunt is a popular open-source tool that works in conjunction with Terraform, another infrastructure-as-code tool. It helps manage and organize your Terraform configurations, making it easier to work with large or complex infrastructure deployments. Terragrunt adds several features and improvements on top of Terraform

This is a suite of terragrunt related GitHub Actions that can be used together to build effective Infrastructure as Code workflows.

Actions

See the documentation for the available actions:

Example Usage

Here are some examples of how the terragrunt actions can be used together in workflows.

Terragrunt plan

Terraform plans typically need to be reviewed by a human before being applied. Fortunately, GitHub has a well established method for requiring human reviews of changes - a Pull Request.

We can use PRs to safely plan and apply infrastructure changes.

You can make GitHub enforce this using branch protection.

plan.yaml

This workflow runs on changes to a PR branch. It generates a terraform plan for each module in provided path and attaches it to the PR as a comment.

name: Create a terraform plan

on:
  workflow_call:

jobs:
  plan:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout the codebase
        uses: actions/checkout@v4
        with:
          fetch-depth: 0

      - name: Create plan
        uses: Fenikks/terragrunt-plan-all@v1
        with:
          path: my-terraform-config
          tg_version: '0.52.4'
          tf_version: '1.5.7'
          destroy: false
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
          AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
          AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}

apply.yaml

This workflow runs when the PR is merged into the main branch, and applies the planned changes.

name: Apply terraform plan

on:
  push:
    branches:
      - main

permissions:
  contents: read
  pull-requests: write

jobs:
  apply:
    runs-on: ubuntu-latest
    name: Apply terraform plan
    env:
      GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
    steps:
      - name: Checkout
        uses: actions/checkout@v3

      - name: terraform apply
        uses: dflook/terraform-apply@v1
        with:
          path: my-terraform-config

gh-actions-terragrunt's People

Contributors

dflook avatar dgrenner avatar fenikks avatar github-actions[bot] avatar giuseppechiesa-tomtom avatar ilyesaj avatar kylewlacy avatar merykozlowska avatar patricktalmeida avatar scruplelesswizard avatar sjmiller609 avatar styx avatar toast-gear avatar vemel avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.