diff --git a/internal/provider/resource_rpaas_block.go b/internal/provider/resource_rpaas_block.go index 39ed967..dba2a61 100644 --- a/internal/provider/resource_rpaas_block.go +++ b/internal/provider/resource_rpaas_block.go @@ -107,7 +107,6 @@ func resourceRpaasBlockRead(ctx context.Context, d *schema.ResourceData, meta in d.SetId(fmt.Sprintf("%s::%s::%s", serviceName, instance, blockName)) d.Set("instance", instance) d.Set("service_name", serviceName) - d.Set("name", blockName) rpaasClient, err := provider.RpaasClient.SetService(serviceName) if err != nil { @@ -127,13 +126,13 @@ func resourceRpaasBlockRead(ctx context.Context, d *schema.ResourceData, meta in return diag.Errorf("This resource was created with a old buggy version of the provider. There are multiple blocks and it is not possible to figure out which one should be used. You must resolve it manually") } else if blockName == "" && len(blocks) == 1 { blockName = blocks[0].Name - d.SetId(fmt.Sprintf("%s::%s::%s", serviceName, instance, blockName)) } for _, b := range blocks { if b.Name == blockName { d.Set("name", b.Name) d.Set("content", b.Content) + d.SetId(fmt.Sprintf("%s::%s::%s", serviceName, instance, blockName)) return nil } } diff --git a/internal/provider/resource_rpaas_route.go b/internal/provider/resource_rpaas_route.go index ea2651e..f63ccf5 100644 --- a/internal/provider/resource_rpaas_route.go +++ b/internal/provider/resource_rpaas_route.go @@ -113,7 +113,6 @@ func resourceRpaasRouteRead(ctx context.Context, d *schema.ResourceData, meta in d.Set("instance", instance) d.Set("service_name", serviceName) - d.Set("path", path) rpaasClient, err := provider.RpaasClient.SetService(serviceName) if err != nil { @@ -133,7 +132,6 @@ func resourceRpaasRouteRead(ctx context.Context, d *schema.ResourceData, meta in return diag.Errorf("This resource was created with a old buggy version of the provider. There are multiple routes and it is not possible to figure out which one should be used. You must resolve it manually") } else if path == "" && len(routes) == 1 { path = routes[0].Path - d.SetId(fmt.Sprintf("%s::%s::%s", serviceName, instance, path)) } for _, b := range routes { @@ -142,6 +140,7 @@ func resourceRpaasRouteRead(ctx context.Context, d *schema.ResourceData, meta in d.Set("https_only", b.HTTPSOnly) d.Set("destination", b.Destination) d.Set("content", b.Content) + d.SetId(fmt.Sprintf("%s::%s::%s", serviceName, instance, path)) return nil } }