Skip to main content
AWS Lambda 0.24.0Last updated in version 0.24.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.24.0"

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

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

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

# The AWS region in which all resources will be created
aws_region = <string>

# Name of the CloudFront Origin Access Control
cloudfront_oac_name = <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>

# Specifies which requests CloudFront signs. Specify always for the most
# common use case. Allowed values: always, never, and no-override.
oac_signing_behavior = <string>

# Determines how CloudFront signs (authenticates) requests. The only valid
# value is sigv4.
oac_signing_protocol = <string>

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

# The type of origin that this Origin Access Control is for. Valid values are
# lambda, mediapackagev2, mediastore, and s3
oac_origin_type = "lambda"

}


Reference

Required

aliasstringrequired

Alias name of the lambda function

authorization_typestringrequired

Autherisation type of genrating function url

aws_regionstringrequired

The AWS region in which all resources will be created

cloudfront_oac_namestringrequired

Name of the CloudFront Origin Access Control

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

oac_signing_behaviorstringrequired

Specifies which requests CloudFront signs. Specify always for the most common use case. Allowed values: always, never, and no-override.

oac_signing_protocolstringrequired

Determines how CloudFront signs (authenticates) requests. The only valid value is sigv4.

Optional

oac_origin_typestringoptional

The type of origin that this Origin Access Control is for. Valid values are lambda, mediapackagev2, mediastore, and s3

"lambda"