-
Notifications
You must be signed in to change notification settings - Fork 9.3k
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
r/aws_lambda_function AWS Lambda Concurrency #2504
r/aws_lambda_function AWS Lambda Concurrency #2504
Conversation
c617b48
to
98d3440
Compare
e4bb9a7
to
5039308
Compare
5039308
to
6fdcf91
Compare
@radeksimko @Ninir Can you please review it :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks overall good - just left you some stylistic/nitpicky comments. Test are passing 👍
aws/resource_aws_lambda_function.go
Outdated
@@ -453,6 +474,12 @@ func resourceAwsLambdaFunctionRead(d *schema.ResourceData, meta interface{}) err | |||
|
|||
d.Set("invoke_arn", buildLambdaInvokeArn(*function.FunctionArn, meta.(*AWSClient).region)) | |||
|
|||
if getFunctionOutput.Concurrency != nil && getFunctionOutput.Concurrency.ReservedConcurrentExecutions != nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nitpick, but the second check isn't necessary as Set()
will perform safe dereferencing (i.e. it's ok to call d.Set("field", nil)
). In fact we always prefer to delegate dereferencing to Set()
to keep CRUD code short.
aws/resource_aws_lambda_function.go
Outdated
@@ -667,6 +694,39 @@ func resourceAwsLambdaFunctionUpdate(d *schema.ResourceData, meta interface{}) e | |||
d.SetPartial("s3_object_version") | |||
} | |||
|
|||
if d.HasChange("reserved_concurrent_executions") { | |||
|
|||
_, nc := d.GetChange("reserved_concurrent_executions") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nitpick, but there's no point of using GetChange
if all we need is the new value. Get
will give us exactly that and we won't have to ignore any output. 😉
aws/resource_aws_lambda_function.go
Outdated
} | ||
|
||
_, err := conn.PutFunctionConcurrency(concurrencyParams) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nitpick: we usually keep error handling close to the function call - i.e. no empty line between them.
aws/resource_aws_lambda_function.go
Outdated
deleteConcurrencyParams := &lambda.DeleteFunctionConcurrencyInput{ | ||
FunctionName: aws.String(d.Id()), | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nitpick: we usually keep error handling close to the function call - i.e. no empty line between them.
@radeksimko Thanks! I will make the changes :) |
6fdcf91
to
d47ecc6
Compare
@radeksimko Done! |
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 feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. Thanks! |
Support AWS Lambda concurrency: https://docs.aws.amazon.com/lambda/latest/dg/concurrent-executions.html
relates to #2501
requires #2500