Skip to main content
AWS Lambda 0.23.0Last updated in version 0.22.0

Lambda Function URL Module

View Source Release Notes

This module used to create a AWS Lambda function URLs for existing Lambda function. A function URL is a dedicated HTTP(S) endpoint for a Lambda function.

When you create a function URL, Lambda automatically generates a unique URL endpoint for you. Once you create a function URL, its URL endpoint never changes. Function URLs are dual stack-enabled, supporting IPv4 and IPv6. After you configure a function URL for your function, you can invoke your function through its HTTP(S) endpoint via a web browser, curl, Postman, or any HTTP client.

Function URL endpoints have the following format:

https://<url-id>.lambda-url.<region>.on.aws

Background info

For more information on AWS Lambda, how it works, and how to configure your functions, check out the lambda module documentation.

Sample Usage

main.tf

# ------------------------------------------------------------------------------------------------------
# DEPLOY GRUNTWORK'S LAMBDA-FUNCTION-URL MODULE
# ------------------------------------------------------------------------------------------------------

module "lambda_function_url" {

source = "git::git@github.com:gruntwork-io/terraform-aws-lambda.git//modules/lambda-function-url?ref=v0.23.0"

# ----------------------------------------------------------------------------------------------------
# REQUIRED VARIABLES
# ----------------------------------------------------------------------------------------------------

# Alias name of the lambda function
alias = <string>

# Autherisation type of genrating function url
authorization_type = <string>

# CORS configuration for the Lambda function URL
cors_config = <object(
allow_credentials = bool
allow_origins = list(string)
allow_methods = list(string)
allow_headers = list(string)
expose_headers = list(string)
max_age = number
)>

# The name of the iam role to be created
iam_role_name = <string>

# The name of the Lambda function. Used to generate function url
lambda_function_name = <string>

# ----------------------------------------------------------------------------------------------------
# OPTIONAL VARIABLES
# ----------------------------------------------------------------------------------------------------

# The AWS region in which all resources will be created
aws_region = "us-east-1"

}


Reference

Required

aliasstringrequired

Alias name of the lambda function

authorization_typestringrequired

Autherisation type of genrating function url

cors_configobject(…)required

CORS configuration for the Lambda function URL

object({
allow_credentials = bool
allow_origins = list(string)
allow_methods = list(string)
allow_headers = list(string)
expose_headers = list(string)
max_age = number
})
iam_role_namestringrequired

The name of the iam role to be created

lambda_function_namestringrequired

The name of the Lambda function. Used to generate function url

Optional

aws_regionstringoptional

The AWS region in which all resources will be created

"us-east-1"