providers/aws: route tables import assocations
This commit is contained in:
parent
a1035804d4
commit
ab7b5dab2d
|
@ -27,9 +27,11 @@ func resourceAwsRouteTableImportState(
|
||||||
table := resp.RouteTables[0]
|
table := resp.RouteTables[0]
|
||||||
|
|
||||||
// Start building our results
|
// Start building our results
|
||||||
results := make([]*schema.ResourceData, 1, 1+len(table.Routes))
|
results := make([]*schema.ResourceData, 1,
|
||||||
|
1+len(table.Associations)+len(table.Routes))
|
||||||
results[0] = d
|
results[0] = d
|
||||||
|
|
||||||
|
{
|
||||||
// Construct the routes
|
// Construct the routes
|
||||||
subResource := resourceAwsRoute()
|
subResource := resourceAwsRoute()
|
||||||
for _, route := range table.Routes {
|
for _, route := range table.Routes {
|
||||||
|
@ -46,6 +48,25 @@ func resourceAwsRouteTableImportState(
|
||||||
d.SetId(routeIDHash(d, route))
|
d.SetId(routeIDHash(d, route))
|
||||||
results = append(results, d)
|
results = append(results, d)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
// Construct the associations
|
||||||
|
subResource := resourceAwsRouteTableAssociation()
|
||||||
|
for _, assoc := range table.Associations {
|
||||||
|
if *assoc.Main {
|
||||||
|
// Ignore
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
// Minimal data for route
|
||||||
|
d := subResource.Data(nil)
|
||||||
|
d.SetType("aws_route_table_association")
|
||||||
|
d.Set("route_table_id", assoc.RouteTableId)
|
||||||
|
d.SetId(*assoc.RouteTableAssociationId)
|
||||||
|
results = append(results, d)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return results, nil
|
return results, nil
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue