Answers: <p>While it's best practice to use <code>variables.tf</code> and <code>outputs.tf</code>, both variables and outputs can be declared in any file - so in a way it just boils down to both personal preference along with any formatting rules that may exist in your project or team.</p>
  <p>Personally, I prefer to always use these files as it helps me keep things tidy and organized.</p>
  
Answers: CC BY-SA 4.0
Answers: 2022-03-02T13:49:53.230Z
Answers: 2022-03-02T13:49:53.230Z
Answers: Joan Serra
Body: <p>I've been reading up the Terraform standard module structure and I see they want a main, outputs, and variables file in every one.</p>
  <p>I have a pair of modules where everything fits in a single tmux window, is it really worth breaking out into three files for such a small module or is this a rule that is really only applied at scale?</p>
  
Tags: <terraform><terraform-module>
Title: Terraform single-file modules
UserDisplayName: ChrisW
ThreadText: # Terraform single-file modules
  
  (Asked by: username_0 on 2022-01-21)
  
  I've been reading up the Terraform standard module structure and I see they want a main, outputs, and variables file in every one.
  
  I have a pair of modules where everything fits in a single tmux window, is it really worth breaking out into three files for such a small module or is this a rule that is really only applied at scale?
  
  **Tags:** terraform, terraform-module
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2022-03-02. Score: 3
  
  While it's best practice to use `variables.tf` and `outputs.tf`, both variables and outputs can be declared in any file - so in a way it just boils down to both personal preference along with any formatting rules that may exist in your project or team.
  
  Personally, I prefer to always use these files as it helps me keep things tidy and organized.
  
  
  ---
  
  