aws_playground- experiments in aws with terraform |
git clone git://git.acid.vegas/aws_playground.git |
Log | Files | Refs | Archive | README |
lambda.tf (736B)
1 provider "aws" { 2 region = var.aws_region 3 } 4 5 resource "aws_iam_role" "lambda_execution_role" { 6 name = "LambdaExecutionRole" 7 8 assume_role_policy = jsonencode({ 9 Version = "2012-10-17", 10 Statement = [ 11 { 12 Action = "sts:AssumeRole", 13 Effect = "Allow", 14 Principal = { 15 Service = "lambda.amazonaws.com" 16 } 17 } 18 ] 19 }) 20 } 21 22 resource "aws_lambda_function" "this" { 23 count = var.instance_count 24 function_name = "FUNK-${count.index}" 25 handler = "lambda_function.lambda_handler" 26 role = aws_iam_role.lambda_execution_role.arn 27 runtime = "python3.8" 28 filename = "lambda_function.zip" 29 source_code_hash = filebase64sha256("lambda_function.zip") 30 timeout = 15 31 }