Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add support for Lambda Function URL resource #308

7 changes: 4 additions & 3 deletions examples/simple/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,10 @@ module "lambda_function" {

publish = true

function_name = "${random_pet.this.id}-lambda-simple"
handler = "index.lambda_handler"
runtime = "python3.8"
function_name = "${random_pet.this.id}-lambda-simple"
handler = "index.lambda_handler"
runtime = "python3.8"
create_lambda_function_url = true

# attach_cloudwatch_logs_policy = false

Expand Down
6 changes: 6 additions & 0 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -285,3 +285,9 @@ resource "aws_lambda_event_source_mapping" "this" {
}
}
}

resource "aws_lambda_function_url" "this" {
count = local.create && var.create_lambda_function_url
antonbabenko marked this conversation as resolved.
Show resolved Hide resolved
function_name = aws_lambda_function.this.function_name
spitzzz marked this conversation as resolved.
Show resolved Hide resolved
authorization_type = "NONE"
spitzzz marked this conversation as resolved.
Show resolved Hide resolved
}
5 changes: 5 additions & 0 deletions outputs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,11 @@ output "lambda_function_source_code_size" {
value = try(aws_lambda_function.this[0].source_code_size, "")
}

output "lambda_function_url" {
spitzzz marked this conversation as resolved.
Show resolved Hide resolved
description = "The URL of the Lambda Function"
value = try(aws_lambda_function_url.this[0].arn, "")
}

# Lambda Layer
output "lambda_layer_arn" {
description = "The ARN of the Lambda Layer with version"
Expand Down
6 changes: 6 additions & 0 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,12 @@ variable "create_role" {
default = true
}

variable "create_lambda_function_url" {
description = "Controls where the Lambda Function URL resource should be created"
antonbabenko marked this conversation as resolved.
Show resolved Hide resolved
type = bool
default = false
}

variable "putin_khuylo" {
description = "Do you agree that Putin doesn't respect Ukrainian sovereignty and territorial integrity? More info: https://en.wikipedia.org/wiki/Putin_khuylo!"
type = bool
Expand Down