provider/aws: main route table refresh handles VPC being gone [GH-1806]
This commit is contained in:
parent
b085342274
commit
1a2bac7645
|
@ -118,6 +118,8 @@ BUG FIXES:
|
||||||
* provider/aws: Block devices can be encrypted [GH-1718]
|
* provider/aws: Block devices can be encrypted [GH-1718]
|
||||||
* provider/aws: ASG health check grace period can be updated in-place [GH-1682]
|
* provider/aws: ASG health check grace period can be updated in-place [GH-1682]
|
||||||
* provider/aws: ELB security groups can be updated in-place [GH-1662]
|
* provider/aws: ELB security groups can be updated in-place [GH-1662]
|
||||||
|
* provider/aws: `aws_main_route_table_association` can be deleted
|
||||||
|
manually [GH-1806]
|
||||||
* provider/openstack: region config is not required [GH-1441]
|
* provider/openstack: region config is not required [GH-1441]
|
||||||
* provider/openstack: `enable_dhcp` for networking subnet should be bool [GH-1741]
|
* provider/openstack: `enable_dhcp` for networking subnet should be bool [GH-1741]
|
||||||
* provisioner/remote-exec: add random number to uploaded script path so
|
* provisioner/remote-exec: add random number to uploaded script path so
|
||||||
|
|
|
@ -76,7 +76,7 @@ func resourceAwsMainRouteTableAssociationRead(d *schema.ResourceData, meta inter
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
if *mainAssociation.RouteTableAssociationID != d.Id() {
|
if mainAssociation == nil || *mainAssociation.RouteTableAssociationID != d.Id() {
|
||||||
// It seems it doesn't exist anymore, so clear the ID
|
// It seems it doesn't exist anymore, so clear the ID
|
||||||
d.SetId("")
|
d.SetId("")
|
||||||
}
|
}
|
||||||
|
@ -135,6 +135,9 @@ func findMainRouteTableAssociation(conn *ec2.EC2, vpcId string) (*ec2.RouteTable
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
if mainRouteTable == nil {
|
||||||
|
return nil, nil
|
||||||
|
}
|
||||||
|
|
||||||
for _, a := range mainRouteTable.Associations {
|
for _, a := range mainRouteTable.Associations {
|
||||||
if *a.Main {
|
if *a.Main {
|
||||||
|
@ -159,10 +162,7 @@ func findMainRouteTable(conn *ec2.EC2, vpcId string) (*ec2.RouteTable, error) {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
} else if len(routeResp.RouteTables) != 1 {
|
} else if len(routeResp.RouteTables) != 1 {
|
||||||
return nil, fmt.Errorf(
|
return nil, nil
|
||||||
"Expected to find a single main routing table for VPC: %s, but found %d",
|
|
||||||
vpcId,
|
|
||||||
len(routeResp.RouteTables))
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return routeResp.RouteTables[0], nil
|
return routeResp.RouteTables[0], nil
|
||||||
|
|
Loading…
Reference in New Issue