• This repository has been archived on 08/Jun/2022
  • Stars
    star
    160
  • Rank 234,703 (Top 5 %)
  • Language HCL
  • License
    MIT License
  • Created almost 7 years ago
  • Updated over 2 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Terraform module for AWS Lambda functions

DEPRECATION WARNING

This module is lacking active maintainance and is being deprecated. Users are encouraged to migrate to the actively maintained https://github.com/terraform-aws-modules/terraform-aws-lambda community module. This repository will be marked as archived but will stay online for the foreseeable future.

terraform-aws-lambda

This Terraform module creates and uploads an AWS Lambda function and hides the ugly parts from you.

Features

  • Only appears in the Terraform plan when there are legitimate changes.
  • Creates a standard IAM role and policy for CloudWatch Logs.
    • You can add additional policies if required.
  • Zips up a source file or directory.
  • Installs dependencies from requirements.txt for Python functions.
    • It only does this when necessary, not every time.

Requirements

  • Python 2.7 or higher
  • Linux/Unix/Windows

Terraform version compatibility

Module version Terraform version
1.x.x 0.12.x
0.x.x 0.11.x

Usage

module "lambda" {
  source = "github.com/claranet/terraform-aws-lambda"

  function_name = "deployment-deploy-status"
  description   = "Deployment deploy status task"
  handler       = "main.lambda_handler"
  runtime       = "python3.6"
  timeout       = 300

  // Specify a file or directory for the source code.
  source_path = "${path.module}/lambda.py"

  // Add additional trusted entities for assuming roles (trust relationships).
  trusted_entities = ["events.amazonaws.com", "s3.amazonaws.com"]

  // Attach a policy.
  policy = {
    json = data.aws_iam_policy_document.lambda.json
  }

  // Add a dead letter queue.
  dead_letter_config = {
    target_arn = aws_sqs_queue.dlq.arn
  }

  // Add environment variables.
  environment = {
    variables = {
      SLACK_URL = var.slack_url
    }
  }

  // Deploy into a VPC.
  vpc_config = {
    subnet_ids         = [aws_subnet.test.id]
    security_group_ids = [aws_security_group.test.id]
  }
}

Inputs

Inputs for this module are the same as the aws_lambda_function resource with the following additional arguments:

Name Description Type Default Required
source_path The absolute path to a local file or directory containing your Lambda source code string yes
build_command The command to run to create the Lambda package zip file string "python build.py '$filename' '$runtime' '$source'" no
build_paths The files or directories used by the build command, to trigger new Lambda package builds whenever build scripts change list(string) ["build.py"] no
cloudwatch_logs Set this to false to disable logging your Lambda output to CloudWatch Logs bool true no
lambda_at_edge Set this to true if using Lambda@Edge, to enable publishing, limit the timeout, and allow edgelambda.amazonaws.com to invoke the function bool false no
policy An additional policy to attach to the Lambda function role object({json=string}) no
trusted_entities Additional trusted entities for the Lambda function. The lambda.amazonaws.com (and edgelambda.amazonaws.com if lambda_at_edge is true) is always set list(string) no
enabled Enabling and disaling of resources bool true no

The following arguments from the aws_lambda_function resource are not supported:

  • filename (use source_path instead)
  • role (one is automatically created)
  • s3_bucket
  • s3_key
  • s3_object_version
  • source_code_hash (changes are handled automatically)

Outputs

Name Description
function_arn The ARN of the Lambda function
function_invoke_arn The Invoke ARN of the Lambda function
function_name The name of the Lambda function
function_qualified_arn The qualified ARN of the Lambda function
role_arn The ARN of the IAM role created for the Lambda function
role_name The name of the IAM role created for the Lambda function

More Repositories

1

tfwrapper

Claranet France Terraform Wrapper
Python
111
star
2

terraform-datadog-monitors

Manage Datadog monitors with terraform dedicated modules.
HCL
91
star
3

aws-inventory-graph

Explore your AWS platform with, Dgraph, a graph database.
Go
64
star
4

terraform-azurerm-regions

Terraform module to handle Azure Regions
HCL
61
star
5

terraform-aws-aurora

Terraform module for creating and managing Amazon Aurora clusters
HCL
56
star
6

sshm

Easy connect on EC2 instances thanks to AWS System Manager Agent. Just use your `~/.aws/profile` to easily select the instance you want to connect on.
Go
55
star
7

terraform-azurerm-aks

Terraform module composition (feature) for Azure Kubernetes Service
HCL
45
star
8

terraform-azurerm-app-gateway

Terraform module for Azure Application Gateway
HCL
37
star
9

python-terrafile

Manages external Terraform modules
Python
36
star
10

