Skip to content

Instantly share code, notes, and snippets.

@mattbroekhuis
Created January 16, 2026 23:11
Show Gist options
  • Select an option

  • Save mattbroekhuis/c014cd2e292000089d7ee58eb1fc9e1b to your computer and use it in GitHub Desktop.

Select an option

Save mattbroekhuis/c014cd2e292000089d7ee58eb1fc9e1b to your computer and use it in GitHub Desktop.
build a python file in terraform
resource "null_resource" "build_lambda" {
triggers = {
src_hash = sha1(join("", [for f in fileset("${path.module}/../src", "**") : filesha1("${path.module}/../src/${f}")]))
pyproject_hash = filesha1("${path.module}/../pyproject.toml")
poetry_lock_hash = filesha1("${path.module}/../poetry.lock")
}
provisioner "local-exec" {
command = "cd .. && make build"
}
}
data "archive_file" "lambda_zip" {
type = "zip"
source_dir = "${path.module}/../.build/lambda_content"
output_path = "${path.module}/../.build/lambda.zip"
depends_on = [null_resource.build_lambda]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment