---
title: "Discussion on \"Deploying Terraform at scale with GitHub Actions\" | Hashnode"
description: "Discussion on \"Deploying Terraform at scale with GitHub Actions\". Using a pull-request workflow"
url: "https://hashnode.com/posts/deploying-terraform-at-scale-with-github-actions/6304cf503f9519428cceb631"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [Deploying Terraform at scale with GitHub Actions](https://gaunacode.com/deploying-terraform-at-scale-with-github-actions?utm_source=hashnode&utm_medium=feed)

Using a pull-request workflow

Aug 23, 2022 · 10 min read · gaunacode.com  
Read the article

-   [#devops](https://hashnode.com/tag/devops)
-   [#terraform](https://hashnode.com/tag/terraform)
-   [#azure](https://hashnode.com/tag/azure)

## Written by

[Facundo Gauna](https://hashnode.com/@gaunacode)

@gaunacode · Orlando, FL

  
[View profile](https://hashnode.com/@gaunacode)

Building cloud-native apps on Azure. I can't stop self-improving.

I used to be a .NET developer. Nowaways, I am a DevOps solutions architect with a focus on Azure and Kubernetes. I also love productivity topics, especially when it comes to doing more with less of my time. I'm also a daddy, so time is a limited resource for me.

## Responses 3

Markdown supported · ⌘↵ to post

[Rishav Dhar](https://hashnode.com/@rdhar)

[May 22, 2023](https://hashnode.com/posts/deploying-terraform-at-scale-with-github-actions/6304cf503f9519428cceb631/comment/646bca0fe07e1d2187d9437b)

Hi Facundo, thanks for sharing this extensive write-up. It led me to explore the value GitHub Actions within CI/CD workflows to run Terraform from pull request comments: similar to Atlantis, but without the overhead of self-hosting.

I've [open-sourced this reusable workflow](https://dev.to/rdhar/how-to-terraform-with-comments-and-you-can-diy-239c#:~:text=rdhar%20/%20terraform%2Dwith%2Dcomments) and tried my best documenting its usage examples. Let me know if you happen to have any feedback.

[Michael Stepanov](https://hashnode.com/@niteman)

[Nov 10, 2022](https://hashnode.com/posts/deploying-terraform-at-scale-with-github-actions/6304cf503f9519428cceb631/comment/636d3b30ea115907a994a66a)

Thank you for a good article! The PR comment can be made easier:

```
- name: Terraform Plan
      id: plan
      run: |
        terraform plan -refresh=false  -no-color -out out.plan

    - name: Comment PR
      if: github.event_name == 'pull_request'
      uses: peter-evans/create-or-update-comment@v1
      with:
        issue-number: ${{ github.event.pull_request.number }}
        body: ${{steps.plan.outputs.stdout}}
```

[Tobias Dehn](https://hashnode.com/@tdapoplex)

[Sep 27, 2022](https://hashnode.com/posts/deploying-terraform-at-scale-with-github-actions/6304cf503f9519428cceb631/comment/6332d10ffc1e3e483bf547de)

Hi Facundo,

Ty for your article. I'm currently testing GitHub actions with terraform.

How would you handle it, if terraform apply fails after the pr is merged?

Best regards Tobi

[Costis P](https://hashnode.com/@Costis)

[Oct 13, 2022](https://hashnode.com/posts/deploying-terraform-at-scale-with-github-actions/6304cf503f9519428cceb631/comment/6332d10ffc1e3e483bf547de#reply-6347ec038213b93556f3152d)

The downside with applying after the PR is merged is that you end up 'polluting' the main branch with (possibly many) attempts to fix the problem. With that in mind, I do like the atlantis approach where you don't merge unless the branch has been applied successfully.

[Tobias Dehn](https://hashnode.com/@tdapoplex)

[Oct 13, 2022](https://hashnode.com/posts/deploying-terraform-at-scale-with-github-actions/6304cf503f9519428cceb631/comment/6332d10ffc1e3e483bf547de#reply-634805ba8213b93556f31865)

Yes that is correct, but with terraform I like to have an approval step. Unfortunately, the only way to apply approval steps in Github Actions is via environment protection rules. And these are only available for private repositories with a Github Enterprise license.

[Diana Borbe](https://hashnode.com/@Dianab)

[Nov 22, 2022](https://hashnode.com/posts/deploying-terraform-at-scale-with-github-actions/6304cf503f9519428cceb631/comment/6332d10ffc1e3e483bf547de#reply-637c8dd0f3615bbe07eaf969)

[Tobias Dehn](https://hashnode.com/@tdapoplex) I'm already using Github environments and protection rules. The problem I have with the protection rules is that they prevent any job from running (any branch). I need to be able to see the terraform plan, then approve the apply step.
