Git Product home page Git Product logo

aws-lambda-function's Introduction

aws-lambda-function

Terraform module to create AWS Lambda Function .

terrafrom config example:

data "archive_file" "lambda_zip" {
  type        = "zip"
  source_file = "files/lambda_function.py"
  output_path = "lambda_function.zip"
}


module "lambda_function" {
  source = "../.."

  runtime          = "python3.8"
  handler          = "lambda_function.lambda_handler"
  memory_size      = "256"
  timeout          = 120
  filename         = data.archive_file.lambda_zip.output_path
  depends_on       = [data.archive_file.lambda_zip]
  source_code_hash = data.archive_file.lambda_zip.output_sha
  lambda_environment = {
    variables = {
      ERROR_QUEUE_URL = "http://ERROR_QUEUE_URL"
      INPUT_QUEUE_URL = "http://INPUT_QUEUE_URL"
    }
  }
  function_role_policy_statements = {
    policy-sqs = [
      {
        Action = [
          "sqs:*"
        ]
        Effect = "Allow"
        Resource = [
          "arn:aws:sqs:us-east-2:444455556666:queue1",
          "arn:aws:sqs:us-east-2:444455556666:queue2"
        ]
      },
    ]
  }
  labels = local.labels
}

more info see examples/test

terraform run example

cd examples/test
terraform init
terraform plan

Terraform versions tested

  • 0.15.3
  • 1.1.8

Requirements

No requirements.

Providers

Name Version
aws n/a

Modules

No modules.

Resources

Name Type
aws_cloudwatch_log_group.default resource
aws_iam_role.function_iam_role resource
aws_iam_role_policy.function_iam_role resource
aws_iam_role_policy_attachment.function_iam_role resource
aws_iam_role_policy_attachment.function_iam_role_default resource
aws_lambda_function.default resource
aws_iam_policy_document.function_iam data source

Inputs

Name Description Type Default Required
architectures Instruction set architecture for your Lambda function. Valid values are ["x86_64"] and ["arm64"].
Default is ["x86_64"]. Removing this attribute, function's architecture stay the same.
list(string) null no
description Description of what the Lambda Function does. string null no
filename The path to the function's deployment package within the local filesystem. If defined, The s3_-prefixed options and image_uri cannot be used. string null no
function_iam_role_name optionally define a custom value for the function iam role name and tag=Name parameter
in aws_iam_role. By default, it is defined as a construction from var.labels
string "default" no
function_name optionally define a custom value for the function name and tag=Name parameter
in aws_lambda_function. By default, it is defined as a construction from var.labels
string "default" no
function_role_policy_arns A list of IAM Policy ARNs to attach to the generated function role. list(string) [] no
function_role_policy_arns_default default arns list for function list
[
"arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole"
]
no
function_role_policy_statements A map of zero or multiple role policies statements
which will be attached to task role(in addition to default)
map(any) {} no
handler The function entrypoint in your code. string null no
labels Minimum required map of labels(tags) for creating aws resources
object({
prefix = string
stack = string
component = string
env = string
})
n/a yes
lambda_environment Environment (e.g. env variables) configuration for the Lambda function enable you to dynamically pass settings to your function code and libraries
object({
variables = map(string)
})
null no
memory_size Amount of memory in MB the Lambda Function can use at runtime. number 128 no
package_type The Lambda deployment package type. Valid values are Zip and Image. string "Zip" no
permissions_boundary A permissions boundary ARN to apply to the roles that are created. string "" no
runtime The runtime environment for the Lambda function you are uploading. string null no
source_code_hash Used to trigger updates. Must be set to a base64-encoded SHA256 hash of the package file specified with either
filename or s3_key. The usual way to set this is filebase64sha256('file.zip') where 'file.zip' is the local filename
of the lambda function source archive.
string "" no
tags Additional tags map(string) {} no
timeout The amount of time the Lambda Function has to run in seconds. number 15 no

Outputs

No outputs.

aws-lambda-function's People

Contributors

mbelousov7 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.