You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Feb 5, 2024. It is now read-only.
I've been looking at some provider documentation and it looks like we could possibly cut SLS out of the equation completely.
The below (primitive) example enables archiving of a function (one file for now) and deploying to lambda.
Every time plan/apply is run, the archive file is recreated and lambda will check if the new archive checksum matches that of the deployed archive. There is also a similar funciton for layers.
provider"archive" {}
locals {
sourcefile ="${path.module}/../${var.function["filepath"]}"
archive ="${path.module}/../dist/${replace("${var.function["filepath"]}", "/.js/", ".zip")}"
}
data"archive_file""init" {
type ="zip"
source_file ="${local.sourcefile}"
output_path ="${local.archive}"
}
resource"aws_lambda_function""test_lambda" {
filename ="${data.archive_file.init.output_path}"
function_name ="${var.function["name"]}"
handler ="${var.function["handler"]}"# The filebase64sha256() function is available in Terraform 0.11.12 and later# For Terraform 0.11.11 and earlier, use the base64sha256() function and the file() function:# source_code_hash = "${base64sha256(file("lambda_function_payload.zip"))}"
source_code_hash ="${filebase64sha256("${data.archive_file.init.output_path}")}"
runtime ="${var.function["runtime"]}"
}
variable"function" {
type ="map"
default = {
name ="base_fn"
filepath ="src/server/base.js"
runtime ="nodejs8.10"
handler ="exports.handler"
}
}
There's probably a bunch of scenarios still to consider:
Archival of multiple files
Permission issues (can a dev run this along with the existing terraform config?)
The text was updated successfully, but these errors were encountered:
I've been looking at some provider documentation and it looks like we could possibly cut SLS out of the equation completely.
The below (primitive) example enables archiving of a function (one file for now) and deploying to lambda.
Every time plan/apply is run, the archive file is recreated and lambda will check if the new archive checksum matches that of the deployed archive. There is also a similar funciton for layers.
There's probably a bunch of scenarios still to consider:
The text was updated successfully, but these errors were encountered: