title: AWS lambda function through terraform - Could not unzip uploaded file. Please check your file, then try to upload again
body: <p>I am using terraform to create lambda function and already have zip package in S3. But I get below error:</p>
  <pre><code>  RespMetadata: {
      StatusCode: 400,
      RequestID: &quot;fa9b0e8b-02a6-4eaf-81ae-bf30fc6a1153&quot;
    },
    Message_: &quot;Could not unzip uploaded file. Please check your file, then try to upload again.&quot;,
    Type: &quot;User&quot;
  }
  </code></pre>
  <p>My code looks as below:</p>
  <pre><code>resource &quot;aws_lambda_function&quot; &quot;test_lambda&quot; {
    s3_bucket = &quot;bucket_name&quot;
    s3_key = &quot;lambda.zip&quot;
    function_name = &quot;Function_Test&quot;
    role = aws_iam_role.test_lambda_role.arn
    handler = &quot;config.lambda_handler&quot;
    runtime = &quot;python3.8&quot;
    timeout = 180
    vpc_config {
      subnet_ids = [&quot;subnet-123&quot;]
      security_group_ids = [&quot;sg-123&quot;]
    }
  
    environment {
      variables = {
        LOG_LEVEL = &quot;DEBUG&quot;
        host = &quot;https://abc:9098&quot;
      }
    }
  }
  </code></pre>