Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@ Deployment packages can be specified either directly as a local file (using the
or using [container images](https://docs.aws.amazon.com/lambda/latest/dg/lambda-images.html) (using `image_uri` and `package_type` arguments),
see [documentation](https://www.terraform.io/docs/providers/aws/r/lambda_function.html#specifying-the-deployment-package) for details.

### simple
### basic

see [example](examples/simple) for details
see [example](examples/complete) for other configuration options

```hcl
provider "aws" {
Expand Down Expand Up @@ -308,9 +308,9 @@ see [examples](examples/deployment) for details.

## Examples

- [complete](examples/complete)
- [container-image](examples/container-image)
- [deployment](examples/deployment)
- [simple](examples/simple)
- [with-cloudwatch-event-rules](examples/with-cloudwatch-event-rules)
- [with-cloudwatch-logs-subscription](examples/with-cloudwatch-logs-subscription)
- [with-event-source-mappings](examples/with-event-source-mappings)
Expand Down
15 changes: 11 additions & 4 deletions examples/simple/README.md → examples/complete/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Example without event
# Complete example

Creates an AWS Lambda function without an event trigger.
Creates an AWS Lambda function without an event trigger showcasing configuration options.

## usage

Expand All @@ -19,10 +19,14 @@ Note that this example may create resources which cost money. Run `terraform des
|------|---------|
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 1.0 |
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 5.0 |
| <a name="requirement_random"></a> [random](#requirement\_random) | >= 3.5 |

## Providers

No providers.
| Name | Version |
|------|---------|
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 5.0 |
| <a name="provider_random"></a> [random](#provider\_random) | >= 3.5 |

## Modules

Expand All @@ -33,7 +37,10 @@ No providers.

## Resources

No resources.
| Name | Type |
|------|------|
| [random_pet.this](https://registry.terraform.io/providers/hashicorp/random/latest/docs/resources/pet) | resource |
| [aws_region.current](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/region) | data source |

## Inputs

Expand Down
47 changes: 47 additions & 0 deletions examples/complete/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
data "aws_region" "current" {}

module "source" {
source = "../fixtures"
}

resource "random_pet" "this" {
length = 2
}

module "lambda" {
source = "../../"

architectures = ["arm64"]
description = "Example AWS Lambda function without any triggers."
ephemeral_storage_size = 512
filename = module.source.output_path
function_name = random_pet.this.id
handler = "index.handler"
memory_size = 128
runtime = "nodejs18.x"
publish = false
snap_start = false
source_code_hash = module.source.output_base64sha256
timeout = 3

// logs and metrics
cloudwatch_logs_enabled = true
cloudwatch_logs_retention_in_days = 7
cloudwatch_lambda_insights_enabled = true
layers = ["arn:aws:lambda:${data.aws_region.current.id}:580247275435:layer:LambdaInsightsExtension-Arm64:5"]

environment = {
variables = {
key = "value"
}
}

// AWS Systems Manager (SSM) Parameter Store
ssm = {
parameter_names = ["/internal/params", "/external/params"]
}

tags = {
key = "value"
}
}
File renamed without changes.
8 changes: 8 additions & 0 deletions examples/complete/provider.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
provider "aws" {
region = var.region

skip_credentials_validation = true
skip_metadata_api_check = true
skip_region_validation = true

}
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,9 @@ terraform {
source = "hashicorp/aws"
version = ">= 5.0"
}
random = {
source = "hashicorp/random"
version = ">= 3.5"
}
}
}
2 changes: 1 addition & 1 deletion examples/container-image/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Example without event
# Example using a container image

Creates an AWS Lambda function using a [container image](https://docs.aws.amazon.com/lambda/latest/dg/lambda-images.html).

Expand Down
25 changes: 0 additions & 25 deletions examples/simple/main.tf

This file was deleted.

3 changes: 0 additions & 3 deletions examples/simple/provider.tf

This file was deleted.