terraform { required_providers { aws = { source = "hashicorp/aws" version = "~> 4.16" } } required_version = ">= 1.2.0" } provider "aws" { profile = "default" region = var.region } # Create a zip file from the Lambda source code data "archive_file" "LambdaZipFile" { type = "zip" source_file = "${path.module}/functions/app.py" output_path = "${path.module}/LambdaFunction.zip" } # Get the Managed Policy AWSLambdaBasicExecutionRole data "aws_iam_policy" "AWSLambdaBasicExecutionRole" { arn = "arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole" } # Create an IAM role for the Lambda function resource "aws_iam_role" "LambdaRole" { assume_role_policy = <