Code Monkey home page Code Monkey logo

terraform-python-packager's Introduction

terraform-python-packager

Terraform module to create an archive for a python package with its dependencies. A possible use case is to deploy a lambda function to AWS with custom dependencies.

Example usage

module python_packager {
  source  = "github.com/Bubo-AI/terraform-python-packager?ref=v0.1.0"
  src_dir = "/path/to/python/package"
}

Fully working example for deploying a custom python module to AWS Lambda function can be found inside the example folder.

Inputs

Variable Description Type Default
src_dir Path to python package directory without trailing /. string N/A
requirements_path* Path to requirements.txt. Required if src_dir does not contain it. string src_dir/requirements.txt
package_name* Path to output archive file. string pkg.zip

* optional variable

Outputs

Name Description
package_path The path of zip archive.
package_hash The base64-encoded SHA256 checksum of the archive file.

Requirements

This module was tested against Terraform v1.1.3. It does not use any Terraform providers, and does not declare any Terraform resources. It is compatible with *nix systems.

Limitations

This module assumes archived package will run on 64-bit linux environment and required python version is 3.9.

If you have different requirements, please adjust the parameters of pip from the last local-exec provider inside the main.tf.

Note regarding symbolic links

Due to a bug, this module does not currently create proper zip archives when the source includes symbolic links (also known as "symlinks"). Please see Terraform Archive Issue #6 for more details and workaround options.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.