forked from moritzzimmer/terraform-aws-lambda
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.tf
More file actions
50 lines (42 loc) · 1.54 KB
/
Copy pathmain.tf
File metadata and controls
50 lines (42 loc) · 1.54 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
data "aws_availability_zones" "available" {}
locals {
vpc_cidr = "10.0.0.0/16"
azs = slice(data.aws_availability_zones.available.names, 0, 3)
}
module "source" {
source = "../fixtures"
}
resource "random_pet" "this" {
length = 2
}
module "vpc" {
source = "terraform-aws-modules/vpc/aws"
version = "~> 5.0"
azs = local.azs
cidr = local.vpc_cidr
enable_ipv6 = true
name = random_pet.this.id
private_subnets = [for k, v in local.azs : cidrsubnet(local.vpc_cidr, 8, k)]
private_subnet_ipv6_prefixes = [3, 4, 5]
}
module "lambda" {
source = "../../"
architectures = ["arm64"]
description = "Example AWS Lambda function inside a VPC."
ephemeral_storage_size = 512
filename = module.source.output_path
function_name = random_pet.this.id
handler = "index.handler"
memory_size = 128
replace_security_groups_on_destroy = true
runtime = "nodejs20.x"
publish = false
snap_start = false
source_code_hash = module.source.output_base64sha256
timeout = 3
vpc_config = {
ipv6_allowed_for_dual_stack = true
security_group_ids = [module.vpc.default_security_group_id]
subnet_ids = module.vpc.private_subnets
}
}