Skip to content

Commit f418749

Browse files
committed
feat: add qrencode layer to complete example and Dockerfile
1 parent 844bdf6 commit f418749

4 files changed

Lines changed: 34 additions & 1 deletion

File tree

Dockerfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ RUN unzip /tmp/runtime/bootstrap-${ARCH}.zip -d /var/runtime && chmod +x /var/ru
1313
RUN curl -sSL -o /tmp/jq.zip "https://github.com/ql4b/lambda-shell-layers/releases/download/${LAYERS_VERSION}/jq-${ARCH}-layer.zip" \
1414
&& curl -sSL -o /tmp/uuid.zip "https://github.com/ql4b/lambda-shell-layers/releases/download/${LAYERS_VERSION}/uuid-${ARCH}-layer.zip" \
1515
&& curl -sSL -o /tmp/htmlq.zip "https://github.com/ql4b/lambda-shell-layers/releases/download/${LAYERS_VERSION}/htmlq-${ARCH}-layer.zip" \
16+
&& curl -sSL -o /tmp/qrencode.zip "https://github.com/ql4b/lambda-shell-layers/releases/download/${LAYERS_VERSION}/qrencode-${ARCH}-layer.zip" \
1617
&& for zip in /tmp/*.zip; do unzip -o "$zip" -d /opt; done
1718

1819

examples/complete/README.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@ handler.sh
1717
├── events() → runtime + jq
1818
├── id() → runtime + jq + uuid
1919
├── runtimes() → runtime + jq + htmlq
20-
└── status() → runtime + jq + http-cli
20+
├── status() → runtime + jq + http-cli
21+
└── qr() → runtime + qrencode
2122
```
2223

2324
All layers are fetched from GitHub Releases:
@@ -41,6 +42,7 @@ aws lambda invoke --function-name shell-lambda-with-layers-events /dev/stdout
4142
aws lambda invoke --function-name shell-lambda-with-layers-id /dev/stdout
4243
aws lambda invoke --function-name shell-lambda-with-layers-runtimes /dev/stdout
4344
aws lambda invoke --function-name shell-lambda-with-layers-status /dev/stdout
45+
aws lambda invoke --function-name shell-lambda-with-layers-qr /dev/stdout
4446
```
4547

4648
## Functions
@@ -52,6 +54,7 @@ aws lambda invoke --function-name shell-lambda-with-layers-status /dev/stdout
5254
| id | `handler.id` | runtime, jq, uuid | Generate UUID, return as JSON |
5355
| runtimes | `handler.runtimes` | runtime, jq, htmlq | Scrape AWS docs for Lambda runtimes |
5456
| status | `handler.status` | runtime, jq, http-cli | HTTP status check with http-cli |
57+
| qr | `handler.qr` | runtime, qrencode | Generate QR code as ANSI art |
5558

5659
## Configuration
5760

examples/complete/app/handler.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,3 +39,7 @@ status () {
3939
http-cli --status-codes -o /dev/null https://wttr.in/?format=1 \
4040
| jq '{ code: .http_cli_status_codes.server }'
4141
}
42+
43+
qr () {
44+
qrencode "https://cloudless.sh" -t ANSI256 -o -
45+
}

examples/complete/main.tf

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,15 @@ module "runtime" {
1717
architecture = local.arch
1818
}
1919

20+
module "qrencode" {
21+
source = "git::https://github.com/ql4b/terraform-aws-lambda-layer.git?ref=v1.2.0"
22+
23+
name = "${local.name}-qrencode"
24+
source_url = "${local.layers_base}/qrencode-${local.arch}-layer.zip"
25+
compatible_architectures = [local.arch]
26+
enable_ssm_parameters = false
27+
}
28+
2029
module "jq" {
2130
source = "git::https://github.com/ql4b/terraform-aws-lambda-layer.git?ref=v1.2.0"
2231

@@ -135,6 +144,21 @@ module "status" {
135144
]
136145
}
137146

147+
module "qr" {
148+
source = "git::https://github.com/ql4b/terraform-aws-lambda-function.git?ref=v1.1.0"
149+
150+
source_dir = "./app"
151+
name = "${local.name}-qr"
152+
runtime = "provided.al2023"
153+
handler = "handler.qr"
154+
architecture = local.arch
155+
156+
layers = [
157+
module.runtime.layer_arn,
158+
module.qrencode.layer_arn,
159+
]
160+
}
161+
138162
# --- Outputs ---
139163

140164
output "functions" {
@@ -144,6 +168,7 @@ output "functions" {
144168
id = module.id
145169
runtimes = module.runtimes
146170
status = module.status
171+
qr = module.qr
147172
}
148173
}
149174

0 commit comments

Comments
 (0)