Resource: aws_lambda_function_url

Provides a Lambda function URL resource. A function URL is a dedicated HTTP(S) endpoint for a Lambda function.

See the AWS Lambda documentation for more information.

Example Usage

resource "aws_lambda_function_url" "test_latest" {
  function_name      = aws_lambda_function.test.function_name
  authorization_type = "NONE"
}

resource "aws_lambda_function_url" "test_live" {
  function_name      = aws_lambda_function.test.function_name
  qualifier          = "my_alias"
  authorization_type = "AWS_IAM"

  cors {
    allow_credentials = true
    allow_origins     = ["*"]
    allow_methods     = ["*"]
    allow_headers     = ["date", "keep-alive"]
    expose_headers    = ["keep-alive", "date"]
    max_age           = 86400
  }
}

Argument Reference

cors

This configuration block supports the following attributes:

Attribute Reference

This resource exports the following attributes in addition to the arguments above:

Import

In Terraform v1.5.0 and later, use an import block to import Lambda function URLs using the function_name or function_name/qualifier. For example:

import {
  to = aws_lambda_function_url.test_lambda_url
  id = "my_test_lambda_function"
}

Using terraform import, import Lambda function URLs using the function_name or function_name/qualifier. For example:

% terraform import aws_lambda_function_url.test_lambda_url my_test_lambda_function