# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. # SPDX-License-Identifier: MIT-0 terraform { required_version = ">= 0.13.1" required_providers { aws = { source = "hashicorp/aws" version = ">= 3.19" } random = { source = "hashicorp/random" version = ">= 2.0" } } } provider "aws" { region = "us-west-1" } module "publish_book_review" { source = "terraform-aws-modules/lambda/aws" version = "4.6.0" create_role = false timeout = 30 source_path = local.lambda_src_path function_name = "publish-book-review" handler = "index.lambda_handler" runtime = "python3.8" lambda_role = aws_iam_role.iam_for_lambda.arn environment_variables = { DYNAMODB_TABLE_NAME = "${aws_dynamodb_table.book-reviews-ddb-table.id}" } } resource "aws_iam_role" "iam_for_lambda" { name = "iam_for_lambda_usage" assume_role_policy = <