title: Terraform convention: Should I declare a "constant" as a variable or local?
body: <p><em>Example</em>: In Azure, I'm deploying multiple resource groups, managed disks, network interfaces, etc, all in the same region.</p>
  
  <p>I want to declare a "region" primitive (a "constant"), which all these resources will reference. 
  Which of those is following convention?</p>
  
  <p>a) variables.tf:</p>
  
  <pre><code>variable "region" {
      type = string
      default = "a-place"
  }
  </code></pre>
  
  <p>b) locals.tf</p>
  
  <pre><code>locals {
      region = "a-place"
  }
  </code></pre>
  
  <p>Naturally, I would choose to declare it as a local. I would only use a variable if I expect a value to come (or be overridden) from environment variables, command line, or if I were creating a module.
  However, I haven't seen local being used for "declaring constants" in any examples, which makes me think that a convention exists to use locals with very limited scope (e.g. mainly for creating structures which can be of use with <code>count</code> and <code>for_each</code> constructions).</p>
  
  <p>Covering my back before someone flags this as opinion based: I'm asking what the convention is, not what your opinion is that the convention should be.</p>
  
  <p>Follow-up question:
  Would the answer be any different if this example covered IP addresses, resource name prefixes, etc. instead of region? <em>(does the convention only cover particular fields?)</em></p>