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

r/aws_lambda_function AWS Lambda Concurrency #2504

Merged

Conversation

Puneeth-n
Copy link
Contributor

@Puneeth-n Puneeth-n commented Nov 30, 2017

Support AWS Lambda concurrency: https://docs.aws.amazon.com/lambda/latest/dg/concurrent-executions.html

relates to #2501
requires #2500

  • Basic acceptance tests
  • Complex acceptance tests
  • Update README
make testacc TESTARGS='-run=TestAccAWSLambdaFunction_basic'
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test $(go list ./... |grep -v 'vendor') -v -run=TestAccAWSLambdaFunction_basic -timeout 120m
?   	github.com/terraform-providers/terraform-provider-aws	[no test files]
=== RUN   TestAccAWSLambdaFunction_basic
--- PASS: TestAccAWSLambdaFunction_basic (39.94s)
PASS
ok  	github.com/terraform-providers/terraform-provider-aws/aws	39.967s

make testacc TESTARGS='-run=TestAccAWSLambdaFunction_concurrency'
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test $(go list ./... |grep -v 'vendor') -v -run=TestAccAWSLambdaFunction_concurrency -timeout 120m
?   	github.com/terraform-providers/terraform-provider-aws	[no test files]
=== RUN   TestAccAWSLambdaFunction_concurrency
--- PASS: TestAccAWSLambdaFunction_concurrency (65.70s)
=== RUN   TestAccAWSLambdaFunction_concurrencyCycle
--- PASS: TestAccAWSLambdaFunction_concurrencyCycle (83.12s)
PASS
ok  	github.com/terraform-providers/terraform-provider-aws/aws	148.837s

@Puneeth-n Puneeth-n changed the title [WIP] AWS Lambda Concurrency [WIP] r/aws_lambda_function AWS Lambda Concurrency Nov 30, 2017
@Puneeth-n Puneeth-n force-pushed the feature/support-lambda-concurrency branch 5 times, most recently from c617b48 to 98d3440 Compare December 1, 2017 11:28
@Puneeth-n Puneeth-n changed the title [WIP] r/aws_lambda_function AWS Lambda Concurrency r/aws_lambda_function AWS Lambda Concurrency Dec 1, 2017
@Puneeth-n Puneeth-n force-pushed the feature/support-lambda-concurrency branch 2 times, most recently from e4bb9a7 to 5039308 Compare December 1, 2017 11:32
@radeksimko radeksimko added the enhancement Requests to existing resources that expand the functionality or scope. label Dec 1, 2017
@Puneeth-n Puneeth-n changed the title r/aws_lambda_function AWS Lambda Concurrency [WIP] r/aws_lambda_function AWS Lambda Concurrency Dec 1, 2017
@Puneeth-n Puneeth-n force-pushed the feature/support-lambda-concurrency branch from 5039308 to 6fdcf91 Compare December 4, 2017 11:53
@Puneeth-n Puneeth-n changed the title [WIP] r/aws_lambda_function AWS Lambda Concurrency r/aws_lambda_function AWS Lambda Concurrency Dec 4, 2017
@Puneeth-n
Copy link
Contributor Author

@radeksimko @Ninir Can you please review it :)

Copy link
Member

@radeksimko radeksimko left a 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 👍

@@ -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 {
Copy link
Member

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.

@@ -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")
Copy link
Member

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. 😉

}

_, err := conn.PutFunctionConcurrency(concurrencyParams)

Copy link
Member

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.

deleteConcurrencyParams := &lambda.DeleteFunctionConcurrencyInput{
FunctionName: aws.String(d.Id()),
}

Copy link
Member

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 radeksimko added the waiting-response Maintainers are waiting on response from community or contributor. label Dec 4, 2017
@Puneeth-n
Copy link
Contributor Author

@radeksimko Thanks! I will make the changes :)

@Puneeth-n Puneeth-n force-pushed the feature/support-lambda-concurrency branch from 6fdcf91 to d47ecc6 Compare December 5, 2017 09:20
@Puneeth-n
Copy link
Contributor Author

@radeksimko Done!

@radeksimko radeksimko merged commit b40e6ef into hashicorp:master Dec 5, 2017
@radeksimko radeksimko removed the waiting-response Maintainers are waiting on response from community or contributor. label Dec 5, 2017
mdlavin pushed a commit to mdlavin/terraform-provider-aws that referenced this pull request Dec 9, 2017
@ghost
Copy link

ghost commented Apr 10, 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 feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. Thanks!

@ghost ghost locked and limited conversation to collaborators Apr 10, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement Requests to existing resources that expand the functionality or scope.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants