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

command/apply: Remove implicit init call #25233

Merged
merged 1 commit into from
Jun 12, 2020

Conversation

alisdair
Copy link
Contributor

@alisdair alisdair commented Jun 12, 2020

The positional argument passed to apply was once used to specify a source for a Terraform module to fetch and initialize (#337). This functionality was removed from the init command later (#15032) but not completely removed from apply.

This code was non-functional but largely not harmful, except for a very specific case (#25068): when passing an absolute path to a plan file as the positional argument on Windows, the getter.Detect code would incorrectly interpret the path as a URL. This caused init to fail and the apply command would exit with code 1 but without diagnostics.

This commit removes this codepath, which fixes this bug, and should otherwise have no effect on the supported behaviour of apply.

Fixes #25068

Screenshots

Manual verification of the fix on Windows 10:

image

The positional argument passed to apply was once used to specify a
source for a Terraform module to fetch and initialize (#337). This
functionality was removed from the init command later (#15032) but not
completely removed from apply.

This code was non-functional but largely not harmful, except for a very
specific case: when passing an absolute path to a plan file as the
positional argument on Windows, the getter.Detect code would incorrectly
interpret the path as a URL. This caused init to fail and the apply
command would exit with code 1 but without diagnostics.

This commit removes this codepath, which fixes this bug, and should
otherwise have no effect on the supported behaviour of apply.
@alisdair alisdair requested a review from a team June 12, 2020 17:16
@alisdair alisdair self-assigned this Jun 12, 2020
@codecov
Copy link

codecov bot commented Jun 12, 2020

Codecov Report

Merging #25233 into master will increase coverage by 0.00%.
The diff coverage is n/a.

Impacted Files Coverage Δ
command/apply.go 42.46% <ø> (+1.44%) ⬆️
terraform/node_resource_plan.go 91.80% <0.00%> (-1.64%) ⬇️
terraform/evaluate.go 53.15% <0.00%> (-0.46%) ⬇️
states/statefile/version4.go 57.87% <0.00%> (-0.29%) ⬇️

@alisdair alisdair merged commit 7d4cab1 into master Jun 12, 2020
@alisdair alisdair deleted the alisdair/remove-implicit-init-then-apply branch June 12, 2020 19:52
paddycarver added a commit to hashicorp/terraform-plugin-test that referenced this pull request Jul 9, 2020
It turns out that hashicorp/terraform#25233 means that referring to
configuration files by absolute paths means that this library doesn't
work for Windows users using Terraform versions before 0.13.0-beta2. By
forcing relative paths, we can sidestep this bug, and make this work
across a wider range of Terraform versions on Windows.
@ghost
Copy link

ghost commented Jul 13, 2020

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 and limited conversation to collaborators Jul 13, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Terraform silently exits on windows using absolute plan path
2 participants