github.com/terraform-linters/tflint@v0.51.2-0.20240520175844-3750771571b6/docs/user-guide/calling-modules.md (about)

     1  # Calling Modules
     2  
     3  You can inspect not only the root module but also [module calls](https://developer.hashicorp.com/terraform/language/modules/syntax#calling-a-child-module). TFLint evaluates each call (i.e. `module` block) and emits any issues that result from the specified input variables.
     4  
     5  ```hcl
     6  module "aws_instance" {
     7    source        = "./module"
     8  
     9    ami           = "ami-b73b63a0"
    10    instance_type = "t1.2xlarge"
    11  }
    12  ```
    13  
    14  ```console
    15  $ tflint
    16  1 issue(s) found:
    17  
    18  Error: instance_type is not a valid value (aws_instance_invalid_type)
    19  
    20    on template.tf line 5:
    21     5:   instance_type = "t1.2xlarge"
    22  
    23  Callers:
    24     template.tf:5,19-31
    25     module/instance.tf:5,19-36
    26  
    27  ```
    28  
    29  By default, TFLint only calls local modules whose the `source` is a relative path like `./*`. If you want to call remote modules (registry, git, etc.), you must run `terraform init` (or `terraform get`) before invoking TFLint so that modules are loaded into the `.terraform` directory. After that, invoke TFLint with `--call-module-type=all`.
    30  
    31  ```console
    32  $ terraform init
    33  $ tflint --call-module-type=all
    34  ```
    35  
    36  The `--call-module-type` can also be set via configuration:
    37  
    38  ```hcl
    39  config {
    40    call_module_type = "all"
    41  }
    42  ```
    43  
    44  If you don't want to call any modules, pass `--call-module-type=none`:
    45  
    46  ```console
    47  $ tflint --call-module-type=none
    48  ```
    49  
    50  If you want to ignore inspection for a particular module, you can use `--ignore-module`:
    51  
    52  ```console
    53  $ tflint --ignore-module=./module
    54  ```
    55  
    56  ## Caveats
    57  
    58  * Issues _must_ be associated with a variable that was passed to the module. If an issue within a child module is detected in an expression that does not reference a variable (`var`), it will be discarded.
    59  * Rules that evaluate syntax rather than content _should_ ignore child modules.
    60  * If you want to evaluate all TFLint rules on non-root modules, inspect directly against the module directories. Note that there is a difference between calling a child module in an inspection and inspecting a child module as the root module.