github.com/muratcelep/terraform@v1.1.0-beta2-not-internal-4/website/docs/language/files/index.html.md (about)

     1  ---
     2  layout: "language"
     3  page_title: "Files and Directories - Configuration Language"
     4  description: "Learn how to name, organize, and store Terraform configuration files. Also learn how Terraform evaluates modules."
     5  ---
     6  
     7  # Files and Directories
     8  
     9  ## File Extension
    10  
    11  Code in the Terraform language is stored in plain text files with the `.tf` file
    12  extension. There is also
    13  [a JSON-based variant of the language](/docs/language/syntax/json.html) that is named with
    14  the `.tf.json` file extension.
    15  
    16  Files containing Terraform code are often called _configuration files._
    17  
    18  ## Text Encoding
    19  
    20  Configuration files must always use UTF-8 encoding, and by convention
    21  usually use Unix-style line endings (LF) rather than Windows-style
    22  line endings (CRLF), though both are accepted.
    23  
    24  ## Directories and Modules
    25  
    26  A _module_ is a collection of `.tf` and/or `.tf.json` files kept together in a
    27  directory.
    28  
    29  A Terraform module only consists of the top-level configuration files in a
    30  directory; nested directories are treated as completely separate modules, and
    31  are not automatically included in the configuration.
    32  
    33  Terraform evaluates all of the configuration files in a module, effectively
    34  treating the entire module as a single document. Separating various blocks into
    35  different files is purely for the convenience of readers and maintainers, and
    36  has no effect on the module's behavior.
    37  
    38  A Terraform module can use [module calls](/docs/language/modules/index.html) to
    39  explicitly include other modules into the configuration. These child modules can
    40  come from local directories (nested in the parent module's directory, or
    41  anywhere else on disk), or from external sources like the
    42  [Terraform Registry](https://registry.terraform.io).
    43  
    44  ## The Root Module
    45  
    46  Terraform always runs in the context of a single _root module._ A complete
    47  _Terraform configuration_ consists of a root module and the tree of child
    48  modules (which includes the modules called by the root module, any modules
    49  called by those modules, etc.).
    50  
    51  - In Terraform CLI, the root module is the working directory where Terraform is
    52    invoked. (You can use command line options to specify a root module outside
    53    the working directory, but in practice this is rare. )
    54  - In Terraform Cloud and Terraform Enterprise, the root module for a workspace
    55    defaults to the top level of the configuration directory (supplied via version
    56    control repository or direct upload), but the workspace settings can specify a
    57    subdirectory to use instead.
    58