Skip to content

Commit

Permalink
Merge pull request #15594 from hashicorp/r/resource-group-schema
Browse files Browse the repository at this point in the history
refactor: switching usages of `SchemaResourceGroupNameForDataSource` to commonschema
  • Loading branch information
tombuildsstuff authored Feb 25, 2022
2 parents 8a2e8c0 + c75b2d3 commit f232d0a
Show file tree
Hide file tree
Showing 146 changed files with 266 additions and 197 deletions.
1 change: 1 addition & 0 deletions helpers/azure/resource_group.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ func SchemaResourceGroupNameDiffSuppress() *pluginsdk.Schema {
}
}

// Deprecated: use `commonschema.ResourceGroupNameForDataSource()` instead
func SchemaResourceGroupNameForDataSource() *pluginsdk.Schema {
return &pluginsdk.Schema{
Type: pluginsdk.TypeString,
Expand Down
4 changes: 2 additions & 2 deletions internal/services/aadb2c/aadb2c_directory_data_source.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"net/http"
"time"

"github.com/hashicorp/terraform-provider-azurerm/helpers/azure"
"github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema"
"github.com/hashicorp/terraform-provider-azurerm/internal/sdk"
"github.com/hashicorp/terraform-provider-azurerm/internal/services/aadb2c/sdk/2021-04-01-preview/tenants"
"github.com/hashicorp/terraform-provider-azurerm/internal/services/aadb2c/validate"
Expand Down Expand Up @@ -51,7 +51,7 @@ func (r AadB2cDirectoryDataSource) Arguments() map[string]*pluginsdk.Schema {
ValidateFunc: validation.StringIsNotEmpty,
},

"resource_group_name": azure.SchemaResourceGroupNameForDataSource(),
"resource_group_name": commonschema.ResourceGroupNameForDataSource(),
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"time"

"github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2021-08-01/apimanagement"
"github.com/hashicorp/terraform-provider-azurerm/helpers/azure"
"github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema"
"github.com/hashicorp/terraform-provider-azurerm/internal/clients"
"github.com/hashicorp/terraform-provider-azurerm/internal/services/apimanagement/parse"
"github.com/hashicorp/terraform-provider-azurerm/internal/services/apimanagement/schemaz"
Expand Down Expand Up @@ -33,7 +33,7 @@ func dataSourceApiManagementApi() *pluginsdk.Resource {

"api_management_name": schemaz.SchemaApiManagementDataSourceName(),

"resource_group_name": azure.SchemaResourceGroupNameForDataSource(),
"resource_group_name": commonschema.ResourceGroupNameForDataSource(),

"revision": {
Type: pluginsdk.TypeString,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"fmt"
"time"

"github.com/hashicorp/terraform-provider-azurerm/helpers/azure"
"github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema"
"github.com/hashicorp/terraform-provider-azurerm/internal/clients"
"github.com/hashicorp/terraform-provider-azurerm/internal/services/apimanagement/parse"
"github.com/hashicorp/terraform-provider-azurerm/internal/services/apimanagement/schemaz"
Expand All @@ -24,7 +24,7 @@ func dataSourceApiManagementApiVersionSet() *pluginsdk.Resource {
Schema: map[string]*pluginsdk.Schema{
"name": schemaz.SchemaApiManagementChildDataSourceName(),

"resource_group_name": azure.SchemaResourceGroupNameForDataSource(),
"resource_group_name": commonschema.ResourceGroupNameForDataSource(),

"api_management_name": schemaz.SchemaApiManagementDataSourceName(),

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"fmt"
"time"

"github.com/hashicorp/terraform-provider-azurerm/helpers/azure"
"github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema"
"github.com/hashicorp/terraform-provider-azurerm/internal/clients"
"github.com/hashicorp/terraform-provider-azurerm/internal/services/apimanagement/parse"
"github.com/hashicorp/terraform-provider-azurerm/internal/services/apimanagement/schemaz"
Expand All @@ -24,7 +24,7 @@ func dataSourceApiManagementGroup() *pluginsdk.Resource {
Schema: map[string]*pluginsdk.Schema{
"name": schemaz.SchemaApiManagementChildDataSourceName(),

"resource_group_name": azure.SchemaResourceGroupNameForDataSource(),
"resource_group_name": commonschema.ResourceGroupNameForDataSource(),

"api_management_name": schemaz.SchemaApiManagementDataSourceName(),

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"fmt"
"time"

"github.com/hashicorp/terraform-provider-azurerm/helpers/azure"
"github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema"
"github.com/hashicorp/terraform-provider-azurerm/internal/clients"
"github.com/hashicorp/terraform-provider-azurerm/internal/services/apimanagement/parse"
"github.com/hashicorp/terraform-provider-azurerm/internal/services/apimanagement/schemaz"
Expand All @@ -26,7 +26,7 @@ func dataSourceApiManagementUser() *pluginsdk.Resource {

"api_management_name": schemaz.SchemaApiManagementDataSourceName(),

"resource_group_name": azure.SchemaResourceGroupNameForDataSource(),
"resource_group_name": commonschema.ResourceGroupNameForDataSource(),

"first_name": {
Type: pluginsdk.TypeString,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ func dataSourceAppConfiguration() *pluginsdk.Resource {
ValidateFunc: validate.ConfigurationStoreName,
},

"resource_group_name": azure.SchemaResourceGroupNameForDataSource(),
"resource_group_name": commonschema.ResourceGroupNameForDataSource(),

"location": azure.SchemaLocationForDataSource(),

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import (
"fmt"
"time"

"github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema"
"github.com/hashicorp/go-azure-helpers/resourcemanager/location"
"github.com/hashicorp/terraform-provider-azurerm/helpers/azure"
"github.com/hashicorp/terraform-provider-azurerm/internal/clients"
"github.com/hashicorp/terraform-provider-azurerm/internal/services/applicationinsights/parse"
"github.com/hashicorp/terraform-provider-azurerm/internal/tags"
Expand All @@ -24,7 +24,7 @@ func dataSourceApplicationInsights() *pluginsdk.Resource {
},

Schema: map[string]*pluginsdk.Schema{
"resource_group_name": azure.SchemaResourceGroupNameForDataSource(),
"resource_group_name": commonschema.ResourceGroupNameForDataSource(),

"name": {
Type: pluginsdk.TypeString,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import (
"github.com/Azure/azure-sdk-for-go/services/web/mgmt/2021-02-01/web"
"github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema"
"github.com/hashicorp/go-azure-helpers/resourcemanager/location"
"github.com/hashicorp/terraform-provider-azurerm/helpers/azure"
"github.com/hashicorp/terraform-provider-azurerm/internal/sdk"
"github.com/hashicorp/terraform-provider-azurerm/internal/services/appservice/helpers"
"github.com/hashicorp/terraform-provider-azurerm/internal/services/appservice/parse"
Expand Down Expand Up @@ -78,7 +77,7 @@ func (d LinuxFunctionAppDataSource) Arguments() map[string]*pluginsdk.Schema {
ValidateFunc: validate.WebAppName,
},

"resource_group_name": azure.SchemaResourceGroupNameForDataSource(),
"resource_group_name": commonschema.ResourceGroupNameForDataSource(),
}
}

Expand Down
3 changes: 1 addition & 2 deletions internal/services/appservice/linux_web_app_data_source.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import (

"github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema"
"github.com/hashicorp/go-azure-helpers/resourcemanager/location"
"github.com/hashicorp/terraform-provider-azurerm/helpers/azure"
"github.com/hashicorp/terraform-provider-azurerm/internal/sdk"
"github.com/hashicorp/terraform-provider-azurerm/internal/services/appservice/helpers"
"github.com/hashicorp/terraform-provider-azurerm/internal/services/appservice/parse"
Expand Down Expand Up @@ -68,7 +67,7 @@ func (r LinuxWebAppDataSource) Arguments() map[string]*pluginsdk.Schema {
ValidateFunc: validate.WebAppName,
},

"resource_group_name": azure.SchemaResourceGroupNameForDataSource(),
"resource_group_name": commonschema.ResourceGroupNameForDataSource(),
}
}

Expand Down
3 changes: 1 addition & 2 deletions internal/services/appservice/service_plan_data_source.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import (

"github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema"
"github.com/hashicorp/go-azure-helpers/resourcemanager/location"
"github.com/hashicorp/terraform-provider-azurerm/helpers/azure"
"github.com/hashicorp/terraform-provider-azurerm/internal/sdk"
"github.com/hashicorp/terraform-provider-azurerm/internal/services/appservice/parse"
"github.com/hashicorp/terraform-provider-azurerm/internal/services/appservice/validate"
Expand Down Expand Up @@ -51,7 +50,7 @@ func (r ServicePlanDataSource) Arguments() map[string]*pluginsdk.Schema {
ValidateFunc: validate.ServicePlanName,
},

"resource_group_name": azure.SchemaResourceGroupNameForDataSource(),
"resource_group_name": commonschema.ResourceGroupNameForDataSource(),
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import (
"github.com/Azure/azure-sdk-for-go/services/web/mgmt/2021-02-01/web"
"github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema"
"github.com/hashicorp/go-azure-helpers/resourcemanager/location"
"github.com/hashicorp/terraform-provider-azurerm/helpers/azure"
"github.com/hashicorp/terraform-provider-azurerm/internal/sdk"
"github.com/hashicorp/terraform-provider-azurerm/internal/services/appservice/helpers"
"github.com/hashicorp/terraform-provider-azurerm/internal/services/appservice/parse"
Expand Down Expand Up @@ -76,7 +75,7 @@ func (d WindowsFunctionAppDataSource) Arguments() map[string]*pluginsdk.Schema {
ValidateFunc: validate.WebAppName,
},

"resource_group_name": azure.SchemaResourceGroupNameForDataSource(),
"resource_group_name": commonschema.ResourceGroupNameForDataSource(),
}
}

Expand Down
3 changes: 1 addition & 2 deletions internal/services/appservice/windows_web_app_data_source.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import (

"github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema"
"github.com/hashicorp/go-azure-helpers/resourcemanager/location"
"github.com/hashicorp/terraform-provider-azurerm/helpers/azure"
"github.com/hashicorp/terraform-provider-azurerm/internal/sdk"
"github.com/hashicorp/terraform-provider-azurerm/internal/services/appservice/helpers"
"github.com/hashicorp/terraform-provider-azurerm/internal/services/appservice/parse"
Expand Down Expand Up @@ -66,7 +65,7 @@ func (d WindowsWebAppDataSource) Arguments() map[string]*pluginsdk.Schema {
ValidateFunc: validate.WebAppName,
},

"resource_group_name": azure.SchemaResourceGroupNameForDataSource(),
"resource_group_name": commonschema.ResourceGroupNameForDataSource(),
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ func dataSourceAttestationProvider() *pluginsdk.Resource {
Required: true,
},

"resource_group_name": azure.SchemaResourceGroupNameForDataSource(),
"resource_group_name": commonschema.ResourceGroupNameForDataSource(),

"location": azure.SchemaLocationForDataSource(),

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"fmt"
"time"

"github.com/hashicorp/terraform-provider-azurerm/helpers/azure"
"github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema"
"github.com/hashicorp/terraform-provider-azurerm/internal/clients"
"github.com/hashicorp/terraform-provider-azurerm/internal/services/automation/parse"
"github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk"
Expand All @@ -26,7 +26,7 @@ func dataSourceAutomationAccount() *pluginsdk.Resource {
Required: true,
},

"resource_group_name": azure.SchemaResourceGroupNameForDataSource(),
"resource_group_name": commonschema.ResourceGroupNameForDataSource(),

"primary_key": {
Type: pluginsdk.TypeString,
Expand Down
3 changes: 2 additions & 1 deletion internal/services/batch/batch_account_data_source.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"time"

"github.com/Azure/azure-sdk-for-go/services/batch/mgmt/2021-06-01/batch"
"github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema"
"github.com/hashicorp/terraform-provider-azurerm/helpers/azure"
"github.com/hashicorp/terraform-provider-azurerm/internal/clients"
"github.com/hashicorp/terraform-provider-azurerm/internal/services/batch/parse"
Expand All @@ -29,7 +30,7 @@ func dataSourceBatchAccount() *pluginsdk.Resource {
Required: true,
ValidateFunc: validate.AccountName,
},
"resource_group_name": azure.SchemaResourceGroupNameForDataSource(),
"resource_group_name": commonschema.ResourceGroupNameForDataSource(),
"location": azure.SchemaLocationForDataSource(),
"storage_account_id": {
Type: pluginsdk.TypeString,
Expand Down
4 changes: 2 additions & 2 deletions internal/services/batch/batch_application_data_source.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"fmt"
"time"

"github.com/hashicorp/terraform-provider-azurerm/helpers/azure"
"github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema"
"github.com/hashicorp/terraform-provider-azurerm/internal/clients"
"github.com/hashicorp/terraform-provider-azurerm/internal/services/batch/parse"
"github.com/hashicorp/terraform-provider-azurerm/internal/services/batch/validate"
Expand All @@ -28,7 +28,7 @@ func dataSourceBatchApplication() *pluginsdk.Resource {
ValidateFunc: validate.ApplicationName,
},

"resource_group_name": azure.SchemaResourceGroupNameForDataSource(),
"resource_group_name": commonschema.ResourceGroupNameForDataSource(),

"account_name": {
Type: pluginsdk.TypeString,
Expand Down
4 changes: 2 additions & 2 deletions internal/services/batch/batch_certificate_data_source.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"fmt"
"time"

"github.com/hashicorp/terraform-provider-azurerm/helpers/azure"
"github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema"
"github.com/hashicorp/terraform-provider-azurerm/internal/clients"
"github.com/hashicorp/terraform-provider-azurerm/internal/services/batch/parse"
"github.com/hashicorp/terraform-provider-azurerm/internal/services/batch/validate"
Expand Down Expand Up @@ -34,7 +34,7 @@ func dataSourceBatchCertificate() *pluginsdk.Resource {
ValidateFunc: validate.AccountName,
},

"resource_group_name": azure.SchemaResourceGroupNameForDataSource(),
"resource_group_name": commonschema.ResourceGroupNameForDataSource(),

"public_data": {
Type: pluginsdk.TypeString,
Expand Down
4 changes: 2 additions & 2 deletions internal/services/batch/batch_pool_data_source.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"fmt"
"time"

"github.com/hashicorp/terraform-provider-azurerm/helpers/azure"
"github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema"
"github.com/hashicorp/terraform-provider-azurerm/internal/clients"
"github.com/hashicorp/terraform-provider-azurerm/internal/services/batch/parse"
"github.com/hashicorp/terraform-provider-azurerm/internal/services/batch/validate"
Expand All @@ -27,7 +27,7 @@ func dataSourceBatchPool() *pluginsdk.Resource {
Required: true,
ValidateFunc: validate.PoolName,
},
"resource_group_name": azure.SchemaResourceGroupNameForDataSource(),
"resource_group_name": commonschema.ResourceGroupNameForDataSource(),
"account_name": {
Type: pluginsdk.TypeString,
Required: true,
Expand Down
3 changes: 2 additions & 1 deletion internal/services/cdn/cdn_profile_data_source.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"fmt"
"time"

"github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema"
"github.com/hashicorp/terraform-provider-azurerm/helpers/azure"
"github.com/hashicorp/terraform-provider-azurerm/internal/clients"
"github.com/hashicorp/terraform-provider-azurerm/internal/services/cdn/parse"
Expand All @@ -27,7 +28,7 @@ func dataSourceCdnProfile() *pluginsdk.Resource {
Required: true,
},

"resource_group_name": azure.SchemaResourceGroupNameForDataSource(),
"resource_group_name": commonschema.ResourceGroupNameForDataSource(),

"location": azure.SchemaLocationForDataSource(),

Expand Down
3 changes: 2 additions & 1 deletion internal/services/cognitive/cognitive_account_data_source.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"time"

"github.com/hashicorp/go-azure-helpers/lang/response"
"github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema"
"github.com/hashicorp/go-azure-helpers/resourcemanager/location"
"github.com/hashicorp/terraform-provider-azurerm/helpers/azure"
"github.com/hashicorp/terraform-provider-azurerm/internal/clients"
Expand All @@ -28,7 +29,7 @@ func dataSourceCognitiveAccount() *pluginsdk.Resource {
Required: true,
},

"resource_group_name": azure.SchemaResourceGroupNameForDataSource(),
"resource_group_name": commonschema.ResourceGroupNameForDataSource(),

"location": azure.SchemaLocationForDataSource(),

Expand Down
3 changes: 2 additions & 1 deletion internal/services/compute/availability_set_data_source.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"strings"
"time"

"github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema"
"github.com/hashicorp/terraform-provider-azurerm/helpers/azure"
"github.com/hashicorp/terraform-provider-azurerm/internal/clients"
"github.com/hashicorp/terraform-provider-azurerm/internal/services/compute/parse"
Expand All @@ -25,7 +26,7 @@ func dataSourceAvailabilitySet() *pluginsdk.Resource {
},

Schema: map[string]*pluginsdk.Schema{
"resource_group_name": azure.SchemaResourceGroupNameForDataSource(),
"resource_group_name": commonschema.ResourceGroupNameForDataSource(),

"name": {
Type: pluginsdk.TypeString,
Expand Down
3 changes: 2 additions & 1 deletion internal/services/compute/dedicated_host_data_source.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"fmt"
"time"

"github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema"
"github.com/hashicorp/terraform-provider-azurerm/helpers/azure"
"github.com/hashicorp/terraform-provider-azurerm/internal/clients"
"github.com/hashicorp/terraform-provider-azurerm/internal/services/compute/parse"
Expand Down Expand Up @@ -35,7 +36,7 @@ func dataSourceDedicatedHost() *pluginsdk.Resource {
ValidateFunc: validate.DedicatedHostGroupName(),
},

"resource_group_name": azure.SchemaResourceGroupNameForDataSource(),
"resource_group_name": commonschema.ResourceGroupNameForDataSource(),

"location": azure.SchemaLocationForDataSource(),

Expand Down
4 changes: 2 additions & 2 deletions internal/services/compute/disk_access_data_source.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"fmt"
"time"

"github.com/hashicorp/terraform-provider-azurerm/helpers/azure"
"github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema"
"github.com/hashicorp/terraform-provider-azurerm/internal/clients"
"github.com/hashicorp/terraform-provider-azurerm/internal/services/compute/parse"
"github.com/hashicorp/terraform-provider-azurerm/internal/tags"
Expand All @@ -27,7 +27,7 @@ func dataSourceDiskAccess() *pluginsdk.Resource {
Required: true,
},

"resource_group_name": azure.SchemaResourceGroupNameForDataSource(),
"resource_group_name": commonschema.ResourceGroupNameForDataSource(),

"tags": tags.Schema(),
},
Expand Down
Loading

0 comments on commit f232d0a

Please sign in to comment.