Skip to content

Commit

Permalink
Merge pull request #22713 from ialidzhikov/fix/igw-not-found-checks
Browse files Browse the repository at this point in the history
r/internet_gateway: Prevent giving up on wait for attachement too early
  • Loading branch information
ewbankkit committed Jan 21, 2022
2 parents 99ce18e + cacfa08 commit de458c3
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
3 changes: 3 additions & 0 deletions .changelog/22713.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:bug
resource/aws_internet_gateway: No longer give up before the attachment timeout (4m) is exceeded (previously it was giving up after 20 not found checks).
```
13 changes: 7 additions & 6 deletions internal/service/ec2/wait.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ const (
RouteNotFoundChecks = 1000 // Should exceed any reasonable custom timeout value.
RouteTableNotFoundChecks = 1000 // Should exceed any reasonable custom timeout value.
RouteTableAssociationCreatedNotFoundChecks = 1000 // Should exceed any reasonable custom timeout value.

SecurityGroupNotFoundChecks = 1000 // Should exceed any reasonable custom timeout value.
SecurityGroupNotFoundChecks = 1000 // Should exceed any reasonable custom timeout value.
InternetGatewayNotFoundChecks = 1000 // Should exceed any reasonable custom timeout value.
)

const (
Expand Down Expand Up @@ -1148,10 +1148,11 @@ const (

func WaitInternetGatewayAttached(conn *ec2.EC2, internetGatewayID, vpcID string, timeout time.Duration) (*ec2.InternetGatewayAttachment, error) {
stateConf := &resource.StateChangeConf{
Pending: []string{ec2.AttachmentStatusAttaching},
Target: []string{InternetGatewayAttachmentStateAvailable},
Timeout: timeout,
Refresh: StatusInternetGatewayAttachmentState(conn, internetGatewayID, vpcID),
Pending: []string{ec2.AttachmentStatusAttaching},
Target: []string{InternetGatewayAttachmentStateAvailable},
Timeout: timeout,
NotFoundChecks: InternetGatewayNotFoundChecks,
Refresh: StatusInternetGatewayAttachmentState(conn, internetGatewayID, vpcID),
}

outputRaw, err := stateConf.WaitForState()
Expand Down

0 comments on commit de458c3

Please sign in to comment.