Skip to content

Commit

Permalink
fixing aws
Browse files Browse the repository at this point in the history
  • Loading branch information
shashitnak committed Jun 22, 2024
1 parent 58d7ec8 commit 0a144a2
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 25 deletions.
3 changes: 3 additions & 0 deletions aws/start
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/sh -l

BOOTSTRAP_PATH
10 changes: 8 additions & 2 deletions aws/tailcall.tf
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,11 @@ data "http" "bootstrap" {
url = data.github_release.tailcall.assets[index(data.github_release.tailcall.assets.*.name, "tailcall-aws-lambda-bootstrap")].browser_download_url
}

resource "local_sensitive_file" "start" {
content_base64 = filebase64("aws/start")
filename = "start"
}

resource "local_sensitive_file" "bootstrap" {
content_base64 = data.http.bootstrap.response_body_base64
filename = var.BOOTSTRAP_PATH
Expand All @@ -107,7 +112,8 @@ data "archive_file" "tailcall" {
type = "zip"
depends_on = [
local_sensitive_file.bootstrap,
local_sensitive_file.config
local_sensitive_file.config,
local_sensitive_file.start
]
source_dir = "config"
output_path = "tailcall.zip"
Expand All @@ -122,7 +128,7 @@ resource "aws_lambda_function" "tailcall" {
function_name = var.AWS_LAMBDA_FUNCTION_NAME
runtime = "provided.al2"
architectures = ["x86_64"]
handler = var.BOOTSTRAP_PATH
handler = "start"
filename = data.archive_file.tailcall.output_path
source_code_hash = data.archive_file.tailcall.output_base64sha256
}
Expand Down
21 changes: 0 additions & 21 deletions scripts/create-tf-zip.sh

This file was deleted.

4 changes: 2 additions & 2 deletions scripts/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -81,10 +81,10 @@ deploy() {
# todo: handle name collisions
mkdir -p /aws/config
cp -r /app/* /aws/config
awk -v bootstrap_path="$TF_VAR_BOOTSTRAP_PATH" "{sub(/BOOTSTRAP_PATH/,bootstrap_path)}1" /aws/lambda-function > /tmp/lambda-function
mv /tmp/lambda-function /aws/lambda-function
cd /aws
echo "List: $(find /app -type f)"
# /scripts/create-tf-zip.sh
echo "List: $(find /app -type f)"
setup_terraform
awk -v org="\"$TERRAFORM_ORG\"" "{sub(/var.TERRAFORM_ORG/,org)}1" /aws/tailcall.tf > /tmp/temp1.tf
awk -v workspace="\"$TERRAFORM_WORKSPACE\"" "{sub(/var.TERRAFORM_WORKSPACE/,workspace)}1" /tmp/temp1.tf > /tmp/temp2.tf
Expand Down

0 comments on commit 0a144a2

Please sign in to comment.