diff --git a/internal/provider/cluster_resource.go b/internal/provider/cluster_resource.go index 19ed81ae..24a78897 100644 --- a/internal/provider/cluster_resource.go +++ b/internal/provider/cluster_resource.go @@ -219,7 +219,7 @@ func (r clusterResource) Create(ctx context.Context, req tfsdk.CreateResourceReq (plan.ServerlessConfig != nil && plan.DedicatedConfig != nil) { resp.Diagnostics.AddError( "Invalid cluster configuration", - "You must set either 'dedicated' or 'serverless', but not both.", + "You must set either 'dedicated' or 'serverless', but not both", ) } @@ -254,7 +254,7 @@ func (r clusterResource) Create(ctx context.Context, req tfsdk.CreateResourceReq } else { resp.Diagnostics.AddError( "Invalid dedicated cluster configuration", - "A dedicated cluster needs either num_virtual_cpus or machine_type to be set.", + "A dedicated cluster needs either num_virtual_cpus or machine_type to be set", ) } hardware.MachineSpec = machineSpec @@ -288,8 +288,8 @@ func (r clusterResource) Create(ctx context.Context, req tfsdk.CreateResourceReq waitForClusterCreatedFunc(ctx, clusterObj.Id, r.provider.service, clusterObj)) if err != nil { resp.Diagnostics.AddError( - "cluster ready timeout", - fmt.Sprintf("cluster is not ready: %s", formatAPIErrorMessage(err)), + "Cluster creation failed", + fmt.Sprintf("Cluster is not ready: %s", formatAPIErrorMessage(err)), ) return } @@ -425,8 +425,8 @@ func (r clusterResource) Update(ctx context.Context, req tfsdk.UpdateResourceReq waitForClusterCreatedFunc(ctx, clusterObj.Id, r.provider.service, clusterObj)) if err != nil { resp.Diagnostics.AddError( - "cluster ready timeout", - fmt.Sprintf("cluster is not ready: %v %v "+err.Error()), + "Cluster update failed", + fmt.Sprintf("Cluster is not ready: %v %v "+err.Error()), ) return } @@ -445,7 +445,6 @@ func (r clusterResource) Delete(ctx context.Context, req tfsdk.DeleteResourceReq diags := req.State.Get(ctx, &state) resp.Diagnostics.Append(diags...) if resp.Diagnostics.HasError() { - resp.Diagnostics.AddWarning("this is error loading cluster ", "") return } @@ -455,7 +454,6 @@ func (r clusterResource) Delete(ctx context.Context, req tfsdk.DeleteResourceReq } clusterID := state.ID.Value - // Delete order by calling API _, httpResp, err := r.provider.service.DeleteCluster(ctx, clusterID) if err != nil { if httpResp.StatusCode == http.StatusNotFound { diff --git a/internal/provider/cockroach_cluster_data_source.go b/internal/provider/cockroach_cluster_data_source.go index 078058ea..149b5b18 100644 --- a/internal/provider/cockroach_cluster_data_source.go +++ b/internal/provider/cockroach_cluster_data_source.go @@ -186,8 +186,8 @@ func (d clusterDataSource) Read(ctx context.Context, req tfsdk.ReadDataSourceReq } if err != nil { resp.Diagnostics.AddError( - "error in getting cluster", - "") + "Error getting cluster info", + fmt.Sprintf("Unexpected error while retrieving cluster info: %v", formatAPIErrorMessage(err))) } cluster.Name = types.String{Value: cockroachCluster.Name} diff --git a/internal/provider/networking_resource.go b/internal/provider/networking_resource.go index d7f82beb..c9fc982a 100644 --- a/internal/provider/networking_resource.go +++ b/internal/provider/networking_resource.go @@ -126,8 +126,8 @@ func (n allowListResource) Create(ctx context.Context, req tfsdk.CreateResourceR if cluster.Config.Serverless != nil { resp.Diagnostics.AddError( - "Could not add network allow list in serverless cluster", - fmt.Sprintf("Network allow list is a feature of dedicated cluster: %s", formatAPIErrorMessage(err)), + "Could not add network allowlist in serverless cluster", + "Network allowlists are only supported with dedicated clusters", ) return } @@ -221,14 +221,6 @@ func (n allowListResource) Update(ctx context.Context, req tfsdk.UpdateResourceR return } - if state.ClusterId != plan.ClusterId { - resp.Diagnostics.AddError( - "can not change cluster id in the network allow list", - "You can only change network allow list. Thanks!", - ) - return - } - clusterId := plan.ClusterId.Value entryCIDRIp := plan.CidrIp.Value entryCIDRMask := int32(plan.CidrMask.Value) @@ -243,8 +235,8 @@ func (n allowListResource) Update(ctx context.Context, req tfsdk.UpdateResourceR &existingAllowList, &client.UpdateAllowlistEntryOptions{}) if err != nil { resp.Diagnostics.AddError( - "Error updating network allow list", - fmt.Sprintf("Could not update network allow list: %s", formatAPIErrorMessage(err)), + "Error updating network allowlist", + fmt.Sprintf("Could not update network allowlist: %s", formatAPIErrorMessage(err)), ) return } @@ -267,8 +259,8 @@ func (n allowListResource) Delete(ctx context.Context, req tfsdk.DeleteResourceR _, _, err := n.provider.service.DeleteAllowlistEntry(ctx, state.ClusterId.Value, state.CidrIp.Value, int32(state.CidrMask.Value)) if err != nil { resp.Diagnostics.AddError( - "Error deleting network allow list", - fmt.Sprintf("Could not delete network allow list: %s", formatAPIErrorMessage(err)), + "Error deleting network allowlist", + fmt.Sprintf("Could not delete network allowlist: %s", formatAPIErrorMessage(err)), ) return } diff --git a/internal/provider/private_endpoint_connection_resource.go b/internal/provider/private_endpoint_connection_resource.go index 35b2ce14..823bf972 100644 --- a/internal/provider/private_endpoint_connection_resource.go +++ b/internal/provider/private_endpoint_connection_resource.go @@ -128,13 +128,13 @@ func (r privateEndpointConnectionResource) Create(ctx context.Context, req tfsdk if cluster.Config.Serverless != nil { resp.Diagnostics.AddError( "Incompatible cluster type", - "Private endpoint services are only available for dedicated clusters.", + "Private endpoint services are only available for dedicated clusters", ) return } else if cluster.CloudProvider != client.APICLOUDPROVIDER_AWS { resp.Diagnostics.AddError( "Incompatible cluster cloud provider", - "Private endpoint services are only available for AWS clusters.", + "Private endpoint services are only available for AWS clusters", ) return } @@ -164,8 +164,8 @@ func (r privateEndpointConnectionResource) Create(ctx context.Context, req tfsdk waitForEndpointConnectionCreatedFunc(ctx, cluster.Id, plan.EndpointID.Value, r.provider.service, &connection)) if err != nil { resp.Diagnostics.AddError( - "Error enabling private endpoint services", - fmt.Sprintf("Could not enable private endpoint services: %s", formatAPIErrorMessage(err)), + "Error accepting private endpoint connection", + fmt.Sprintf("Could not accept private endpoint connection: %s", formatAPIErrorMessage(err)), ) return } diff --git a/internal/provider/private_endpoint_services_resource.go b/internal/provider/private_endpoint_services_resource.go index 59e76aba..7b5dcd26 100644 --- a/internal/provider/private_endpoint_services_resource.go +++ b/internal/provider/private_endpoint_services_resource.go @@ -135,13 +135,13 @@ func (n privateEndpointServicesResource) Create(ctx context.Context, req tfsdk.C if cluster.Config.Serverless != nil { resp.Diagnostics.AddError( "Incompatible cluster type", - "Private endpoint services are only available for dedicated clusters.", + "Private endpoint services are only available for dedicated clusters", ) return } else if cluster.CloudProvider != client.APICLOUDPROVIDER_AWS { resp.Diagnostics.AddError( "Incompatible cluster cloud provider", - "Private endpoint services are only available for AWS clusters.", + "Private endpoint services are currently only available for AWS clusters", ) return }