Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

s3_object_version parameter for aws_lambda_function resource #4931

Closed
anosulchik opened this issue Feb 1, 2016 · 6 comments
Closed

s3_object_version parameter for aws_lambda_function resource #4931

anosulchik opened this issue Feb 1, 2016 · 6 comments

Comments

@anosulchik
Copy link

Hi,

I'm trying to deploy aws lambda function using terraform from s3 bucket:

resource "aws_lambda_function" "ecs_ecs_autoscale_lambda" {
  s3_bucket = "${aws_s3_bucket.lambda_bucket.id}"
  s3_key = "ecs_autoscale.zip"
  function_name = "issues_ecs_service_autoscale"
  role = "${aws_iam_role.issues_ecs_autoscale_lambda_role.arn}"
  runtime = "nodejs"
  timeout = "8"
  handler = "example.handler"
}

I'm getting error regarding s3_object_version -- looks like terraform handles it as mandatory while it should be optional e.g. for buckets which doesn't support versioning.

Here's the error that I'm getting:

aws_lambda_function.ecs_ecs_autoscale_lambda: Creating...
  arn:              "" => "<computed>"
  function_name:    "" => "issues_ecs_service_autoscale"
  handler:          "" => "example.handler"
  last_modified:    "" => "<computed>"
  memory_size:      "" => "128"
  role:             "" => "arn:aws:iam::xxx:role/ecs_autoscale_lambda_issues_Staging"
  runtime:          "" => "nodejs"
  s3_bucket:        "" => "issues_service_lambdas_Staging"
  s3_key:           "" => "ecs_autoscale/example.js"
  source_code_hash: "" => "<computed>"
  timeout:          "" => "8"
Error applying plan:

1 error(s) occurred:

* aws_lambda_function.ecs_ecs_autoscale_lambda: s3_bucket, s3_key and s3_object_version must all be set while using S3 code source

Terraform does not automatically rollback in the face of errors.
Instead, your Terraform state file has been partially updated with
any resources that successfully completed. Please address the error
above and apply again to incrementally change your infrastructure.

Please advise.

@radeksimko
Copy link
Member

Hi, this is a known bug, we have a PR that should be hopefully fixing this:
#4770

@anosulchik
Copy link
Author

Thanks @radeksimko

@radeksimko
Copy link
Member

The mentioned PR #4770 which is fixing this was merged a while ago. Closing.

@dkade
Copy link

dkade commented Nov 21, 2016

This problem is still happening and i'm not even using S3 buckets..

resource "aws_lambda_function" "lambda_test" {
function_name = "test_lambda"
role = "lambda_basic_execution"
handler = "code.lambda_handler"
runtime = "python2.7"
}

  • aws_lambda_function.lambda_test: s3_bucket and s3_key must all be set while using S3 code source

Terraform version: Terraform v0.7.11

@radeksimko
Copy link
Member

@dkade Based on the provided code sample I think you're missing filename parameter, else Terraform won't know where to get the function code from. Therefore I don't believe this is a bug.

Also the current error message (in 0.8.4) mentions this:

* aws_lambda_function.lambda_test: filename or s3_* attributes must be set

@ghost
Copy link

ghost commented Apr 17, 2020

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.

If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@ghost ghost locked and limited conversation to collaborators Apr 17, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants