Skip to content

Commit 02ab668

Browse files
authored
feat: Renamed python3.8-11 to python3.12 in examples, added tag to resources (terraform-aws-modules#583)
1 parent 4f77bfc commit 02ab668

File tree

43 files changed

+186
-187
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+186
-187
lines changed

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
repos:
22
- repo: https://github.com/antonbabenko/pre-commit-terraform
3-
rev: v1.89.1
3+
rev: v1.91.0
44
hooks:
55
- id: terraform_fmt
66
- id: terraform_wrapper_module_for_each

README.md

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ module "lambda_function" {
3737
function_name = "my-lambda1"
3838
description = "My awesome lambda function"
3939
handler = "index.lambda_handler"
40-
runtime = "python3.8"
40+
runtime = "python3.12"
4141
4242
source_path = "../src/lambda-function1"
4343
@@ -56,7 +56,7 @@ module "lambda_function" {
5656
function_name = "lambda-with-layer"
5757
description = "My awesome lambda function"
5858
handler = "index.lambda_handler"
59-
runtime = "python3.8"
59+
runtime = "python3.12"
6060
publish = true
6161
6262
source_path = "../src/lambda-function1"
@@ -84,7 +84,7 @@ module "lambda_layer_s3" {
8484
8585
layer_name = "lambda-layer-s3"
8686
description = "My amazing lambda layer (deployed from S3)"
87-
compatible_runtimes = ["python3.8"]
87+
compatible_runtimes = ["python3.12"]
8888
8989
source_path = "../src/lambda-layer"
9090
@@ -102,7 +102,7 @@ module "lambda_function_existing_package_local" {
102102
function_name = "my-lambda-existing-package-local"
103103
description = "My awesome lambda function"
104104
handler = "index.lambda_handler"
105-
runtime = "python3.8"
105+
runtime = "python3.12"
106106
107107
create_package = false
108108
local_existing_package = "../existing_package.zip"
@@ -126,7 +126,7 @@ module "lambda_function_externally_managed_package" {
126126
function_name = "my-lambda-externally-managed-package"
127127
description = "My lambda function code is deployed separately"
128128
handler = "index.lambda_handler"
129-
runtime = "python3.8"
129+
runtime = "python3.12"
130130
131131
create_package = false
132132
local_existing_package = "./lambda_functions/code.zip"
@@ -161,7 +161,7 @@ module "lambda_function_existing_package_s3" {
161161
function_name = "my-lambda-existing-package-local"
162162
description = "My awesome lambda function"
163163
handler = "index.lambda_handler"
164-
runtime = "python3.8"
164+
runtime = "python3.12"
165165
166166
create_package = false
167167
s3_existing_package = {
@@ -197,9 +197,9 @@ module "lambda_layer_local" {
197197
198198
layer_name = "my-layer-local"
199199
description = "My amazing lambda layer (deployed from local)"
200-
compatible_runtimes = ["python3.8"]
200+
compatible_runtimes = ["python3.12"]
201201
202-
source_path = "../fixtures/python3.8-app1"
202+
source_path = "../fixtures/python-app1"
203203
}
204204
205205
module "lambda_layer_s3" {
@@ -209,9 +209,9 @@ module "lambda_layer_s3" {
209209
210210
layer_name = "my-layer-s3"
211211
description = "My amazing lambda layer (deployed from S3)"
212-
compatible_runtimes = ["python3.8"]
212+
compatible_runtimes = ["python3.12"]
213213
214-
source_path = "../fixtures/python3.8-app1"
214+
source_path = "../fixtures/python-app1"
215215
216216
store_on_s3 = true
217217
s3_bucket = "my-bucket-id-with-lambda-builds"
@@ -231,9 +231,9 @@ module "lambda_at_edge" {
231231
function_name = "my-lambda-at-edge"
232232
description = "My awesome lambda@edge function"
233233
handler = "index.lambda_handler"
234-
runtime = "python3.8"
234+
runtime = "python3.12"
235235
236-
source_path = "../fixtures/python3.8-app1"
236+
source_path = "../fixtures/python-app1"
237237
238238
tags = {
239239
Module = "lambda-at-edge"
@@ -250,9 +250,9 @@ module "lambda_function_in_vpc" {
250250
function_name = "my-lambda-in-vpc"
251251
description = "My awesome lambda function"
252252
handler = "index.lambda_handler"
253-
runtime = "python3.8"
253+
runtime = "python3.12"
254254
255-
source_path = "../fixtures/python3.8-app1"
255+
source_path = "../fixtures/python-app1"
256256
257257
vpc_subnet_ids = module.vpc.intra_subnets
258258
vpc_security_group_ids = [module.vpc.default_security_group_id]
@@ -396,12 +396,12 @@ source_path = [
396396
"!.*/.*\\.txt", # Skip all txt files recursively
397397
]
398398
}, {
399-
path = "src/python3.8-app1",
399+
path = "src/python-app1",
400400
pip_requirements = true,
401401
pip_tmp_dir = "/tmp/dir/location"
402402
prefix_in_zip = "foo/bar1",
403403
}, {
404-
path = "src/python3.8-app2",
404+
path = "src/python-app2",
405405
pip_requirements = "requirements-large.txt",
406406
patterns = [
407407
"!vendor/colorful-0.5.4.dist-info/RECORD",
@@ -414,7 +414,7 @@ source_path = [
414414
npm_tmp_dir = "/tmp/dir/location"
415415
prefix_in_zip = "foo/bar1",
416416
}, {
417-
path = "src/python3.8-app3",
417+
path = "src/python-app3",
418418
commands = [
419419
"npm install",
420420
":zip"
@@ -424,7 +424,7 @@ source_path = [
424424
"node_modules/.+", # Include all node_modules
425425
],
426426
}, {
427-
path = "src/python3.8-app3",
427+
path = "src/python-app3",
428428
commands = ["go build"],
429429
patterns = <<END
430430
bin/.*
@@ -468,16 +468,16 @@ source_path = [
468468
If your Lambda Function or Layer uses some dependencies you can build them in Docker and have them included into deployment package. Here is how you can do it:
469469

470470
build_in_docker = true
471-
docker_file = "src/python3.8-app1/docker/Dockerfile"
472-
docker_build_root = "src/python3.8-app1/docker"
473-
docker_image = "public.ecr.aws/sam/build-python3.8"
474-
runtime = "python3.8" # Setting runtime is required when building package in Docker and Lambda Layer resource.
471+
docker_file = "src/python-app1/docker/Dockerfile"
472+
docker_build_root = "src/python-app1/docker"
473+
docker_image = "public.ecr.aws/sam/build-python"
474+
runtime = "python3.12" # Setting runtime is required when building package in Docker and Lambda Layer resource.
475475

476476
Using this module you can install dependencies from private hosts. To do this, you need for forward SSH agent:
477477

478478
docker_with_ssh_agent = true
479479

480-
Note that by default, the `docker_image` used comes from the registry `public.ecr.aws/sam/`, and will be based on the `runtime` that you specify. In other words, if you specify a runtime of `python3.8` and do not specify `docker_image`, then the `docker_image` will resolve to `public.ecr.aws/sam/build-python3.8`. This ensures that by default the `runtime` is available in the docker container.
480+
Note that by default, the `docker_image` used comes from the registry `public.ecr.aws/sam/`, and will be based on the `runtime` that you specify. In other words, if you specify a runtime of `python3.12` and do not specify `docker_image`, then the `docker_image` will resolve to `public.ecr.aws/sam/build-python3.12`. This ensures that by default the `runtime` is available in the docker container.
481481

482482
If you override `docker_image`, be sure to keep the image in sync with your `runtime`. During the plan phase, when using docker, there is no check that the `runtime` is available to build the package. That means that if you use an image that does not have the runtime, the plan will still succeed, but then the apply will fail.
483483

@@ -524,7 +524,7 @@ This can be implemented in two steps: download file locally using CURL, and pass
524524

525525
```hcl
526526
locals {
527-
package_url = "https://raw.githubusercontent.com/terraform-aws-modules/terraform-aws-lambda/master/examples/fixtures/python3.8-zip/existing_package.zip"
527+
package_url = "https://raw.githubusercontent.com/terraform-aws-modules/terraform-aws-lambda/master/examples/fixtures/python-zip/existing_package.zip"
528528
downloaded = "downloaded_package_${md5(local.package_url)}.zip"
529529
}
530530
@@ -551,7 +551,7 @@ module "lambda_function_existing_package_from_remote_url" {
551551
function_name = "my-lambda-existing-package-local"
552552
description = "My awesome lambda function"
553553
handler = "index.lambda_handler"
554-
runtime = "python3.8"
554+
runtime = "python3.12"
555555
556556
create_package = false
557557
local_existing_package = data.null_data_source.downloaded_package.outputs["filename"]

examples/alias/main.tf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,10 @@ module "lambda_function" {
2525

2626
function_name = "${random_pet.this.id}-lambda"
2727
handler = "index.lambda_handler"
28-
runtime = "python3.8"
28+
runtime = "python3.12"
2929
publish = true
3030

31-
source_path = "${path.module}/../fixtures/python3.8-app1"
31+
source_path = "${path.module}/../fixtures/python-app1"
3232
hash_extra = "yo"
3333

3434
create_async_event_config = true

examples/async/main.tf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,10 @@ module "lambda_function" {
1616

1717
function_name = "${random_pet.this.id}-lambda-async"
1818
handler = "index.lambda_handler"
19-
runtime = "python3.8"
19+
runtime = "python3.12"
2020
architectures = ["arm64"]
2121

22-
source_path = "${path.module}/../fixtures/python3.8-app1"
22+
source_path = "${path.module}/../fixtures/python-app1"
2323

2424
create_async_event_config = true
2525
attach_async_event_policy = true

0 commit comments

Comments
 (0)