Skip to content

How to detect changes in plan step #405

Answered by rdhar
palakraina asked this question in Q&A
Discussion options

You must be logged in to vote

This is likely because of "hashicorp/setup-terraform" being used without terraform_wrapper: false, as documented in their repo's open issue. Here's how to work around it to meet your given requirements:

- name: Checkout repo
  uses: actions/checkout@v4

- name: Setup Terraform
  uses: hashicorp/setup-terraform@v3
  with:
    terraform_wrapper: false

- name: Terraform Plan
  id: plan
  uses: op5dev/tf-via-pr@v13
  with:
    working-directory: "./xyz"
    command: plan
    arg-lock: false
    validate: true

- name: Terraform Apply
  uses: op5dev/tf-via-pr@v13
  if: steps.plan.outputs.exitcode == 2
  with:
    working-directory: "./xyz"
    command: apply
    arg-lock: true

You don't need …

Replies: 1 comment 5 replies

Comment options

You must be logged in to vote
5 replies
@palakraina
Comment options

@rdhar
Comment options

rdhar Feb 4, 2025
Maintainer

@palakraina
Comment options

@rdhar
Comment options

rdhar Feb 4, 2025
Maintainer

@palakraina
Comment options

Answer selected by rdhar
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants