File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -13,6 +13,7 @@ RUN unzip /tmp/runtime/bootstrap-${ARCH}.zip -d /var/runtime && chmod +x /var/ru
1313RUN 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
Original file line number Diff line number Diff 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
2324All layers are fetched from GitHub Releases:
@@ -41,6 +42,7 @@ aws lambda invoke --function-name shell-lambda-with-layers-events /dev/stdout
4142aws lambda invoke --function-name shell-lambda-with-layers-id /dev/stdout
4243aws lambda invoke --function-name shell-lambda-with-layers-runtimes /dev/stdout
4344aws 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
Original file line number Diff line number Diff 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+ }
Original file line number Diff line number Diff 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+
2029module "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
140164output "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
You can’t perform that action at this time.
0 commit comments