jinjaform

Terraform wrapper with Jinja2 templates
Python
34
star
11

centos7-ami

Shell script to build CentOS 7 AMI
Shell
34
star
12

puppet-consul_template

A Puppet module to manage the config and jobs of Consul Template from Hashicorp
Ruby
30
star
13

ansible-gendoc

Auto generate Ansible documentation
Python
26
star
14

ssha

SSH into AWS EC2 instances
Python
25
star
15

terraform-azurerm-keyvault

Terraform module composition (feature) for Azure KeyVault
HCL
23
star
16

terraform-signalfx-detectors

Collection of terraform modules for SignalFx detectors.
HCL
22
star
17

terraform-aws-ssm-patch-management

Terraform module for AWS SSM Patch Management
HCL
22
star
18

nagitheus

Nagios Check towards Prometheus
Go
20
star
19

cloud-deploy

Claranet Cloud Deploy
Python
19
star
20

terraform-azurerm-windows-vm

Terraform module composition (feature) for ARM Windows Virtual Machine (VM)
HCL
18
star
21

terraform-aws-lets-encrypt

Terraform module for creating Let's Encrypt certificates with AWS Lambda and Route 53
Python
17
star
22

terraform-azurerm-app-service

Terraform module composition (feature) for Azure App Service (Service Plan + WebApp)
HCL
16
star
23

terraform-azurerm-api-management

Terraform module for Azure API Management
HCL
16
star
24

spryker-demoshop

Containerized demoshop based on the Spryker Commerce OS
PHP
16
star
25

terraform-azurerm-function-app

Terraform module for Azure Function App
HCL
15
star
26

terraform-azurerm-db-sql

Terraform module composition (feature) for Azure SQL Database (SQLServer based)
HCL
14
star
27

terraform-azurerm-linux-vm

Terraform module composition (feature) for ARM Linux Virtual Machine (VM)
HCL
14
star
28

terraform-aws-s3-yum-repo

Manages a YUM repository in an S3 bucket
HCL
13
star
29

aps

Easy switch between AWS Profiles and Regions
Go
13
star
30

ansible-role-motd

Install and configure dynamic MOTD and SSH banner
Jinja
12
star
31

php

PHP docker base image
Shell
12
star
32

terraform-aws-asg-instance-alarms

Manages CloudWatch Alarms for EC2 Instances in ASGs
Python
12
star
33

terraform-azurerm-cdn-frontdoor

Terraform module for Azure CDN FrontDoor (Standard/Premium)
HCL
12
star
34

spryker-base

Common container build/run infrastructure for shops based on Spryker commerce OS
Shell
11
star
35

ansible-role-log4shell

Find Log4Shell CVE-2021-44228 on your system
Jinja
11
star
36

gcloud-kubectl-docker

Everything you need to interact with GCP, k8s, docker
Shell
11
star
37

terraform-azurerm-storage-account

Terraform module for Azure Storage
HCL
11
star
38

terraform-azurerm-db-postgresql-flexible

Terraform module composition (feature) for Azure PostGreSQL Flexible Database
HCL
10
star
39

terraform-azurerm-rg

Terraform module for Azure Resource Group
HCL
10
star
40

nutanix-exporter

Go
10
star
41

zerto-exporter

Prometheus Exporter for Zerto
Go
9
star
42

terraform-aws-vpc-modules

Terraform modules for AWS VPC management
HCL
9
star
43

terraform-azurerm-subnet

Terraform module for Azure virtual networks subnets
HCL
9
star
44

terraform-aws-asg-instance-replacement

Terraform module for AWS ASG instance replacement
Python
9
star
45

kcs

Select which kubeconfig.yaml to use in an easy way. KCS means kubeconfig switcher.
Go
9
star
46

windows-audit

Scripts for auditing Windows Server 2003+ servers, and turning the output data into a usable format.
PowerShell
8
star
47

ctf-toolkit

A toolkit for CTF challenges
8
star
48

terraform-aws-cloudwatch-slack

Terraform module for sending CloudWatch Alarm events to Slack
HCL
8
star
49

terraform-azurerm-tagging

Terraform module for Resources Tagging
HCL
8
star
50

rubrik-exporter

Rubrik metrics exporter for Prometheus
Go
8
star
51

iamdump

Like tcpdump for AWS IAM policies
Python
7
star
52

puppet-varnish

Puppet module to install and configure Varnish cache
Ruby
7
star
53

terraform-azurerm-storage-sas-token

Terraform module for Azure Storage SAS Token access
HCL
7
star
54

terraform-azurerm-virtual-wan

Terraform module for Azure Virtual WAN
HCL
7
star
55

terraform-azurerm-app-service-web

