Introducing Bref Lambda Layers Terraform module

Today I’m glad to introduce Bref Lambdas Layers Terraform module !

Check it out on the Terraform registry!

What is Bref?

Bref is a PHP community runtime for AWS Lambda, enabling serverless deployment of PHP applications.

With Bref, you c…


This content originally appeared on DEV Community and was authored by Paul SANTUS

Today I'm glad to introduce Bref Lambdas Layers Terraform module !

Check it out on the Terraform registry!

What is Bref?

Bref is a PHP community runtime for AWS Lambda, enabling serverless deployment of PHP applications.

With Bref, you can deploy any PHP code, from standalone functions or microservices to full (Symfony or Laravel) apps in a fully managed way.Thanks to Lambda you don't need to manage high availability or scalability and you can focus on your business logic.

Bref has three separate runtimes (function, FPM and console) and the Bref team maintains Lambda Layers for the most common PHP extensions.

Why a Terraform module?

The Bref core team, namely Matthieu Napoli, has a strong preference for the ServerLess framework (a deployment framework, not to be confused with the concept of serverless that's the foundation of some AWS services (Lambda, S3, SQS, etc.) and as a result, the Bref documentation is quite focused on this deployment framework.

However, it's totally possible to deploy Bref-powered apps with other deployment tools (CDK, CloudFormation, Terraform). As a matter of fact, last year I offered a fully functional example of Terraform deployment of a Bref-powered app using Terraform (my favourite deployment tools).

Deploying a Bref-powered app can be done in two ways. Either by using a Lambda container that contains the Bref framework, or using Lambda layers. Layers make your deployment way lighter (you only upload your source code). However you need to tell Lambda which layer(s) to use, by providing their ARN (AWS Resource Name). The Bref team maintains official Layers for all supported PHP versions and for many PHP extensions.

For those who use the ServerLess framework, the Bref team offers a plugin that will identify those Layers ARNs for you. But until today there was no such thing for Terraform aficionados!

How to use it?

Simply declare the module in your Terraform configuration

module "bref_layers" {
  source = "../../"

  php_version = "84"
  cpu_type    = "x86"
  aws_region  = "us-east-1"
  php_extensions = ["gd", "imagick", "redis"]
}

then when defining the Lambdas function, just use the module outputs!

resource "aws_lambda_function" "example" {
  # ... other configuration
  layers = module.bref_layers.fpm_layers  # Includes runtime + all extensions
}


This content originally appeared on DEV Community and was authored by Paul SANTUS


Print Share Comment Cite Upload Translate Updates
APA

Paul SANTUS | Sciencx (2025-08-05T14:49:35+00:00) Introducing Bref Lambda Layers Terraform module. Retrieved from https://www.scien.cx/2025/08/05/introducing-bref-lambda-layers-terraform-module/

MLA
" » Introducing Bref Lambda Layers Terraform module." Paul SANTUS | Sciencx - Tuesday August 5, 2025, https://www.scien.cx/2025/08/05/introducing-bref-lambda-layers-terraform-module/
HARVARD
Paul SANTUS | Sciencx Tuesday August 5, 2025 » Introducing Bref Lambda Layers Terraform module., viewed ,<https://www.scien.cx/2025/08/05/introducing-bref-lambda-layers-terraform-module/>
VANCOUVER
Paul SANTUS | Sciencx - » Introducing Bref Lambda Layers Terraform module. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2025/08/05/introducing-bref-lambda-layers-terraform-module/
CHICAGO
" » Introducing Bref Lambda Layers Terraform module." Paul SANTUS | Sciencx - Accessed . https://www.scien.cx/2025/08/05/introducing-bref-lambda-layers-terraform-module/
IEEE
" » Introducing Bref Lambda Layers Terraform module." Paul SANTUS | Sciencx [Online]. Available: https://www.scien.cx/2025/08/05/introducing-bref-lambda-layers-terraform-module/. [Accessed: ]
rf:citation
» Introducing Bref Lambda Layers Terraform module | Paul SANTUS | Sciencx | https://www.scien.cx/2025/08/05/introducing-bref-lambda-layers-terraform-module/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.