Skip to content

[FIX #337] support terraform plan -refresh=false #354

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

rjinski
Copy link

@rjinski rjinski commented Nov 7, 2024

#337

Add the ability to support the refresh-false terraform plan argument.

-refresh=false      Skip checking for external changes to remote objects
                      while creating the plan. This can potentially make
                      planning faster, but at the expense of possibly planning
                      against a stale record of the remote system state.

https://developer.hashicorp.com/terraform/cli/commands/plan#planning-options
https://opentofu.org/docs/cli/commands/plan/#planning-options

Copy link

github-actions bot commented Nov 7, 2024

Terraform plan for pull_request_target

Plan: 1 to add, 0 to change, 0 to destroy. Changes to Outputs.
Terraform used the selected providers to generate the following execution
plan. Resource actions are indicated with the following symbols:
+   create

Terraform will perform the following actions:

  # random_string.my_string will be created
+   resource "random_string" "my_string" {
+       id          = (known after apply)
+       length      = 11
+       lower       = true
+       min_lower   = 0
+       min_numeric = 0
+       min_special = 0
+       min_upper   = 0
+       number      = true
+       numeric     = true
+       result      = (known after apply)
+       special     = true
+       upper       = true
    }

Plan: 1 to add, 0 to change, 0 to destroy.

Changes to Outputs:
+   output_string = "the_string"

✅ Plan applied in pull_request_target test #614

Outputs
output_string = "the_string"

@rjinski
Copy link
Author

rjinski commented Nov 25, 2024

@dflook any objections to these changes?

@rjinski
Copy link
Author

rjinski commented Mar 13, 2025

@dflook any suggestions on this?

@rjinski rjinski force-pushed the add-refresh-false branch from 9c22b31 to 7e799de Compare March 13, 2025 09:41
@dflook
Copy link
Owner

dflook commented Mar 13, 2025

Hi @rjinski, thanks for your efforts on this. I know it could be quite useful for some users.

In my mind, to make this complete:

  • This affects both plan and apply, which is fine but the metadata should be added for both
  • The READMEs need to be updated
  • The PR comment should indicate when the state wasn't refreshed
  • There should be a new refresh action that only refreshes the state
  • Tests

I've had a branch myself for implementing this, for a long time now 😅. It's one of the things I want to add in the next few releases, so i'll likely continue working on this soon.

@dflook
Copy link
Owner

dflook commented Mar 24, 2025

In v1.48.0 a refresh input was added for the plan and apply actions. A refresh actions was added as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants