title: Deploying simple helloworld lambda function (python) using Terraform script - error creating "test lambda"
body: <p>I am trying to create a lambda function using terraform script
  I get error saying &quot;error creating lambda function&quot; I have put the screen shot of the error also
  <a href="https://i.stack.imgur.com/ZT4MD.gif" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ZT4MD.gif" alt="Error " /></a></p>
  <p>This is the terraform script:</p>
  <p>I created a role in AWS Management console and gave a name as &quot;Welcome-Lambda-Role&quot;. That is what I referred to that role in the script below. I don't know if that is the issue.</p>
  <pre><code>provider &quot;aws&quot; {
    region     = &quot;us-west-2&quot;
    access_key = &quot;xxz&quot;
    secret_key = &quot;yyyydtEyZtOaQVGF5h&quot;
  }
  data &quot;archive_file&quot; &quot;welcome&quot; {
    type = &quot;zip&quot;
    source_file = &quot;welcome.py&quot;
    output_path = &quot;outputs/welcome.zip&quot;
  }
  resource &quot;aws_lambda_function&quot; &quot;test_lambda&quot; {
    filename = &quot;outputs/welcome.zip&quot;
    function_name = &quot;welcome&quot;
    handler = &quot;welcome.hello&quot;
  
    //created this role manually in AWS console and referred to that role in the next line
    role = &quot;Welcome-Lambda-Role&quot;
   
    //source_code_hash = filebase64sha256(&quot;lambda_function_payload.zip&quot;)
    runtime = &quot;python3.7&quot;
  }
  </code></pre>
  <p>welcome.py file content</p>
  <pre><code>  def hello(event, context):
       print(&quot;Welcome to terraform&quot;)
  </code></pre>