-
Notifications
You must be signed in to change notification settings - Fork 381
Closed
Labels
Description
Introduction
Enabling module inspection and inspecting from outside the module's directory will cause the module to fail to load.
$ tflint --module ./work
Failed to load configurations; work/main.tf:1,1-18: `instance` module is not found. Did you run `terraform init`?; :
Error: `instance` module is not found. Did you run `terraform init`?
on work/main.tf line 1, in module "instance":
1: module "instance" {
$ cd work; tflint --module
# No errors
See also #1435
Expected Behavior
It loads successfully with no errors.
$ tflint --module ./work
# No errors
Actual behavior
It failed to load.
Step to Reproduce
$ mkdir work
$ cat <<EOS > work/main.tf
module "instance" {
source = "./module"
}
EOS
$ mkdir work/module
$ cat <<EOS > work/module/main.tf
resource "aws_instance" "main" {
instance_type = "tx.micro"
}
EOS
$ tree work
work
├── main.tf
└── module
└── main.tf
1 directory, 2 files
$ cd work
$ terraform get
- instance in module
$ cd ../
$ tflint --module ./work
Additional Context
$ tflint -v
TFLint version 0.40.0
+ ruleset.azurerm (0.18.0)
$ terraform -v
Terraform v1.2.6
on linux_amd64
seanamos, sthristov and timomeinen