terraform-provider-aws: Not able to create lambda function with aws_lambda_function
This issue was originally opened by @regin64 as hashicorp/terraform#15783. It was migrated here as a result of the provider split. The original body of the issue is below.
Hi,
I was trying to create a lambda function using Terraform onto AWS but did not succeed. After Terraform trying to create the lambda function, the debug information below (the gist link) kept showing up until the Terraform is shut down due to timeout (10 minutes).
Terraform Version
v0.9.9
Terraform Configuration Files
provider "aws" {
access_key = "${var.aws_access_key}"
secret_key = "${var.aws_secret_key}"
region = "${var.aws_region}"
}
resource "aws_lambda_function" "Resource-Creation-Tagger-2" {
filename = "lambda_function.zip"
function_name = "lambda_function"
role = "${aws_iam_role.Resource-Creation-Tagger-Role.arn}"
handler = "lambda_function.lambda_handler"
runtime = "python2.7"
memory_size = "128"
timeout = "3"
}
resource "aws_iam_role" "Resource-Creation-Tagger-Role" {
name = "Resource-Creation-Tagger-Role"
assume_role_policy = <<EOF
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": "sts:AssumeRole",
"Principal": {
"Service": "lambda.amazonaws.com"
}
}
]
}
EOF
}
resource "aws_iam_role_policy" "Resource-Tagger-Role-Policy" {
name = "Resource-Tagger-Role-Policy"
role = "${aws_iam_role.Resource-Creation-Tagger-Role.id}"
policy = <<EOF
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"logs:*"
],
"Resource": "arn:aws:logs:*:*:*"
},
{
"Effect": "Allow",
"Action": "ec2:Describe*",
"Resource": "*"
},
{
"Effect": "Allow",
"Action": [
"ec2:CreateTags"
],
"Resource": [
"*"
]
}
]
}
EOF
}
Debug Output
https://gist.github.com/regin64/51081e8310b19de20b80e9cc341debb1
Expected Behavior
Create IAM role with policy, the lambda function
Actual Behavior
IAM role with policy was created, the lambda function was not
Steps to Reproduce
terraform planterraform apply
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Comments: 28 (11 by maintainers)
@josephjoice nice to hear! thanks for the feedback 😃
@roncato @arohter @thelevante could you try the same? (flushing the dns)
Thanks!