terraform

Terraform not uploading Lambda code zip file to AWS

青春壹個敷衍的年華 提交于 2020-08-27 07:11:09
问题 Right now I have the following in my main.tf : resource "aws_lambda_function" "terraform_lambda" { filename = "tf_lambda.zip" function_name = "tf_lambda" role = "lambda_basic_execution" handler = "tf_lambda.lambda_handler" source_code_hash = "${base64sha256(file("tf_lambda.zip"))}" runtime = "python3.6" } My directory structure is like so: . |-- main.tf |-- tf_lambda.zip |-- tf_lambda └── tf_lambda.py When I run terraform apply and then, in the console, go to the lambda created the code

Terraform AWS role policy fails when adding permissions

大兔子大兔子 提交于 2020-08-26 11:43:06
问题 I need to create some role policy for AWS using Terraform, the basic role works fine, but when I add S3 and logs, I get a malformed error: aws_iam_role.lambda_exec_role_s3: Error creating IAM Role lambda_exec_role_s3: MalformedPolicyDocument: Has prohibited field Resource status code: 400 This is the role policy that is failing: assume_role_policy = <<EOF { "Version": "2012-10-17", "Statement": [ { "Action": "sts:AssumeRole", "Principal": { "Service": "lambda.amazonaws.com" }, "Effect":