fix for aws_lambda_function_event_invoke_config - unexpected format of function resource#14851
Conversation
functionParts := strings.Split(id, ":") -> id is the arn and the length of variable functionParts was always greater then 2 hence if case was always true. modified it to functionParts := strings.Split(function, ":") -> length of variable functionParts will either be 1 or 2 based on if user provides qualifier or not.
|
It looks like this closes #13166. |
yes, it will fix that issue |
Acceptance test for checking Lambda ARN with qualifier
bflad
left a comment
There was a problem hiding this comment.
Looks good, thank you for fixing this and adding the test @nikhil-goenka 🚀
Output from acceptance testing:
--- PASS: TestAccAWSLambdaFunctionEventInvokeConfig_Qualifier_FunctionName_Arn (55.47s)
--- PASS: TestAccAWSLambdaFunctionEventInvokeConfig_basic (55.86s)
--- PASS: TestAccAWSLambdaFunctionEventInvokeConfig_disappears_LambdaFunctionEventInvokeConfig (68.54s)
--- PASS: TestAccAWSLambdaFunctionEventInvokeConfig_disappears_LambdaFunction (70.08s)
--- PASS: TestAccAWSLambdaFunctionEventInvokeConfig_Qualifier_FunctionVersion (72.29s)
--- PASS: TestAccAWSLambdaFunctionEventInvokeConfig_Qualifier_Latest (72.77s)
--- PASS: TestAccAWSLambdaFunctionEventInvokeConfig_FunctionName_Arn (73.41s)
--- PASS: TestAccAWSLambdaFunctionEventInvokeConfig_Qualifier_AliasName (73.64s)
--- PASS: TestAccAWSLambdaFunctionEventInvokeConfig_DestinationConfig_Remove (80.41s)
--- PASS: TestAccAWSLambdaFunctionEventInvokeConfig_MaximumEventAgeInSeconds (86.06s)
--- PASS: TestAccAWSLambdaFunctionEventInvokeConfig_DestinationConfig_Swap (88.02s)
--- PASS: TestAccAWSLambdaFunctionEventInvokeConfig_MaximumRetryAttempts (90.44s)
--- PASS: TestAccAWSLambdaFunctionEventInvokeConfig_DestinationConfig_OnSuccess_Destination (102.11s)
--- PASS: TestAccAWSLambdaFunctionEventInvokeConfig_DestinationConfig_OnFailure_Destination (103.06s)
|
This has been released in version 3.5.0 of the Terraform AWS provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading. For further feature requests or bug reports with this functionality, please create a new GitHub issue following the template for triage. Thanks! |
|
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! |
Lambda Function ARN not supported along with qualifier.
Reason: functionParts := strings.Split(id, ":") -> id is the arn and the length of variable functionParts was always greater then 2 hence if case was always true.
modified it to functionParts := strings.Split(function, ":") -> length of variable functionParts will either be 1 or 2 based on if user provides qualifier or not.
Failed Acceptance test log:
TF_ACC=1 go test ./aws -v -count 1 -parallel 20 -run=TestAccAWSLambdaFunctionEventInvokeConfig_Qualifier_FunctionName_Arn -timeout 120m
=== RUN TestAccAWSLambdaFunctionEventInvokeConfig_Qualifier_FunctionName_Arn
=== PAUSE TestAccAWSLambdaFunctionEventInvokeConfig_Qualifier_FunctionName_Arn
=== CONT TestAccAWSLambdaFunctionEventInvokeConfig_Qualifier_FunctionName_Arn
resource_aws_lambda_function_event_invoke_config_test.go:269: Step 1/2 error: terraform failed: exit status 1
stderr:
Error: unexpected format of function resource (arn:aws:lambda:us-west-2::function:tf-acc-test-:$LATEST), expected n
ame:qualifier
testing_new.go:22: WARNING: destroy failed, so remote objects may still exist and be subject to billing
testing_new.go:22: failed to destroy: terraform failed: exit status 1
stderr:
Error: unexpected format of function resource (arn:aws:lambda:us-west-2::function:tf-acc-test-:$LATEST), expected n
ame:qualifier
--- FAIL: TestAccAWSLambdaFunctionEventInvokeConfig_Qualifier_FunctionName_Arn (86.72s)
FAIL
FAIL github.com/terraform-providers/terraform-provider-aws/aws 89.725s
FAIL
Community Note
Closes #13166
Release note for CHANGELOG:
Output from acceptance testing: