provider/aws: internetgateway timing tweaks (again) (#7447)

This workaround is originally from 71b30c633f.
According to the commit message from Mitchell Hashimoto:

    So I think the AWS API is just broken here. In the case that the state
    doesn't update, just assume it did after 5 seconds.

Based on my experience, this AWS API is still broken in the same way.

The timeout was later increased from 5 seconds to 10 seconds in
265cc4fffa.

The timeout (but not the timer) was removed inexplicably in GH-1325.

The symptom is this error from `terraform apply`:

    aws_internet_gateway.test: Error waiting for internet gateway (igw-553b4731) to attach: timeout while waiting for state to become '[available]'

followed by all subsequent `terraform apply` commands failing with this error:

    aws_internet_gateway.test: Resource.AlreadyAssociated: resource igw-553b4731 is already attached to network vpc-61bc7606
This commit is contained in:
David Tolnay 2016-07-07 13:45:28 -07:00 committed by Clint
parent 2943a1c978
commit a86d766bd2
1 changed files with 4 additions and 0 deletions

View File

@ -319,6 +319,10 @@ func IGAttachStateRefreshFunc(conn *ec2.EC2, id string, expected string) resourc
ig := resp.InternetGateways[0]
if time.Now().Sub(start) > 10*time.Second {
return ig, expected, nil
}
if len(ig.Attachments) == 0 {
// No attachments, we're detached
return ig, "detached", nil