- Clone:
git clone https://github.com/brookhong/Surfingkeys.git
cd Surfingkeys
git checkout 83721a81a21fe1527d269c91b93ca28c42598e69 # last known safe commit
git branch SAFE # make a new branch at this point
git checkout SAFE
data "archive_file" "lambda_source" { | |
type = "zip" | |
source_dir = "${path.module}/lambdas/mylambda/" | |
output_path = "lambda_source.zip" | |
} | |
resource "null_resource" "lambda_deploy" { | |
triggers = { | |
lambda_hash = "${data.archive_file.lambda_source.output_sha}" | |
} |
#!/usr/bin/env bash | |
set -e | |
eval "$(jq -r '@sh "DIRECTORY=\(.directory)"')" | |
HASH=$(git ls-files --exclude-standard -os ${DIRECTORY} | git hash-object --stdin) | |
echo "{\"checksum\": \"${HASH}\"}" |
data "external" "lambda_source_trigger" { | |
program = ["${path.module}/gethash.sh"] | |
query = { | |
directory = "${path.module}/lambdas/mylambda" | |
} | |
} | |
resource "null_resource" "deploy_lambda" { | |
triggers = { |
git ls-files --exclude-standard -os $SRC | git hash-object --stdin | |
# Outputs: 6c385b1a8e5438bb756bac652d0cd6be9d555dbe (or similar) |
#!/bin/bash | |
set -e | |
function cleanup { | |
echo "" | |
echo "Cleaning up processes" | |
kill -SIGINT -$GID | |
} | |
trap cleanup EXIT | |
if [ "$1" ]; then |