chore: renamed layer
This commit is contained in:
@@ -0,0 +1,48 @@
|
||||
<!-- This readme file is generated with terraform-docs -->
|
||||
# LambdaLayer
|
||||
|
||||
Download python packages and create lambda layer
|
||||
|
||||
## Notes
|
||||
Packages need to be placed under a python/ subdirectory.
|
||||
See https://docs.aws.amazon.com/lambda/latest/dg/packaging-layers.html
|
||||
|
||||
## Requirements
|
||||
|
||||
| Name | Version |
|
||||
|------|---------|
|
||||
| terraform | >= 1.1.0 |
|
||||
| aws | >= 6.0 |
|
||||
|
||||
## Providers
|
||||
|
||||
| Name | Version |
|
||||
|------|---------|
|
||||
| aws | 5.100.0 |
|
||||
| random | 3.8.1 |
|
||||
|
||||
## Modules
|
||||
|
||||
| Name | Source | Version |
|
||||
|------|--------|---------|
|
||||
| lambda\_archive | ../modules/compute/LambdaZipBuilder | n/a |
|
||||
| s3 | ../modules/storage/s3_bucket_2023 | n/a |
|
||||
|
||||
## Resources
|
||||
|
||||
| Name | Type |
|
||||
|------|------|
|
||||
| [aws_lambda_layer_version.pandas](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/lambda_layer_version) | resource |
|
||||
| [random_uuid.this](https://registry.terraform.io/providers/hashicorp/random/latest/docs/resources/uuid) | resource |
|
||||
|
||||
## Inputs
|
||||
|
||||
No inputs.
|
||||
|
||||
## Outputs
|
||||
|
||||
No outputs.
|
||||
|
||||
---
|
||||
## Authorship
|
||||
This module was developed by xpk.
|
||||
@@ -0,0 +1,42 @@
|
||||
/**
|
||||
* # LambdaLayer
|
||||
*
|
||||
* Download python packages and create lambda layer
|
||||
*
|
||||
* ## Notes
|
||||
* Packages need to be placed under a python/ subdirectory.
|
||||
* See https://docs.aws.amazon.com/lambda/latest/dg/packaging-layers.html
|
||||
*/
|
||||
|
||||
# build python package zip file
|
||||
module "lambda_archive" {
|
||||
source = "../modules/compute/LambdaZipBuilder"
|
||||
|
||||
pip_packages = "pandas numpy pytz openpyxl"
|
||||
upload_archive_to_s3 = true
|
||||
s3_bucket_name = module.s3.bucket_name
|
||||
pip_path = "/my/work/xpk-git/venv314/bin/pip3"
|
||||
}
|
||||
|
||||
# create lambda layer
|
||||
resource "aws_lambda_layer_version" "pandas" {
|
||||
description = "Python packages pandas numpy pytz openpyxl"
|
||||
s3_bucket = module.s3.bucket_name
|
||||
s3_key = module.lambda_archive.s3_object_key
|
||||
source_code_hash = module.lambda_archive.s3_object_hash
|
||||
layer_name = "py_packages"
|
||||
compatible_runtimes = ["python3.13"]
|
||||
}
|
||||
|
||||
# s3 bucket required for uploading python package zip
|
||||
module "s3" {
|
||||
source = "../modules/storage/s3_bucket_2023"
|
||||
bucket_name = "lab-lambdalayer-${random_uuid.this.result}"
|
||||
bucket_force_destroy = true
|
||||
enable_bucket_logging = false
|
||||
enable_bucket_lifecycle = false
|
||||
enable_versioning = false
|
||||
enable_encryption = true
|
||||
}
|
||||
|
||||
resource "random_uuid" "this" {}
|
||||
@@ -0,0 +1,18 @@
|
||||
provider "aws" {
|
||||
region = "ap-east-1"
|
||||
default_tags {
|
||||
tags = {
|
||||
TerraformDir = join("/", reverse(slice(reverse(split("/", path.cwd)), 0, 2)))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
terraform {
|
||||
required_version = ">= 1.1.0"
|
||||
required_providers {
|
||||
aws = {
|
||||
source = "hashicorp/aws"
|
||||
version = ">= 6.0"
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user