Skip to content

Question - Can be used if it is not part of a PR? #392

@csaavedravanta

Description

@csaavedravanta

Hello,
I have a question, can TF-via-PR be used to run a terraform command without being part of a PR, for example to execute a plan if the job is not executed in a PR event?
What happens if the event is not a PR, will it run only the plan without doing nothing over any PR since it does not exists in this context?
I see there is an option called comment-pr that I could set as never, but not sure if this will fail since the job won't run over a PR event.
My question is because we have some reusable code that execute the terraform plan , but that is called from some workflow that is called from PR events, but there are also other workflows which are not executed with PR events, like workflow_dispatch or push.

for example:

on:
  workflow_dispatch:
  push:
    branches:
      - main
jobs:
    terraform-plan:
     steps:
      - name: Checkout repo
        ......
      - name: Configure AWS credentials
        ......
      - name: Terraform plan
        uses: op5dev/tf-via-pr@v13.0.2
        with:
          working-directory: terraform/code
          command: plan
          arg-reconfigure: "true"
          arg-backend: "true"
          arg-get: "true"
          arg-backend-config: terraform/code/backed-config.txt
          arg-refresh: "false"
          arg-var-file: terraform/code/variables.tfvars
          plan-encrypt: ${{ github.sha }}
          comment-pr: never

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions