Skip to content

Instantly share code, notes, and snippets.

@kyleian
Created November 24, 2018 21:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kyleian/294cbacac7cde81dbe21ff57beaffb91 to your computer and use it in GitHub Desktop.
Save kyleian/294cbacac7cde81dbe21ff57beaffb91 to your computer and use it in GitHub Desktop.
resource "aws_lambda_function" "api" {
s3_bucket = "${aws_s3_bucket_object.api.bucket}"
s3_key = "${aws_s3_bucket_object.api.key}"
s3_object_version = "${aws_s3_bucket_object.api.version_id}"
function_name = "${var.resource_prefix}-api"
description = "${var.project_name} API"
role = "${aws_iam_role.lambda_execution.arn}"
runtime = "${var.lambda_runtime}"
timeout = "${var.lambda_timeout}"
memory_size = "${var.lambda_memory_size_api}"
handler = "${var.lambda_handler_api}"
environment {
variables {
ENV = "${var.env}"
SFTP_SERVER = "${var.sftp_server}"
SFTP_PATH = "${var.sftp_path}"
SFTP_USERNAME = "${var.sftp_username}"
SFTP_PASSWORD = "${var.sftp_password}"
}
}
vpc_config = {
subnet_ids = "${var.lambda_subnets}"
security_group_ids = "${var.lambda_security_groups}"
}
}
resource "aws_lambda_function" "ping" {
s3_bucket = "${aws_s3_bucket_object.api.bucket}"
s3_key = "${aws_s3_bucket_object.api.key}"
s3_object_version = "${aws_s3_bucket_object.api.version_id}"
function_name = "${var.resource_prefix}-api"
description = "${var.project_name} API"
role = "${aws_iam_role.lambda_execution.arn}"
runtime = "${var.lambda_runtime}"
timeout = "${var.lambda_timeout}"
memory_size = "${var.lambda_memory_size_api}"
handler = "${var.lambda_handler_api}"
environment {
variables {
ENV = "${var.env}"
}
}
# Required for access to the Platform
vpc_config = {
subnet_ids = "${var.lambda_subnets}"
security_group_ids = "${var.lambda_security_groups}"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment