Give route table assoc it's own copy of this method for now
This commit is contained in:
parent
d2c6ae0741
commit
795970d5a2
|
@ -4,6 +4,7 @@ import (
|
|||
"fmt"
|
||||
"log"
|
||||
|
||||
"github.com/hashicorp/terraform/helper/resource"
|
||||
"github.com/hashicorp/terraform/helper/schema"
|
||||
"github.com/mitchellh/goamz/ec2"
|
||||
)
|
||||
|
@ -129,3 +130,29 @@ func resourceAwsRouteTableAssociationDelete(d *schema.ResourceData, meta interfa
|
|||
|
||||
return nil
|
||||
}
|
||||
|
||||
// TODO: remove this method when converting to aws-sdk-go
|
||||
// resourceAwsRouteTableStateRefreshFunc returns a resource.StateRefreshFunc that is used to watch
|
||||
// a RouteTable.
|
||||
func resourceAwsRouteTableStateRefreshFunc(conn *ec2.EC2, id string) resource.StateRefreshFunc {
|
||||
return func() (interface{}, string, error) {
|
||||
resp, err := conn.DescribeRouteTables([]string{id}, ec2.NewFilter())
|
||||
if err != nil {
|
||||
if ec2err, ok := err.(*ec2.Error); ok && ec2err.Code == "InvalidRouteTableID.NotFound" {
|
||||
resp = nil
|
||||
} else {
|
||||
log.Printf("Error on RouteTableStateRefresh: %s", err)
|
||||
return nil, "", err
|
||||
}
|
||||
}
|
||||
|
||||
if resp == nil {
|
||||
// Sometimes AWS just has consistency issues and doesn't see
|
||||
// our instance yet. Return an empty state.
|
||||
return nil, "", nil
|
||||
}
|
||||
|
||||
rt := &resp.RouteTables[0]
|
||||
return rt, "ready", nil
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue