Issue #2174 Check that InternetGateway exists before returning from creation (#6105)

* Issue #2174 Check that InternetGateway exists before returning from creation

Fix some random InvalidInternetGatewayID.NotFound errors

* Issue #2174 Reuse IGStateRefreshFunc

* Issue #2174 Need to wait for creation before setting tags
This commit is contained in:
Carlos Sanchez 2016-04-13 16:28:17 +02:00 committed by Clint
parent 65bef82a32
commit 32bd25d743
1 changed files with 12 additions and 0 deletions

View File

@ -45,6 +45,18 @@ func resourceAwsInternetGatewayCreate(d *schema.ResourceData, meta interface{})
d.SetId(*ig.InternetGatewayId) d.SetId(*ig.InternetGatewayId)
log.Printf("[INFO] InternetGateway ID: %s", d.Id()) log.Printf("[INFO] InternetGateway ID: %s", d.Id())
resource.Retry(5*time.Minute, func() *resource.RetryError {
igRaw, _, err := IGStateRefreshFunc(conn, d.Id())()
if igRaw != nil {
return nil
}
if err == nil {
return resource.RetryableError(err)
} else {
return resource.NonRetryableError(err)
}
})
err = setTags(conn, d) err = setTags(conn, d)
if err != nil { if err != nil {
return err return err