diff --git a/README.md b/README.md index 8387b1ca..d28a8b57 100644 --- a/README.md +++ b/README.md @@ -37,7 +37,7 @@ module "lambda_function" { function_name = "my-lambda1" description = "My awesome lambda function" handler = "index.lambda_handler" - runtime = "python3.8" + runtime = "python3.12" source_path = "../src/lambda-function1" @@ -56,7 +56,7 @@ module "lambda_function" { function_name = "lambda-with-layer" description = "My awesome lambda function" handler = "index.lambda_handler" - runtime = "python3.8" + runtime = "python3.12" publish = true source_path = "../src/lambda-function1" @@ -84,7 +84,7 @@ module "lambda_layer_s3" { layer_name = "lambda-layer-s3" description = "My amazing lambda layer (deployed from S3)" - compatible_runtimes = ["python3.8"] + compatible_runtimes = ["python3.12"] source_path = "../src/lambda-layer" @@ -102,7 +102,7 @@ module "lambda_function_existing_package_local" { function_name = "my-lambda-existing-package-local" description = "My awesome lambda function" handler = "index.lambda_handler" - runtime = "python3.8" + runtime = "python3.12" create_package = false local_existing_package = "../existing_package.zip" @@ -126,7 +126,7 @@ module "lambda_function_externally_managed_package" { function_name = "my-lambda-externally-managed-package" description = "My lambda function code is deployed separately" handler = "index.lambda_handler" - runtime = "python3.8" + runtime = "python3.12" create_package = false local_existing_package = "./lambda_functions/code.zip" @@ -161,7 +161,7 @@ module "lambda_function_existing_package_s3" { function_name = "my-lambda-existing-package-local" description = "My awesome lambda function" handler = "index.lambda_handler" - runtime = "python3.8" + runtime = "python3.12" create_package = false s3_existing_package = { @@ -197,9 +197,9 @@ module "lambda_layer_local" { layer_name = "my-layer-local" description = "My amazing lambda layer (deployed from local)" - compatible_runtimes = ["python3.8"] + compatible_runtimes = ["python3.12"] - source_path = "../fixtures/python3.8-app1" + source_path = "../fixtures/python-app1" } module "lambda_layer_s3" { @@ -209,9 +209,9 @@ module "lambda_layer_s3" { layer_name = "my-layer-s3" description = "My amazing lambda layer (deployed from S3)" - compatible_runtimes = ["python3.8"] + compatible_runtimes = ["python3.12"] - source_path = "../fixtures/python3.8-app1" + source_path = "../fixtures/python-app1" store_on_s3 = true s3_bucket = "my-bucket-id-with-lambda-builds" @@ -231,9 +231,9 @@ module "lambda_at_edge" { function_name = "my-lambda-at-edge" description = "My awesome lambda@edge function" handler = "index.lambda_handler" - runtime = "python3.8" + runtime = "python3.12" - source_path = "../fixtures/python3.8-app1" + source_path = "../fixtures/python-app1" tags = { Module = "lambda-at-edge" @@ -250,9 +250,9 @@ module "lambda_function_in_vpc" { function_name = "my-lambda-in-vpc" description = "My awesome lambda function" handler = "index.lambda_handler" - runtime = "python3.8" + runtime = "python3.12" - source_path = "../fixtures/python3.8-app1" + source_path = "../fixtures/python-app1" vpc_subnet_ids = module.vpc.intra_subnets vpc_security_group_ids = [module.vpc.default_security_group_id] @@ -396,12 +396,12 @@ source_path = [ "!.*/.*\\.txt", # Skip all txt files recursively ] }, { - path = "src/python3.8-app1", + path = "src/python-app1", pip_requirements = true, pip_tmp_dir = "/tmp/dir/location" prefix_in_zip = "foo/bar1", }, { - path = "src/python3.8-app2", + path = "src/python-app2", pip_requirements = "requirements-large.txt", patterns = [ "!vendor/colorful-0.5.4.dist-info/RECORD", @@ -414,7 +414,7 @@ source_path = [ npm_tmp_dir = "/tmp/dir/location" prefix_in_zip = "foo/bar1", }, { - path = "src/python3.8-app3", + path = "src/python-app3", commands = [ "npm install", ":zip" @@ -424,7 +424,7 @@ source_path = [ "node_modules/.+", # Include all node_modules ], }, { - path = "src/python3.8-app3", + path = "src/python-app3", commands = ["go build"], patterns = <"] diff --git a/examples/fixtures/python3.9-app-src-poetry/README.md b/examples/fixtures/python-app-src-poetry/README.md similarity index 100% rename from examples/fixtures/python3.9-app-src-poetry/README.md rename to examples/fixtures/python-app-src-poetry/README.md diff --git a/examples/fixtures/python3.9-app-src-poetry/poetry.lock b/examples/fixtures/python-app-src-poetry/poetry.lock similarity index 100% rename from examples/fixtures/python3.9-app-src-poetry/poetry.lock rename to examples/fixtures/python-app-src-poetry/poetry.lock diff --git a/examples/fixtures/python3.9-app-src-poetry/pyproject.toml b/examples/fixtures/python-app-src-poetry/pyproject.toml similarity index 72% rename from examples/fixtures/python3.9-app-src-poetry/pyproject.toml rename to examples/fixtures/python-app-src-poetry/pyproject.toml index 2b890b79..7ceca4c4 100644 --- a/examples/fixtures/python3.9-app-src-poetry/pyproject.toml +++ b/examples/fixtures/python-app-src-poetry/pyproject.toml @@ -1,10 +1,10 @@ [tool.poetry] -name = "python3-9-app-src-poetry" +name = "python-app-src-poetry" version = "0.1.0" description = "" authors = ["Your Name "] readme = "README.md" -packages = [{include = "python39_app_src_poetry", from = "src"}] +packages = [{include = "python_app_src_poetry", from = "src"}] [tool.poetry.dependencies] python = "^3.9" diff --git a/examples/fixtures/python3.9-app-src-poetry/src/python39_app_src_poetry/__init__.py b/examples/fixtures/python-app-src-poetry/src/python_app_src_poetry/__init__.py similarity index 100% rename from examples/fixtures/python3.9-app-src-poetry/src/python39_app_src_poetry/__init__.py rename to examples/fixtures/python-app-src-poetry/src/python_app_src_poetry/__init__.py diff --git a/examples/fixtures/python3.9-app-src-poetry/tests/__init__.py b/examples/fixtures/python-app-src-poetry/tests/__init__.py similarity index 100% rename from examples/fixtures/python3.9-app-src-poetry/tests/__init__.py rename to examples/fixtures/python-app-src-poetry/tests/__init__.py diff --git a/examples/fixtures/python3.8-app1/dir1/dir2/ignore2.txt b/examples/fixtures/python-app1/dir1/dir2/ignore2.txt similarity index 100% rename from examples/fixtures/python3.8-app1/dir1/dir2/ignore2.txt rename to examples/fixtures/python-app1/dir1/dir2/ignore2.txt diff --git a/examples/fixtures/python3.8-app1/docker/Dockerfile b/examples/fixtures/python-app1/docker/Dockerfile similarity index 87% rename from examples/fixtures/python3.8-app1/docker/Dockerfile rename to examples/fixtures/python-app1/docker/Dockerfile index aeab9fee..fa0eb25f 100644 --- a/examples/fixtures/python3.8-app1/docker/Dockerfile +++ b/examples/fixtures/python-app1/docker/Dockerfile @@ -1,4 +1,4 @@ -FROM public.ecr.aws/sam/build-python3.8 as build +FROM public.ecr.aws/sam/build-python3.12 as build LABEL maintainer="Betajob AS" \ description="Patched AWS Lambda build container" @@ -20,7 +20,7 @@ RUN \ && rpmbuild -ba SPECS/automake.spec --nocheck \ && yum install -y RPMS/noarch/* -FROM public.ecr.aws/sam/build-python3.8 +FROM public.ecr.aws/sam/build-python3.12 COPY --from=build /root/rpmbuild/RPMS/noarch/*.rpm . RUN yum install -y *.rpm \ && rm *.rpm diff --git a/examples/fixtures/python3.8-app1/docker/automake-1.13-to-1.16-spec.patch b/examples/fixtures/python-app1/docker/automake-1.13-to-1.16-spec.patch similarity index 100% rename from examples/fixtures/python3.8-app1/docker/automake-1.13-to-1.16-spec.patch rename to examples/fixtures/python-app1/docker/automake-1.13-to-1.16-spec.patch diff --git a/examples/fixtures/python3.8-app1/docker/entrypoint.sh b/examples/fixtures/python-app1/docker/entrypoint.sh similarity index 100% rename from examples/fixtures/python3.8-app1/docker/entrypoint.sh rename to examples/fixtures/python-app1/docker/entrypoint.sh diff --git a/examples/fixtures/python3.9-app-poetry/ignore_please.txt b/examples/fixtures/python-app1/ignore_please.txt similarity index 100% rename from examples/fixtures/python3.9-app-poetry/ignore_please.txt rename to examples/fixtures/python-app1/ignore_please.txt diff --git a/examples/fixtures/python3.8-app1/index.py b/examples/fixtures/python-app1/index.py similarity index 100% rename from examples/fixtures/python3.8-app1/index.py rename to examples/fixtures/python-app1/index.py diff --git a/examples/fixtures/python3.8-app1/requirements.txt b/examples/fixtures/python-app1/requirements.txt similarity index 100% rename from examples/fixtures/python3.8-app1/requirements.txt rename to examples/fixtures/python-app1/requirements.txt diff --git a/examples/fixtures/python3.8-app2/index.py b/examples/fixtures/python-app2/index.py similarity index 100% rename from examples/fixtures/python3.8-app2/index.py rename to examples/fixtures/python-app2/index.py diff --git a/examples/fixtures/python-zip/existing_package.zip b/examples/fixtures/python-zip/existing_package.zip new file mode 100644 index 00000000..d713a912 Binary files /dev/null and b/examples/fixtures/python-zip/existing_package.zip differ diff --git a/examples/fixtures/python3.9-app-poetry/index.py b/examples/fixtures/python3.9-app-poetry/index.py deleted file mode 100644 index 396c5054..00000000 --- a/examples/fixtures/python3.9-app-poetry/index.py +++ /dev/null @@ -1,4 +0,0 @@ -def lambda_handler(event, context): - print("Hello from app1!") - - return event diff --git a/examples/multiple-regions/main.tf b/examples/multiple-regions/main.tf index dd2e229c..d30e1c2a 100644 --- a/examples/multiple-regions/main.tf +++ b/examples/multiple-regions/main.tf @@ -27,10 +27,10 @@ module "lambda_function" { function_name = "${random_pet.this.id}-lambda1" description = "My awesome lambda function" handler = "index.lambda_handler" - runtime = "python3.8" + runtime = "python3.12" publish = true - source_path = "${path.module}/../fixtures/python3.8-app1" + source_path = "${path.module}/../fixtures/python-app1" attach_dead_letter_policy = true dead_letter_target_arn = aws_sqs_queue.dlq.arn @@ -124,10 +124,10 @@ module "lambda_function_another_region" { function_name = "${random_pet.this.id}-lambda1" description = "Copy of my awesome lambda function" handler = "index.lambda_handler" - runtime = "python3.8" + runtime = "python3.12" publish = true - source_path = "${path.module}/../fixtures/python3.8-app1" + source_path = "${path.module}/../fixtures/python-app1" attach_dead_letter_policy = true dead_letter_target_arn = aws_sqs_queue.dlq_us_east_1.arn diff --git a/examples/simple-cicd/main.tf b/examples/simple-cicd/main.tf index 66afc150..deefc9aa 100644 --- a/examples/simple-cicd/main.tf +++ b/examples/simple-cicd/main.tf @@ -1,6 +1,5 @@ provider "aws" { region = "eu-west-1" - # region = "us-east-1" # Make it faster by skipping something skip_metadata_api_check = true @@ -17,10 +16,10 @@ module "lambda_function" { function_name = "${random_pet.this.id}-lambda-simple" handler = "index.lambda_handler" - runtime = "python3.10" + runtime = "python3.12" source_path = [ - "${path.module}/src/python3.10-app1", + "${path.module}/src/python-app1", ] trigger_on_package_timestamp = false } diff --git a/examples/simple-cicd/test.sh b/examples/simple-cicd/test.sh index 90ce9804..64cfbf57 100755 --- a/examples/simple-cicd/test.sh +++ b/examples/simple-cicd/test.sh @@ -65,7 +65,7 @@ terraform() { :note "Preparing ..." rm -rf src mkdir -p src -cp -r "../fixtures/python3.10-app1" src +cp -r "../fixtures/python-app1" src terraform init :echo "Destroy / Remove ZIP files" terraform destroy @@ -96,7 +96,7 @@ rm -rf builds 2>/dev/null || true :note "Starting Part 2: Check that CICD environment will detect diff if lambda code changes" :note "Change the source code / Remove 'builds' dir" -echo "" >> src/python3.10-app1/index.py +echo "" >> src/python-app1/index.py rm -rf builds :case "Plan / Expect diff" && { diff --git a/examples/simple/main.tf b/examples/simple/main.tf index ab9aba1a..20c51910 100644 --- a/examples/simple/main.tf +++ b/examples/simple/main.tf @@ -17,12 +17,12 @@ resource "random_pet" "this" { # # function_name = "${random_pet.this.id}-lambda-edge" # handler = "index.lambda_handler" -# runtime = "python3.8" +# runtime = "python3.12" # lambda_at_edge = true # # attach_cloudwatch_logs_policy = true # -# source_path = "${path.module}/../fixtures/python3.8-app1/" +# source_path = "${path.module}/../fixtures/python-app1/" #} #resource "aws_cloudwatch_log_group" "this" { @@ -36,7 +36,7 @@ module "lambda_function" { function_name = "${random_pet.this.id}-lambda-simple" handler = "index.lambda_handler" - runtime = "python3.8" + runtime = "python3.12" # role_maximum_session_duration = 7200 @@ -87,51 +87,51 @@ module "lambda_function" { # } # } - # source_path = "${path.module}/../fixtures/python3.8-app1/" + # source_path = "${path.module}/../fixtures/python-app1/" # source_path = [ - # "${path.module}/../fixtures/python3.8-app1/index.py", + # "${path.module}/../fixtures/python-app1/index.py", # { - # pip_requirements = "${path.module}/../fixtures/python3.8-app1/requirements.txt" + # pip_requirements = "${path.module}/../fixtures/python-app1/requirements.txt" # prefix_in_zip = "vendor" # } # ] # source_path = [ - # "${path.module}/../fixtures/python3.8-app1/index.py", - # "${path.module}/../fixtures/python3.8-app1/dir1/dir2", + # "${path.module}/../fixtures/python-app1/index.py", + # "${path.module}/../fixtures/python-app1/dir1/dir2", # { - # pip_requirements = "${path.module}/../fixtures/python3.8-app1/requirements.txt" + # pip_requirements = "${path.module}/../fixtures/python-app1/requirements.txt" # } # ] # source_path = [ # { - # path = "${path.module}/../fixtures/python3.8-app1" + # path = "${path.module}/../fixtures/python-app1" # } # ] # source_path = [ # { - # path = "${path.module}/../fixtures/python3.8-app1" + # path = "${path.module}/../fixtures/python-app1" # pip_requirements = false # } # ] # source_path = [ # { - # path = "${path.module}/../fixtures/python3.8-app1" + # path = "${path.module}/../fixtures/python-app1" # pip_requirements = true # } # ] # source_path = [ # { - # path = "${path.module}/../fixtures/python3.8-app1" + # path = "${path.module}/../fixtures/python-app1" # commands = [ # ":zip", # "cd `mktemp -d`", - # "pip install --target=. -r ${path.module}/../fixtures/python3.8-app1/requirements.txt", + # "pip install --target=. -r ${path.module}/../fixtures/python-app1/requirements.txt", # ":zip . vendor/", # ] # patterns = [ @@ -144,12 +144,12 @@ module "lambda_function" { source_path = [ # { - # pip_requirements = "${path.module}/../fixtures/python3.8-app1/requirements.txt" + # pip_requirements = "${path.module}/../fixtures/python-app1/requirements.txt" # pip_requirements = "${path.module}/../deploy/requirements.txt" # }, - "${path.module}/../fixtures/python3.8-app1/index.py", + "${path.module}/../fixtures/python-app1/index.py", # { - # path = "${path.module}/../fixtures/python3.8-app1/index.py" + # path = "${path.module}/../fixtures/python-app1/index.py" # patterns = <