diff --git a/internal/provider/resource_rpaas_autoscale.go b/internal/provider/resource_rpaas_autoscale.go index 5cdd8d9..8a0c9cc 100644 --- a/internal/provider/resource_rpaas_autoscale.go +++ b/internal/provider/resource_rpaas_autoscale.go @@ -16,9 +16,9 @@ import ( func resourceRpaasAutoscale() *schema.Resource { return &schema.Resource{ - CreateContext: resourceRpaasAutoscaleUpdate, + CreateContext: resourceRpaasAutoscaleUpsert, ReadContext: resourceRpaasAutoscaleRead, - UpdateContext: resourceRpaasAutoscaleUpdate, + UpdateContext: resourceRpaasAutoscaleUpsert, DeleteContext: resourceRpaasAutoscaleDelete, Importer: &schema.ResourceImporter{ StateContext: schema.ImportStatePassthroughContext, @@ -56,8 +56,7 @@ func resourceRpaasAutoscale() *schema.Resource { } } -func resourceRpaasAutoscaleUpdate(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { - // Create or Update +func resourceRpaasAutoscaleUpsert(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { provider := meta.(*rpaasProvider) instance := d.Get("instance").(string) @@ -85,7 +84,7 @@ func resourceRpaasAutoscaleUpdate(ctx context.Context, d *schema.ResourceData, m } err = rpaasRetry(ctx, d, func() error { - return rpaasClient.UpdateAutoscale(ctx, args) + return rpaasClient.UpdateAutoscale(ctx, args) // UpdateAutoscale is really an Upsert }) if err != nil { diff --git a/internal/provider/resource_rpaas_block.go b/internal/provider/resource_rpaas_block.go index dba2a61..047c6d8 100644 --- a/internal/provider/resource_rpaas_block.go +++ b/internal/provider/resource_rpaas_block.go @@ -20,9 +20,9 @@ var validBlocks = []string{"root", "http", "server", "lua-server", "lua-worker"} func resourceRpaasBlock() *schema.Resource { return &schema.Resource{ - CreateContext: resourceRpaasBlockCreate, + CreateContext: resourceRpaasBlockUpsert, ReadContext: resourceRpaasBlockRead, - UpdateContext: resourceRpaasBlockCreate, + UpdateContext: resourceRpaasBlockUpsert, DeleteContext: resourceRpaasBlockDelete, Importer: &schema.ResourceImporter{ StateContext: schema.ImportStatePassthroughContext, @@ -66,7 +66,7 @@ func resourceRpaasBlock() *schema.Resource { } } -func resourceRpaasBlockCreate(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { +func resourceRpaasBlockUpsert(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { provider := meta.(*rpaasProvider) instance := d.Get("instance").(string) @@ -85,7 +85,7 @@ func resourceRpaasBlockCreate(ctx context.Context, d *schema.ResourceData, meta } err = rpaasRetry(ctx, d, func() error { - return rpaasClient.UpdateBlock(ctx, args) + return rpaasClient.UpdateBlock(ctx, args) // UpdateBlock is really an Upsert }) if err != nil { diff --git a/internal/provider/resource_rpaas_route.go b/internal/provider/resource_rpaas_route.go index f63ccf5..8e80e3e 100644 --- a/internal/provider/resource_rpaas_route.go +++ b/internal/provider/resource_rpaas_route.go @@ -17,9 +17,9 @@ import ( func resourceRpaasRoute() *schema.Resource { return &schema.Resource{ - CreateContext: resourceRpaasRouteCreate, + CreateContext: resourceRpaasRouteUpsert, ReadContext: resourceRpaasRouteRead, - UpdateContext: resourceRpaasRouteCreate, + UpdateContext: resourceRpaasRouteUpsert, DeleteContext: resourceRpaasRouteDelete, Importer: &schema.ResourceImporter{ StateContext: schema.ImportStatePassthroughContext, @@ -66,7 +66,7 @@ func resourceRpaasRoute() *schema.Resource { } } -func resourceRpaasRouteCreate(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { +func resourceRpaasRouteUpsert(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { provider := meta.(*rpaasProvider) serviceName := d.Get("service_name").(string) @@ -93,7 +93,7 @@ func resourceRpaasRouteCreate(ctx context.Context, d *schema.ResourceData, meta } err = rpaasRetry(ctx, d, func() error { - return rpaasClient.UpdateRoute(ctx, args) + return rpaasClient.UpdateRoute(ctx, args) // UpdateRoute is really an Upsert }) if err != nil { return diag.Errorf("Unable to create/update route %s for instance %s: %v", path, instance, err)