[Deprecated] Terraform module for Azure App Service Web
HCL
7
star
56

puppet-timezone

Basic Puppet module to set Linux timezone
Ruby
6
star
57

terraform-azurerm-nsg

Terraform module for Azure Network Security Group
HCL
6
star
58

sqldumper

A small SQLDUMPER Container to run as cron
Python
6
star
59

terraform-azurerm-alerting

Terraform module for Azure Alerting
HCL
6
star
60

terraform-path-hash

Terraform module for hashing the contents of a path
Python
5
star
61

terraform-aws-packer-cleanup

Terraform module to clean up Packer AWS resources
Python
5
star
62

terraform-azurerm-aci

Terraform module for Azure Container Instances group
HCL
5
star
63

terraform-azurerm-run

Terraform module composition (feature) to setup Claranet MSP Azure tools
HCL
5
star
64

go-s3-describe

A tool to list all S3 Buckets of an AWS account with their main statistics. Buckets are sorted by size.
Go
5
star
65

terraform-aws-ssh-keys

Terraform module for managing SSH keys
Python
5
star
66

terraform-azurerm-eventhub

Terraform module for Azure Eventhub
HCL
5
star
67

s3undelete

Utility to undelete deleted files in a versioned S3 bucket
Go
5
star
68

terraform-azurerm-db-postgresql

[Deprecated] Terraform module composition (feature) for Azure PostGreSQL Database
HCL
5
star
69

terraform-datadog-scripts

Scripts used for datadog terraform modules for CI and compliant purpose.
Shell
5
star
70

casper

Claranet Cloud Deploy - CLI tool
Python
5
star
71

zabbix-aws-deregister

Zabbix Deregister for AWS AutoScaling
Go
5
star
72

motd

Claranet Unix Motd
Shell
5
star
73

ansible-role-mariadb

Install and configure MariaDB
Shell
5
star
74

terraform-azurerm-app-service-plan

Terraform module for Azure Service Plan
HCL
4
star
75

terraform-azurerm-cosmos-db

Terraform module for CosmosDB account and databases
HCL
4
star
76

terraform-azurerm-dashboard

Terraform module for Azure Dashboard
HCL
4
star
77

cloud-deploy-docs

Claranet Cloud Deploy - Documentation
Python
4
star
78

terraform-aws-ecs-service-pipeline

Create ECS services and deploy to them with CodePipeline
HCL
4
star
79

ansible-role-satisfactory

Install and configure Satisfactory dedicated server
Python
4
star
80

claranet-azure-pre-configuration

Claranet Azure pre-configuration script
Shell
4
star
81

clara-coin-slack-command

Slack bot hosted on aws lambda for the Clara Coin initiative
JavaScript
4
star
82

ansible-role-users

Configure system's users
Python
4
star
83

terraform-azurerm-firewall

Terraform module for Azure Firewall
HCL
4
star
84

ansible-role-certbot

Install and manage certbot
Jinja
4
star
85

terraform-aws-alb-cloudwatch-logs-json

Terraform module for shipping AWS ALB logs to CloudWatch Logs in JSON format
Python
4
star
86

cookiecutter-ansible-role

Cookiecutter for Ansible role
Jinja
4
star
87

terraform-datadog-integrations

Manage Datadog integrations with terraform dedicated modules.
HCL
4
star
88

terraform-azurerm-run-common

[Deprecated] Terraform module composition (feature) to setup Claranet MSP Azure common tools
HCL
4
star
89

ansible-role-composer

Install PHP Composer on the target
Jinja
3
star
90

terraform-azurerm-front-door

[Deprecated] Terraform module for Azure Front Door (classic)
HCL
3
star
91

graylog-exporter

Go
3
star
92

terraform-aws-asg-pipeline

Create auto scaling groups and deploy to them with CodePipeline
HCL
3
star
93

terraform-provider-clouddeploy

Cloud Deploy - Terraform provider
Go
3
star
94

terraform-azurerm-avd

Terraform module for Azure Virtual Desktop
HCL
3
star
95

terraform-azurerm-lb

Terraform module for Azure Load Balancer
HCL
3
star
96

terraform-azurerm-data-factory

Terraform module for Azure Data Factory
HCL
3
star
97

dockerfiles

Various Dockerfiles used for CI.
Dockerfile
3
star
98

terraform-azurerm-run-iaas

[Deprecated] Terraform module composition (feature) to setup Claranet MSP Azure IaaS/VM tools
HCL
3
star
99

terraform-azurerm-eventgrid

Terraform module for Azure Eventgrid
HCL
3
star
100

terraform-azurerm-aks-light

Terraform module for Azure Kubernetes Service
HCL
3
star