github.com/jpreese/tflint@v0.19.2-0.20200908152133-b01686250fb6/docs/rules/terraform_standard_module_structure.md (about)

     1  # terraform_standard_module_structure
     2  
     3  Ensure that a module complies with the Terraform [Standard Module Structure](https://www.terraform.io/docs/modules/index.html#standard-module-structure)
     4  
     5  ## Example
     6  
     7  _main.tf_
     8  ```hcl
     9  variable "v" {}
    10  ```
    11  
    12  ```
    13  $ tflint
    14  1 issue(s) found:
    15  
    16  Warning: variable "v" should be moved from main.tf to variables.tf (terraform_standard_module_structure)
    17  
    18    on main.tf line 1:
    19     1: variable "v" {}
    20  
    21  Reference: https://github.com/terraform-linters/tflint/blob/v0.16.0/docs/rules/terraform_standard_module_structure.md
    22  ```
    23  
    24  ## Why
    25  
    26  Terraform's documentation outlines a [Standard Module Structure](https://www.terraform.io/docs/modules/index.html#standard-module-structure). A minimal module should have a `main.tf`, `variables.tf`, and `outputs.tf` file. Variable and output blocks should be included in the corresponding file.
    27  
    28  ## How To Fix
    29  
    30  * Move blocks to their conventional files as needed
    31  * Create empty files even if no `variable` or `output` blocks are defined