Skip to content

Instantly share code, notes, and snippets.

@KyMidd
Created April 7, 2025 17:32
Show Gist options
  • Select an option

  • Save KyMidd/45c7af8b7f25fbe98e2b1a718a573e50 to your computer and use it in GitHub Desktop.

Select an option

Save KyMidd/45c7af8b7f25fbe98e2b1a718a573e50 to your computer and use it in GitHub Desktop.
# Publish alias of new version
resource "aws_lambda_alias" "devopsbot_receiver_alias" {
name = "Newest"
function_name = aws_lambda_function.devopsbot_receiver.arn
function_version = aws_lambda_function.devopsbot_receiver.version
# Add ignore for routing_configuration
lifecycle {
ignore_changes = [
routing_config, # This sometimes has a race condition, so ignore changes to it
]
}
}
# Point lambda function url at new version
resource "aws_lambda_function_url" "DevOpsBotReceiver_Slack_Trigger_FunctionUrl" {
function_name = aws_lambda_function.devopsbot_receiver.function_name
qualifier = aws_lambda_alias.devopsbot_receiver_alias.name
authorization_type = "NONE"
}
# Print the URL we can use to trigger the bot
output "DevOpsBot_Slack_Trigger_FunctionUrl" {
value = aws_lambda_function_url.DevOpsBotReceiver_Slack_Trigger_FunctionUrl.function_url
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment