Skip to content
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

Option -refresh=false seems not to be working anymore #27228

Closed
sdickhoven opened this issue Dec 10, 2020 · 3 comments · Fixed by #27233
Closed

Option -refresh=false seems not to be working anymore #27228

sdickhoven opened this issue Dec 10, 2020 · 3 comments · Fixed by #27233
Assignees
Labels
bug cli confirmed a Terraform Core team member has reproduced this issue

Comments

@sdickhoven
Copy link

Terraform Version

$ terraform version
Terraform v0.14.2
+ provider registry.terraform.io/cloudflare/cloudflare v2.14.0
+ provider registry.terraform.io/hashicorp/external v2.0.0
+ provider registry.terraform.io/hashicorp/null v2.1.2

Terraform Configuration Files

n/a

Debug Output

$ terraform apply -refresh=false
<redacted>: Refreshing state... [id=<redacted>]
<redacted>: Refreshing state... [id=<redacted>]
<redacted>: Refreshing state... [id=<redacted>]
<redacted>: Refreshing state... [id=<redacted>]
<redacted>: Refreshing state... [id=<redacted>]
<redacted>: Refreshing state... [id=<redacted>]
<redacted>: Refreshing state... [id=<redacted>]
...
$ env | grep TF_CLI_ARGS
TF_CLI_ARGS_apply=-refresh=false
$ terraform apply
<redacted>: Refreshing state... [id=<redacted>]
<redacted>: Refreshing state... [id=<redacted>]
<redacted>: Refreshing state... [id=<redacted>]
<redacted>: Refreshing state... [id=<redacted>]
<redacted>: Refreshing state... [id=<redacted>]
<redacted>: Refreshing state... [id=<redacted>]
<redacted>: Refreshing state... [id=<redacted>]
...
$ TF_CLI_ARGS_apply="-refresh=false" terraform apply
<redacted>: Refreshing state... [id=<redacted>]
<redacted>: Refreshing state... [id=<redacted>]
<redacted>: Refreshing state... [id=<redacted>]
<redacted>: Refreshing state... [id=<redacted>]
<redacted>: Refreshing state... [id=<redacted>]
<redacted>: Refreshing state... [id=<redacted>]
<redacted>: Refreshing state... [id=<redacted>]
...

Crash Output

n/a

Expected Behavior

When option -refresh=false is used or env var TF_CLI_ARGS (or TF_CLI_ARGS_apply) is set to -refresh=false then terraform should not do a refresh when running terraform apply.

Actual Behavior

Terraform does a full-on state refresh.

Steps to Reproduce

$ terraform apply -refresh=false

Additional Context

We have some large configs (e.g. DNS, GitHub) that take 1hr+ to refresh state. We only do refreshes on those occasionally. So not having -refresh=false is kind of a show stopper for us.

References

n/a

@sdickhoven sdickhoven added bug new new issue not yet triaged labels Dec 10, 2020
@sdickhoven
Copy link
Author

another use case for -refresh=false is config change validation for users who are not allowed to interact with the provider api (but do have read-only access to the terraform state file).

@jbardin
Copy link
Member

jbardin commented Dec 10, 2020

Thanks @sdickhoven!

Looks like since the primary workflow is to apply from a plan, the -refresh flag for apply was overlooked. The flag does work correctly with terraform plan.

Just a note about the second use-case you've presented; providers may need to make API calls to create a plan as well, so even without refresh, there is no way to guarantee that users can always create a plan successfully without API access.

Thanks!

@jbardin jbardin added cli confirmed a Terraform Core team member has reproduced this issue and removed new new issue not yet triaged labels Dec 10, 2020
@jbardin jbardin self-assigned this Dec 10, 2020
@ghost
Copy link

ghost commented Jan 10, 2021

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.

If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@ghost ghost locked as resolved and limited conversation to collaborators Jan 10, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug cli confirmed a Terraform Core team member has reproduced this issue
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants