Verified Commit 8e66a8d7 authored by Florian Forster's avatar Florian Forster
Browse files

fix(tflint): Handle the absence of `.terraform.lock.hcl` gracefully.

The function `find_tf_modules()` falls back to searching for `*.tf` if
`.terraform.lock.hcl` does not exist.

However, in that case `terraform init` fails due to the `-lockfile=readonly`
flag with the following unintuitive error message:

> Error: Provider dependency changes detected
>
> Changes to the required provider dependencies were detected, but the lock
> file is read-only. To use and record these requirements, run "terraform init"
> without the "-lockfile=readonly" flag.

With this change, the `-lockfile=readonly` flag is only passed if
`.terraform.lock.hcl` exists. Otherwise, a warning is printed.
parent 87710775
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment