Add skip-plandiff option and fix workspace variable usage#89
Merged
Conversation
${{ github.workspace }} is evaluated at workflow parse time, not runtime, so it always resolves to /home/runner/_work/repo/repo regardless of where it's actually mounted in the container.
This commit introduces a new `skip-plandiff` input parameter that allows users to skip the plan diff validation step and proceed directly to terraform apply. Changes: - Add `skip-plandiff` input parameter (default: 'false') - Update "Plan prepare" step to skip when skip-plandiff is enabled - Update all dependent steps (Infracost, Apply) to pass when skip-plandiff is true - Ensure Terraform Apply step runs when plan validation is skipped Use case: This is useful when you want to force an apply operation without waiting for or validating plan changes, such as in emergency deployments or when plan diff validation is not required. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit fixes an issue where steps would fail when skip-plandiff is enabled because they referenced a plan file that was never created. Problem: - When skip-plandiff is true, the "Plan prepare" step doesn't run - The renewed_plan_file is never created - Subsequent steps (Convert PLANFILE to JSON, Terraform Apply) failed trying to reference the non-existent renewed_plan_file Solution: - Add "Determine Plan File" step that conditionally sets the plan file: * If skip-plandiff is true: use retrieved_plan_file (from storage) * If skip-plandiff is false: use renewed_plan_file (from plan prepare) - Update "Convert PLANFILE to JSON" to use dynamic plan file - Update "Terraform Apply" to use dynamic plan filename This ensures plan-diff still works as expected while also supporting the skip-plandiff option for emergency deployments. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Problem: - When skip-plandiff is true, the "Plan prepare" step doesn't run - This means terraform init never executes - But the deploy command was always using --skip-init - This caused "Error: Backend initialization required" failures Solution: - Only add --skip-init flag when plan-diff actually ran - When skip-plandiff is true, allow init to run during deploy - Set SKIP_INIT_FLAG conditionally based on skip-plandiff input Also removed debug line that was accidentally left in the code. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
…ariable in apply step
…ariable in apply step
Igor Rodionov (goruha)
approved these changes
Nov 21, 2025
|
These changes were released in v6.0.0. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request adds support for skipping plan diff validation in the
action.ymlworkflow, allowing users to bypass plan preparation and diff validation steps if desired. It also refactors how plan files are selected and referenced throughout the workflow, and standardizes the use of${GITHUB_WORKSPACE}for file paths. These changes improve flexibility and maintainability of the workflow.Plan Diff Skipping and Conditional Logic
skip-plandifftoaction.ymlto allow skipping plan diff validation, with corresponding conditional logic throughout the workflow to support this behavior. [1] [2]Determine Plan Fileto select the appropriate plan file and filename based on whether plan diff is skipped or not, and updated downstream steps to use this output. [1] [2] [3]File Path Standardization
${{ github.workspace }}with${GITHUB_WORKSPACE}for all file output and manipulation operations, ensuring consistency and reliability in file path references. [1] [2] [3] [4] [5]Workflow Improvements
skip-plandiffinput, ensuring correct execution flow when plan diff is skipped. [1] [2]--skip-initflag for Terraform apply, depending on whether plan diff was run.Minor Enhancements