Pull Request

Note: Premium video content requires a subscription.

Let’s take a look at PR workflow.


name: Pull Request Plan

  - pull_request

    runs-on: ubuntu-latest

      AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
      AWS_REGION: us-west-2
      GH_TOKEN: ${{ github.token }}
      TS_ENV: dev
      TS_TOKEN: ${{ secrets.TS_TOKEN }}
      # INFRACOST_API_KEY: ${{ secrets.TS_TOKEN }} # needed if using cost estimation

    - name: Checkout
      uses: actions/checkout@v3

    - name: Install Ruby
      uses: ruby/setup-ruby@v1
        ruby-version: 3.1
        bundler-cache: true # runs 'bundle install' and caches installed gems automatically

    - name: Install

    - name: Terraspace Command
      run: |
        terraspace plan demo

The difference here is that this workflow only runs on pull_request events and will run a terraspace plan.

Create Branch and PR

git checkout feature1
vim app/stacks/demo/main.tf
git add .
git commit -m "change code"
git push -u origin feature1

To create a Pull Request, you can either go to the url printed out from git push


Or go to the branch on GitHub and click “New Pull Request”. Click “Create pull request”. A Pull Request Plan / run should start immediately. You should see something like this:

Logging Details

You can click on the Details to see the Workflow Logging output.

A plan was run and provided a preview of what would happen. Any additional git push to the PR branch will provide updated previews.

Pull Request Comment

Also, PR comment with a Terraspace Cloud link was added. It looks something like this.

If you merge the PR, the Push Workflow that we covered earlier will automatically apply the preview.

Next, we’ll cover the manual workflow dispatch.

More tools: