title: Kafka-python loading ssl secrets from a string/secret/environment variable instead of a file
body: <p>I have a Lambda which reads s3 files and writes them to a topic, this is working well.</p>
  <p>However I need to read the credentials from files, since it is what the python Kafka Producer (<a href="https://kafka-python.readthedocs.io/en/master/apidoc/KafkaProducer.html#kafka.KafkaProducer" rel="nofollow noreferrer">https://kafka-python.readthedocs.io/en/master/apidoc/KafkaProducer.html#kafka.KafkaProducer</a>) expects:</p>
  <pre><code>ssl_cafile (str) – optional filename of ca file to use in certificate veriication. default: none.
  ssl_certfile (str) – optional filename of file in pem format containing the client certificate, as well as any ca certificates needed to establish the certificate’s authenticity. default: none.
  ssl_keyfile (str) – optional filename containing the client private key. default: none.
  </code></pre>
  <p>So what I end up doing is reading the secrets from a terraform resource, writing the string to a file in terraform, write the file to s3 (in terraform), download the file from s3 (in the lambda), and point to the tmp/ folder in lambda where the files were downloaded (in the Producer declaration). Much easier would be to just read the secrets from a secret manager as a string.</p>
  <p>Additionally when I create the files in Terraform the secrets get saved to a file, and I need to make sure these files don't get saved in version control.</p>
  <p>What is the correct way of authenticating a producer in AWS Lambda, and how can this be achieved through Terraform?</p>