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

helper/resource: Error shouldn't be returned in case of success #5553

Merged
merged 2 commits into from
Mar 10, 2016

Conversation

radeksimko
Copy link
Member

This is fixing a bug that was introduced in #5460

It is easily reproducible by running any acceptance test of a resource which uses resource.Retry, e.g. Lambda function:

make testacc TEST=./builtin/providers/aws TESTARGS='-run=AWSLambdaFunction_basic'
TF_ACC=1 go test ./builtin/providers/aws -v -run=AWSLambdaFunction_basic -timeout 120m
=== RUN   TestAccAWSLambdaFunction_basic
--- FAIL: TestAccAWSLambdaFunction_basic (29.64s)
    testing.go:148: Step 0 error: Error applying: 1 error(s) occurred:

        * aws_lambda_function.lambda_function_test: Error creating Lambda function: InvalidParameterValueException: The role defined for the function cannot be assumed by Lambda.
status code: 400, request id: *REDACTED*
FAIL
exit status 1
FAIL    github.com/hashicorp/terraform/builtin/providers/aws    29.665s
make: *** [testacc] Error 1

Any time API returned error and we retried the request, we also saved the error into resultErr. Then after few retries, even if we received no error, we still returned the resultErr we had from the last failed API call.

radeksimko pushed a commit to MeredithCorpOSS/terraform that referenced this pull request Mar 10, 2016
@phinze
Copy link
Contributor

phinze commented Mar 10, 2016

Great find / fix - thanks @radeksimko

@phinze
Copy link
Contributor

phinze commented Mar 10, 2016

LGTM

phinze added a commit that referenced this pull request Mar 10, 2016
helper/resource: Error shouldn't be returned in case of success
@phinze phinze merged commit cadd0c5 into hashicorp:master Mar 10, 2016
@radeksimko radeksimko deleted the b-fix-retry-err-bug branch March 10, 2016 14:39
@ghost
Copy link

ghost commented Apr 27, 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 27, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants