Skip to content

Commit

Permalink
Update terraform, deploy edge-lambdas
Browse files Browse the repository at this point in the history
  • Loading branch information
MarcoDaniels committed Jan 21, 2024
1 parent 3a65538 commit acf75fd
Show file tree
Hide file tree
Showing 4 changed files with 60 additions and 54 deletions.
91 changes: 49 additions & 42 deletions infrastructure/.terraform.lock.hcl

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions infrastructure/lambda/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ let
name = "elm-aws-cloudfront";
src = fetchGit {
url = "https://github.com/MarcoDaniels/elm-aws-cloudfront.git";
ref = "refs/tags/nix-1.0.0";
ref = "refs/tags/nix-1.0.1";
};
installPhase = ''
mkdir -p $out
Expand All @@ -22,7 +22,7 @@ in cloudfront.buildElmAWSCloudFront {
{ module = ./src/WebsiteResponse.elm; }
{
module = ./src/AssetRequest.elm;
flags = [ ''token:"token"'' ''domain:"domain"'' ];
flags = [ ''token:"''${token}"'' ''domain:"''${domain}"'' ];
}
{ module = ./src/AssetResponse.elm; }
];
Expand Down
9 changes: 2 additions & 7 deletions infrastructure/lambda/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,9 @@ data "archive_file" "zip" {
output_path = "${path.module}/result/${var.lambda-name}/index.zip"

source {
content = templatefile("${path.module}/result/${var.lambda-name}/index.js", var.replacements)
content = templatefile("${path.module}/result/${var.lambda-name}.js", var.replacements)
filename = "index.js"
}

source {
content = templatefile("${path.module}/result/${var.lambda-name}/elm.js", var.replacements)
filename = "elm.js"
}
}

data "aws_iam_policy_document" "lambda-edge" {
Expand Down Expand Up @@ -75,7 +70,7 @@ resource "aws_lambda_function" "lambda-function" {
filename = data.archive_file.zip.output_path
source_code_hash = data.archive_file.zip.output_base64sha256
handler = "index.handler"
runtime = "nodejs14.x"
runtime = "nodejs20.x"

depends_on = [
aws_iam_role_policy_attachment.lambda-logs,
Expand Down
10 changes: 7 additions & 3 deletions infrastructure/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ terraform {
required_providers {
aws = {
source = "hashicorp/aws"
version = "3.70.0"
version = "5.32.1"
}

dhall = {
source = "awakesecurity/dhall"
version = "0.0.2"
version = "0.0.7"
}
}
}
Expand Down Expand Up @@ -44,7 +44,11 @@ provider "aws" {
// S3
resource "aws_s3_bucket" "bucket" {
bucket_prefix = local.aws.bucketPrefix
acl = "private"
}

resource "aws_s3_bucket_acl" "bucket-acl" {
bucket = aws_s3_bucket.bucket.id
acl = "private"
}

data "aws_iam_policy_document" "bucket-policy" {
Expand Down

0 comments on commit acf75fd

Please sign in to comment.