Skip to content

Commit

Permalink
fix the bug fix
Browse files Browse the repository at this point in the history
  • Loading branch information
tcarreira committed May 26, 2022
1 parent a8a0d32 commit a00d390
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
3 changes: 1 addition & 2 deletions internal/provider/resource_rpaas_block.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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
}
}
Expand Down
3 changes: 1 addition & 2 deletions internal/provider/resource_rpaas_route.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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 {
Expand All @@ -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
}
}
Expand Down

0 comments on commit a00d390

Please sign in to comment.