Skip to content

Commit ef230dc

Browse files
Revert storage mover validation changes from storage discovery PR
Remove Storage Mover name validation changes - these belong in a separate PR.
1 parent f8ccc4a commit ef230dc

File tree

7 files changed

+36
-47
lines changed

7 files changed

+36
-47
lines changed

internal/services/storagemover/storage_mover_agent_resource.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ import (
1414
"github.com/hashicorp/go-azure-sdk/resource-manager/storagemover/2023-03-01/storagemovers"
1515
"github.com/hashicorp/terraform-provider-azurerm/internal/sdk"
1616
computevalidate "github.com/hashicorp/terraform-provider-azurerm/internal/services/compute/validate"
17-
"github.com/hashicorp/terraform-provider-azurerm/internal/services/storagemover/validate"
1817
"github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk"
1918
"github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation"
2019
)
@@ -49,7 +48,7 @@ func (r StorageMoverAgentResource) Arguments() map[string]*pluginsdk.Schema {
4948
Type: pluginsdk.TypeString,
5049
Required: true,
5150
ForceNew: true,
52-
ValidateFunc: validate.StorageMoverResourceName,
51+
ValidateFunc: validation.StringIsNotEmpty,
5352
},
5453

5554
"arc_virtual_machine_id": {

internal/services/storagemover/storage_mover_job_definition_resource.go

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,14 @@ package storagemover
66
import (
77
"context"
88
"fmt"
9+
"regexp"
910
"time"
1011

1112
"github.com/hashicorp/go-azure-helpers/lang/pointer"
1213
"github.com/hashicorp/go-azure-helpers/lang/response"
1314
"github.com/hashicorp/go-azure-sdk/resource-manager/storagemover/2025-07-01/jobdefinitions"
1415
"github.com/hashicorp/go-azure-sdk/resource-manager/storagemover/2025-07-01/projects"
1516
"github.com/hashicorp/terraform-provider-azurerm/internal/sdk"
16-
"github.com/hashicorp/terraform-provider-azurerm/internal/services/storagemover/validate"
1717
"github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk"
1818
"github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation"
1919
)
@@ -49,10 +49,13 @@ func (r StorageMoverJobDefinitionResource) IDValidationFunc() pluginsdk.SchemaVa
4949
func (r StorageMoverJobDefinitionResource) Arguments() map[string]*pluginsdk.Schema {
5050
return map[string]*pluginsdk.Schema{
5151
"name": {
52-
Type: pluginsdk.TypeString,
53-
Required: true,
54-
ForceNew: true,
55-
ValidateFunc: validate.StorageMoverResourceName,
52+
Type: pluginsdk.TypeString,
53+
Required: true,
54+
ForceNew: true,
55+
ValidateFunc: validation.StringMatch(
56+
regexp.MustCompile(`^[0-9a-zA-Z][-_0-9a-zA-Z]{0,63}$`),
57+
`The name must be between 1 and 64 characters in length, begin with a letter or number, and may contain letters, numbers, dashes and underscore.`,
58+
),
5659
},
5760

5861
"storage_mover_project_id": {

internal/services/storagemover/storage_mover_project_resource.go

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,14 @@ package storagemover
66
import (
77
"context"
88
"fmt"
9+
"regexp"
910
"time"
1011

1112
"github.com/hashicorp/go-azure-helpers/lang/pointer"
1213
"github.com/hashicorp/go-azure-helpers/lang/response"
1314
"github.com/hashicorp/go-azure-sdk/resource-manager/storagemover/2025-07-01/projects"
1415
"github.com/hashicorp/go-azure-sdk/resource-manager/storagemover/2025-07-01/storagemovers"
1516
"github.com/hashicorp/terraform-provider-azurerm/internal/sdk"
16-
"github.com/hashicorp/terraform-provider-azurerm/internal/services/storagemover/validate"
1717
"github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk"
1818
"github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation"
1919
)
@@ -43,10 +43,13 @@ func (r StorageMoverProjectResource) IDValidationFunc() pluginsdk.SchemaValidate
4343
func (r StorageMoverProjectResource) Arguments() map[string]*pluginsdk.Schema {
4444
return map[string]*pluginsdk.Schema{
4545
"name": {
46-
Type: pluginsdk.TypeString,
47-
Required: true,
48-
ForceNew: true,
49-
ValidateFunc: validate.StorageMoverResourceName,
46+
Type: pluginsdk.TypeString,
47+
Required: true,
48+
ForceNew: true,
49+
ValidateFunc: validation.StringMatch(
50+
regexp.MustCompile(`^[0-9a-zA-Z][-_0-9a-zA-Z]{0,63}$`),
51+
`The name must be between 1 and 64 characters in length, begin with a letter or number, and may contain letters, numbers, dashes and underscore.`,
52+
),
5053
},
5154

5255
"storage_mover_id": {

internal/services/storagemover/storage_mover_resource.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ import (
1313
"github.com/hashicorp/go-azure-helpers/resourcemanager/location"
1414
"github.com/hashicorp/go-azure-sdk/resource-manager/storagemover/2025-07-01/storagemovers"
1515
"github.com/hashicorp/terraform-provider-azurerm/internal/sdk"
16-
"github.com/hashicorp/terraform-provider-azurerm/internal/services/storagemover/validate"
1716
"github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk"
1817
"github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation"
1918
)
@@ -48,7 +47,7 @@ func (r StorageMoverResource) Arguments() map[string]*pluginsdk.Schema {
4847
Type: pluginsdk.TypeString,
4948
Required: true,
5049
ForceNew: true,
51-
ValidateFunc: validate.StorageMoverResourceName,
50+
ValidateFunc: validation.StringIsNotEmpty,
5251
},
5352

5453
"resource_group_name": commonschema.ResourceGroupName(),

internal/services/storagemover/storage_mover_source_endpoint_resource.go

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,14 @@ package storagemover
66
import (
77
"context"
88
"fmt"
9+
"regexp"
910
"time"
1011

1112
"github.com/hashicorp/go-azure-helpers/lang/pointer"
1213
"github.com/hashicorp/go-azure-helpers/lang/response"
1314
"github.com/hashicorp/go-azure-sdk/resource-manager/storagemover/2025-07-01/endpoints"
1415
"github.com/hashicorp/go-azure-sdk/resource-manager/storagemover/2025-07-01/storagemovers"
1516
"github.com/hashicorp/terraform-provider-azurerm/internal/sdk"
16-
"github.com/hashicorp/terraform-provider-azurerm/internal/services/storagemover/validate"
1717
"github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk"
1818
"github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation"
1919
)
@@ -46,10 +46,13 @@ func (r StorageMoverSourceEndpointResource) IDValidationFunc() pluginsdk.SchemaV
4646
func (r StorageMoverSourceEndpointResource) Arguments() map[string]*pluginsdk.Schema {
4747
return map[string]*pluginsdk.Schema{
4848
"name": {
49-
Type: pluginsdk.TypeString,
50-
Required: true,
51-
ForceNew: true,
52-
ValidateFunc: validate.StorageMoverResourceName,
49+
Type: pluginsdk.TypeString,
50+
Required: true,
51+
ForceNew: true,
52+
ValidateFunc: validation.StringMatch(
53+
regexp.MustCompile(`^[0-9a-zA-Z][-_0-9a-zA-Z]{0,63}$`),
54+
`The name must be between 1 and 64 characters in length, begin with a letter or number, and may contain letters, numbers, dashes and underscore.`,
55+
),
5356
},
5457

5558
"storage_mover_id": {

internal/services/storagemover/storage_mover_target_endpoint_resource.go

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ package storagemover
66
import (
77
"context"
88
"fmt"
9+
"regexp"
910
"time"
1011

1112
"github.com/hashicorp/go-azure-helpers/lang/pointer"
@@ -14,8 +15,7 @@ import (
1415
"github.com/hashicorp/go-azure-sdk/resource-manager/storagemover/2025-07-01/endpoints"
1516
"github.com/hashicorp/go-azure-sdk/resource-manager/storagemover/2025-07-01/storagemovers"
1617
"github.com/hashicorp/terraform-provider-azurerm/internal/sdk"
17-
storagevalidate "github.com/hashicorp/terraform-provider-azurerm/internal/services/storage/validate"
18-
storagemovervalidate "github.com/hashicorp/terraform-provider-azurerm/internal/services/storagemover/validate"
18+
"github.com/hashicorp/terraform-provider-azurerm/internal/services/storage/validate"
1919
"github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk"
2020
"github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation"
2121
)
@@ -47,10 +47,13 @@ func (r StorageMoverTargetEndpointResource) IDValidationFunc() pluginsdk.SchemaV
4747
func (r StorageMoverTargetEndpointResource) Arguments() map[string]*pluginsdk.Schema {
4848
return map[string]*pluginsdk.Schema{
4949
"name": {
50-
Type: pluginsdk.TypeString,
51-
Required: true,
52-
ForceNew: true,
53-
ValidateFunc: storagemovervalidate.StorageMoverResourceName,
50+
Type: pluginsdk.TypeString,
51+
Required: true,
52+
ForceNew: true,
53+
ValidateFunc: validation.StringMatch(
54+
regexp.MustCompile(`^[0-9a-zA-Z][-_0-9a-zA-Z]{0,63}$`),
55+
`The name must be between 1 and 64 characters in length, begin with a letter or number, and may contain letters, numbers, dashes and underscore.`,
56+
),
5457
},
5558

5659
"storage_mover_id": {
@@ -71,7 +74,7 @@ func (r StorageMoverTargetEndpointResource) Arguments() map[string]*pluginsdk.Sc
7174
Type: pluginsdk.TypeString,
7275
Required: true,
7376
ForceNew: true,
74-
ValidateFunc: storagevalidate.StorageContainerName,
77+
ValidateFunc: validate.StorageContainerName,
7578
},
7679

7780
"description": {

internal/services/storagemover/validate/name.go

Lines changed: 0 additions & 21 deletions
This file was deleted.

0 commit comments

Comments
 (0)