Skip to content

Commit

Permalink
remove resourceid.go, use validate and parse from sdk
Browse files Browse the repository at this point in the history
  • Loading branch information
wuxu92 committed Jul 28, 2023
1 parent 51eb9ef commit 9206a02
Show file tree
Hide file tree
Showing 30 changed files with 13 additions and 1,594 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ import (
keyVaultValidate "github.com/hashicorp/terraform-provider-azurerm/internal/services/keyvault/validate"
loadBalancerParse "github.com/hashicorp/terraform-provider-azurerm/internal/services/loadbalancer/parse"
loadBalancerValidate "github.com/hashicorp/terraform-provider-azurerm/internal/services/loadbalancer/validate"
machineLearningValidate "github.com/hashicorp/terraform-provider-azurerm/internal/services/machinelearning/validate"
resourcesParse "github.com/hashicorp/terraform-provider-azurerm/internal/services/resource/parse"
storageValidate "github.com/hashicorp/terraform-provider-azurerm/internal/services/storage/validate"
"github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk"
Expand Down Expand Up @@ -174,7 +173,7 @@ func resourceDatabricksWorkspace() *pluginsdk.Resource {
Type: pluginsdk.TypeString,
ForceNew: true,
Optional: true,
ValidateFunc: machineLearningValidate.WorkspaceID,
ValidateFunc: workspaces.ValidateWorkspaceID,
AtLeastOneOf: workspaceCustomParametersString(),
},

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ import (
"github.com/hashicorp/terraform-provider-azurerm/helpers/azure"
"github.com/hashicorp/terraform-provider-azurerm/helpers/tf"
"github.com/hashicorp/terraform-provider-azurerm/internal/clients"
"github.com/hashicorp/terraform-provider-azurerm/internal/services/machinelearning/parse"
"github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk"
"github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation"
"github.com/hashicorp/terraform-provider-azurerm/internal/timeouts"
Expand All @@ -30,7 +29,7 @@ func resourceComputeCluster() *pluginsdk.Resource {
Delete: resourceComputeClusterDelete,

Importer: pluginsdk.ImporterValidatingResourceId(func(id string) error {
_, err := parse.ComputeClusterID(id)
_, err := machinelearningcomputes.ParseComputeID(id)
return err
}),

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@ import (
"github.com/hashicorp/terraform-provider-azurerm/helpers/azure"
"github.com/hashicorp/terraform-provider-azurerm/helpers/tf"
"github.com/hashicorp/terraform-provider-azurerm/internal/clients"
"github.com/hashicorp/terraform-provider-azurerm/internal/services/machinelearning/parse"
"github.com/hashicorp/terraform-provider-azurerm/internal/services/machinelearning/validate"
"github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk"
"github.com/hashicorp/terraform-provider-azurerm/internal/tf/suppress"
"github.com/hashicorp/terraform-provider-azurerm/internal/timeouts"
Expand All @@ -37,7 +35,7 @@ func resourceComputeInstance() *pluginsdk.Resource {
Delete: resourceComputeInstanceDelete,

Importer: pluginsdk.ImporterValidatingResourceId(func(id string) error {
_, err := parse.ComputeID(id)
_, err := machinelearningcomputes.ParseComputeID(id)
return err
}),

Expand All @@ -61,7 +59,7 @@ func resourceComputeInstance() *pluginsdk.Resource {
Type: pluginsdk.TypeString,
Required: true,
ForceNew: true,
ValidateFunc: validate.WorkspaceID,
ValidateFunc: workspaces.ValidateWorkspaceID,
},

"location": commonschema.Location(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ func (r MachineLearningDataStoreBlobStorage) Arguments() map[string]*pluginsdk.S
Type: pluginsdk.TypeString,
Required: true,
ForceNew: true,
ValidateFunc: validate.WorkspaceID,
ValidateFunc: workspaces.ValidateWorkspaceID,
},

"storage_container_id": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ func (r MachineLearningDataStoreDataLakeGen2) Arguments() map[string]*pluginsdk.
Type: pluginsdk.TypeString,
Required: true,
ForceNew: true,
ValidateFunc: validate.WorkspaceID,
ValidateFunc: workspaces.ValidateWorkspaceID,
},

"storage_container_id": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ func (r MachineLearningDataStoreFileShare) Arguments() map[string]*pluginsdk.Sch
Type: pluginsdk.TypeString,
Required: true,
ForceNew: true,
ValidateFunc: validate.WorkspaceID,
ValidateFunc: workspaces.ValidateWorkspaceID,
},

"storage_fileshare_id": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@ import (
"github.com/hashicorp/terraform-provider-azurerm/helpers/azure"
"github.com/hashicorp/terraform-provider-azurerm/helpers/tf"
"github.com/hashicorp/terraform-provider-azurerm/internal/clients"
"github.com/hashicorp/terraform-provider-azurerm/internal/services/machinelearning/parse"
"github.com/hashicorp/terraform-provider-azurerm/internal/services/machinelearning/validate"
"github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk"
"github.com/hashicorp/terraform-provider-azurerm/internal/tf/suppress"
"github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation"
Expand All @@ -34,7 +32,7 @@ func resourceAksInferenceCluster() *pluginsdk.Resource {
Delete: resourceAksInferenceClusterDelete,

Importer: pluginsdk.ImporterValidatingResourceId(func(id string) error {
_, err := parse.InferenceClusterID(id)
_, err := machinelearningcomputes.ParseComputeID(id)
return err
}),

Expand All @@ -56,7 +54,7 @@ func resourceAksInferenceCluster() *pluginsdk.Resource {
Type: pluginsdk.TypeString,
Required: true,
ForceNew: true,
ValidateFunc: validate.KubernetesClusterID,
ValidateFunc: managedclusters.ValidateLocationID,
// remove in 3.0 of the provider
DiffSuppressFunc: suppress.CaseDifference,
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@ import (
"github.com/hashicorp/terraform-provider-azurerm/helpers/azure"
"github.com/hashicorp/terraform-provider-azurerm/helpers/tf"
"github.com/hashicorp/terraform-provider-azurerm/internal/clients"
"github.com/hashicorp/terraform-provider-azurerm/internal/services/machinelearning/parse"
"github.com/hashicorp/terraform-provider-azurerm/internal/services/machinelearning/validate"
synapseValidate "github.com/hashicorp/terraform-provider-azurerm/internal/services/synapse/validate"
"github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk"
"github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation"
Expand All @@ -34,7 +32,7 @@ func resourceSynapseSpark() *pluginsdk.Resource {
Delete: resourceSynapseSparkDelete,

Importer: pluginsdk.ImporterValidatingResourceId(func(id string) error {
_, err := parse.ComputeID(id)
_, err := machinelearningcomputes.ParseComputeID(id)
return err
}),

Expand All @@ -58,7 +56,7 @@ func resourceSynapseSpark() *pluginsdk.Resource {
Type: pluginsdk.TypeString,
Required: true,
ForceNew: true,
ValidateFunc: validate.WorkspaceID,
ValidateFunc: workspaces.ValidateWorkspaceID,
},

"location": commonschema.Location(),
Expand Down Expand Up @@ -164,7 +162,7 @@ func resourceSynapseSparkRead(d *pluginsdk.ResourceData, meta interface{}) error
}

d.Set("name", id.ComputeName)
workspaceId := parse.NewWorkspaceID(subscriptionId, id.ResourceGroupName, id.WorkspaceName)
workspaceId := workspaces.NewWorkspaceID(subscriptionId, id.ResourceGroupName, id.WorkspaceName)
d.Set("machine_learning_workspace_id", workspaceId.ID())

if location := resp.Model.Location; location != nil {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ import (
"github.com/hashicorp/terraform-provider-azurerm/internal/clients"
"github.com/hashicorp/terraform-provider-azurerm/internal/features"
appInsightsValidate "github.com/hashicorp/terraform-provider-azurerm/internal/services/applicationinsights/validate"
"github.com/hashicorp/terraform-provider-azurerm/internal/services/machinelearning/parse"
"github.com/hashicorp/terraform-provider-azurerm/internal/services/machinelearning/validate"
storageValidate "github.com/hashicorp/terraform-provider-azurerm/internal/services/storage/validate"
"github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk"
Expand All @@ -43,7 +42,7 @@ func resourceMachineLearningWorkspace() *pluginsdk.Resource {
Delete: resourceMachineLearningWorkspaceDelete,

Importer: pluginsdk.ImporterValidatingResourceId(func(id string) error {
_, err := parse.WorkspaceID(id)
_, err := workspaces.ParseWorkspaceID(id)
return err
}),

Expand Down
78 changes: 0 additions & 78 deletions internal/services/machinelearning/parse/compute.go

This file was deleted.

78 changes: 0 additions & 78 deletions internal/services/machinelearning/parse/compute_cluster.go

This file was deleted.

Loading

0 comments on commit 9206a02

Please sign in to comment.