title: Using an environment variable as a map for common tags in a locals block
body: <p>I've run into a specific problem while trying to automate a tagging process in terraform. I've set an environment variable that is essentially a list of all the tags we'd be using for all resources provisioned in the apply. It looks like this...</p>
  <p><code>export TF_VAR_taglist='{JiraEpic = &quot;ETOS-56&quot;,&quot;AssignedResearcherPri&quot; = &quot;Isaac&quot;,AssignedResearcherSec = &quot;Matt&quot;}'</code></p>
  <p>After setting the environment variable I added a variable called &quot;taglist&quot; in the variables.tf file that grabs the aforementioned environment variable. It looks like this...</p>
  <p><code>variable &quot;taglist&quot;{}</code></p>
  <p>Lastly, I have another locals.tf file where i set a common_tags variable. Like so...</p>
  <p><code>locals { common_tags =&quot;${var.taglist}&quot; }</code></p>
  <p>When i terraform apply, the build fails while trying to map the tags properly. This is the error i receive...</p>
  <pre><code>Error: Incorrect attribute value type
  
    on kube_master_worker_nodes_ec2.tf line 9, in resource &quot;aws_instance&quot; &quot;master&quot;:
     9:   tags = local.common_tags
      |----------------
      | local.common_tags is &quot;{JiraEpic = \&quot;ETOS-56\&quot;,AssignedResearcherPri = \&quot;Isaac \&quot;,AssignedResearcherSec = \&quot;Matt\&quot;}&quot;
  
  Inappropriate value for attribute &quot;tags&quot;: map of string required.
  
  </code></pre>
  <p>I then decided to define the type of the variable as <code>map(string</code> in the variables.tf file like this
  <code>variable &quot;taglist&quot;{ type = map(string) }</code>
  I had hoped that this would allow terraform to recognize this variable as a map of strings and not just a string literal, but I was wrong, and these are the errors I get when that definition is applied.</p>
  <pre><code>Error: Missing attribute separator
  
    on &lt;value for var.taglist&gt; line 1:
    (source code not available)
  
  Expected a newline or comma to mark the beginning of the next attribute.
  
  
  Error: No value for required variable
  
    on variables.tf line 11:
    11: variable &quot;taglist&quot;{
  
  The root module input variable &quot;taglist&quot; is not set, and has no default value.
  Use a -var or -var-file command line argument to provide a value for this
  variable.
  </code></pre>
  <p>I'm really stuck on this, and I feel like I'm close. Can anyone provide some insight into this and how I should go about solving it?</p>