Skip to content

Use published Lambda package instead of downloading one - #1

Merged
joe-niland merged 5 commits into
mainfrom
feat/published-artefact
Nov 6, 2026
Merged

joe-niland merged 5 commits into
mainfrom
feat/published-artefact

Conversation

@joe-niland

Copy link
Copy Markdown
Member

Summary

The module now takes an already-published Lambda package and fetches nothing at plan time. Previously a script downloaded the package on every plan. That script needed python3 and a bundled CA file, and its checksum was pinned to a releases/latest URL, so the plan broke whenever Better Stack published a new release.

  • The package comes from S3 (artefact_s3_bucket, artefact_s3_key, optional artefact_s3_object_version) or a local zip (artefact_filename). Exactly one must be set.
  • lambda_runtime, lambda_handler, lambda_architectures, timeout, memory_size and reserved_concurrent_executions are configurable. The defaults match Better Stack's stock logtail-aws-lambda package (nodejs22.x, index.handler, x86_64, 30 s).
  • lambda_environment_variables is merged over the two baseline variables, BETTER_STACK_SOURCE_TOKEN and BETTER_STACK_ENTRYPOINT.
  • better_stack_ingest_host takes a bare host; https:// is added if missing. An empty token or an http:// host fails the plan.
  • maximum_retry_attempts (default 2) sets the async retry count. Set it to 0 to drop a batch Better Stack rejects rather than resend it, because the stock package resends whole batches.
  • cloudwatch_logs_retention_in_days (default 14) sets the retention for the Lambda's own log group.
  • The context is passed to the inner Lambda module, so tags apply, and enabled = false creates nothing.
  • The subscription filter depends on the invoke permission. A precondition stops the forwarder subscribing its own log group.
  • required_version is now >= 1.9.0. The AWS provider is now >= 6.0.0.

Breaking: package_url and package_checksum are removed, and an artefact input is required. Log groups are still looked up with a data source, so they must exist when you plan.

Tests performed

  • tofu fmt -check -recursive passes.
  • validate and plan have not run yet. The first consumer plan, through the terraform-aws-modules wrapper, is the first real check.

Accept an S3 object or a local zip, expose runtime, handler,
architecture, timeout, memory and reserved concurrency, drop the
plan-time download, and validate the token and ingest host.
Add maximum_retry_attempts through an event invoke config so a failed
batch can be dropped rather than resent, set retention on the function's
log group, pass the label context to the Lambda module, order the
subscription filters after the invoke permission, skip every resource
when disabled and require Terraform 1.9.
@joe-niland joe-niland changed the title feattake a published Lambda package instead of downloading one Use published Lambda package instead of downloading one Nov 5, 2026
Describe the region variable and pass it to the AWS provider, which
had no configuration, and require the same Terraform and AWS provider
versions as the module.
@joe-niland
joe-niland merged commit e84d9f0 into main Nov 6, 2026
11 checks passed
@joe-niland
joe-niland deleted the feat/published-artefact branch November 6, 2026 06:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant