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

Use resource.Retry for route creation and deletion #6225

Merged
merged 2 commits into from
Apr 19, 2016

Conversation

RevCBH
Copy link
Contributor

@RevCBH RevCBH commented Apr 18, 2016

Retry logic for creation/deletion of aws_route resources. The retry structure is cribbed from https://github.com/hashicorp/terraform/pull/3061/files. Not sure if there's a good way to test this, but it appears to correct the intermittent failure I was seeing when creating routes across peered VPCs.

@@ -152,7 +155,27 @@ func resourceAwsRouteCreate(d *schema.ResourceData, meta interface{}) error {
log.Printf("[DEBUG] Route create config: %s", createOpts)

// Create the route
_, err := conn.CreateRoute(createOpts)
var out *ec2.CreateRouteOutput
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it doesn't look like we use out here; it's used in conn.CreateRoute but then never after that, safe to remove?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, good catch, was just an artifact of copy/pasting.

@catsby
Copy link
Contributor

catsby commented Apr 19, 2016

Looks solid! Can you give me an example of an InvalidParameterException type error that would happen in CREATE that would resolve with retries?

Thanks!

@catsby catsby added the waiting-response An issue/pull request is waiting for a response from the community label Apr 19, 2016
@RevCBH
Copy link
Contributor Author

RevCBH commented Apr 19, 2016

I believe the specific case I was running into was due to eventual consistency with route table creation (so RouteTableId) was invalid. The weird part was that when I went to terraform apply a second time, it would fail because the route already existed (i.e. it got created even though the API reported a failure).

I'm not 100% sure that this is what was happening, but it looked very much like a race-condition/eventual-consistency issue. I was seeing failures about 80% of the time without this change. Sorry for the voodoo-style analysis, but I wasn't able to get a lot of debugging information about the error. Since running with the change locally, I haven't seen the failure over the course of 10s of runs.

@catsby
Copy link
Contributor

catsby commented Apr 19, 2016

That's cool, I was just curious if you knew off hand what kind of things would happen there

@catsby
Copy link
Contributor

catsby commented Apr 19, 2016

acc tests pass, merging, thanks!

@catsby catsby merged commit e108275 into hashicorp:master Apr 19, 2016
@RevCBH RevCBH deleted the aws-retry-route branch April 20, 2016 17:24
@ghost
Copy link

ghost commented Apr 26, 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 26, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement provider/aws waiting-response An issue/pull request is waiting for a response from the community
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants