Skip to content

Instantly share code, notes, and snippets.

@apr-1985
Last active September 8, 2022 15:17
Show Gist options
  • Select an option

  • Save apr-1985/aef082f4ca7494b35a164251c72a51c3 to your computer and use it in GitHub Desktop.

Select an option

Save apr-1985/aef082f4ca7494b35a164251c72a51c3 to your computer and use it in GitHub Desktop.
Medium: Managing AWS Lambda Code Outside of Terraform
data "archive_file" "bootstrap_lambda" {
type = "zip"
output_path = "${path.module}/lambda_function_payload.zip"
source {
content = "hello"
filename = "bootstrap.txt"
}
}
resource "aws_lambda_function" "my_lambda" {
filename = data.archive_file.bootstrap_lambda.output_path
function_name = var.lambda_name
role = aws_iam_role.lambda_exec.arn
handler = var.entrypoint
runtime = var.runtime
source_code_hash = data.archive_file.bootstrap_lambda.output_base64sha256
reserved_concurrent_executions = var.concurrent_executions
memory_size = var.memory_size
timeout = var.timeout
environment {
variables = local.all_lambda_environment_variables
}
tags = local.tags
lifecycle {
ignore_changes = [source_code_hash, ]
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment