Open theipster opened 2 months ago
Voting for Prioritization
Volunteering to Work on This Issue
Oh I am here for this proposal, but for a slightly different reason.
To be clear, the issue we are having is with an updated lambda function returning a valid update but not quite ready for invocation causing failures in the application of a plan due to:
│ Error: invoking Lambda Function (FUNCTION_NAME): operation error Lambda: Invoke, https response error StatusCode: 409, RequestID: UUID, api error CodeArtifactUserPendingException: ERROR: Lambda is initializing your function. It will be ready to invoke shortly.
--
| │
| │ with module.MODULE_NAME.aws_lambda_invocation.RESOURCE_NAME[0],
| │ on .terraform/modules/MODULE/FILENAME.tf line LINE_NUMBER, in resource "aws_lambda_invocation" "RESOURCE_NAME":
| │ LINE_NUMBER: resource "aws_lambda_invocation" "RESOURCE_NAME" {
| │
| ╵
Description
The purpose of both the
aws_lambda_invocation
resource and data source are to invoke a Lambda synchronously (i.e. using theRequestResponse
invocation type). Furthermore, for synchronous invocations, it is the responsibility of the invoker (i.e. theaws_lambda_invocation
resource/data source) to handle retries as appropriate.This enhancement request is to enable practitioners to configure retry parameters for
aws_lambda_invocation
.Use cases
In some (many?) real-world scenarios, infrastructure requirements do not change on a frequent basis. Therefore, when a Terraform workload depends on invoking a Lambda function, it may not be efficient or cost-effective to permanently configure provisioned concurrency on the Lambda function. Unfortunately, this means on the rare occasions that the Terraform workload does need to be run, there is a risk of a cold start, which could result in an
aws_lambda_invocation
timeout and ultimately a failure of the entire Terraform run - all of which could have easily been contained and handled by theaws_lambda_invocation
by retrying the request.Implementation suggestions
For inspiration, the
hashicorp/http
provider'shttp
data source supports aretry
configuration block.Affected Resource(s) and/or Data Source(s)
Potential Terraform Configuration
References
Would you like to implement a fix?
Yes