From 9d27ae7359b6896b6131753de8d8c2e1f41a4dce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20B=C3=A9rot-Armand?= Date: Thu, 17 Nov 2022 16:12:03 +0000 Subject: [PATCH] Fix route ressource id and test --- outscale/resource_outscale_route.go | 7 ++++--- outscale/resource_outscale_route_test.go | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/outscale/resource_outscale_route.go b/outscale/resource_outscale_route.go index 764897639..7aa13e4c6 100644 --- a/outscale/resource_outscale_route.go +++ b/outscale/resource_outscale_route.go @@ -175,14 +175,15 @@ func resourceOutscaleOAPIRouteCreate(d *schema.ResourceData, meta interface{}) e } } - d.SetId(d.Get("route_table_id").(string)) + d.SetId(d.Get("route_table_id").(string) + "_" + d.Get("destination_ip_range").(string)) + resourceOutscaleOAPIRouteSetResourceData(d, route, requestID) return nil } func resourceOutscaleOAPIRouteRead(d *schema.ResourceData, meta interface{}) error { conn := meta.(*OutscaleClient).OSCAPI - routeTableID := d.Id() + routeTableID := d.Get("route_table_id").(string) destinationIPRange := d.Get("destination_ip_range").(string) var requestID string @@ -499,7 +500,7 @@ func resourceOutscaleOAPIRouteImportState(d *schema.ResourceData, meta interface return nil, fmt.Errorf("error setting `%s` for Outscale Route(%s): %s", "destination_ip_range", destinationIPRange, err) } - d.SetId(routeTableID) + d.SetId(d.Get("route_table_id").(string) + "_" + d.Get("destination_ip_range").(string)) return []*schema.ResourceData{d}, nil } diff --git a/outscale/resource_outscale_route_test.go b/outscale/resource_outscale_route_test.go index f515d8af3..f82a24365 100644 --- a/outscale/resource_outscale_route_test.go +++ b/outscale/resource_outscale_route_test.go @@ -210,7 +210,7 @@ func testAccCheckOutscaleOAPIRouteImportStateIDFunc(resourceName string) resourc if !ok { return "", fmt.Errorf("Not found: %s", resourceName) } - return fmt.Sprintf("%s_%s", rs.Primary.ID, rs.Primary.Attributes["destination_ip_range"]), nil + return rs.Primary.ID, nil } }