title: How can I read environment variables from a .env file into a terraform script?
body: <p>I'm building a lambda function on aws with terraform. The syntax within the terraform script for uploading an env var is:</p>
  
  <pre><code>resource "aws_lambda_function" "name_of_function" {
  
    ...
  
    environment {
      variables = {
        foo     = "bar"
      }
    }
  }
  </code></pre>
  
  <p>Now I have a <code>.env</code> file in my repo with a bunch of variables, e.g. <code>email='admin@example.com'</code>, and I'd like terraform to read (some of) them from that file and inject them into the space for env vars to be uploaded and available to the lambda function. How can this be done?</p>