diff --git a/internal/provider/provider_schema_test.go b/internal/provider/provider_schema_test.go index da7a0c18e9cb..7862e81102ce 100644 --- a/internal/provider/provider_schema_test.go +++ b/internal/provider/provider_schema_test.go @@ -100,6 +100,24 @@ func schemaContainsSensitiveFieldsNotMarkedAsSensitive(input map[string]*plugins return nil } +func TestDataSourcesShouldNotSupportImport(t *testing.T) { + provider := TestAzureProvider() + + // intentionally sorting these so the output is consistent + dataSourceNames := make([]string, 0) + for dataSourceName := range provider.DataSourcesMap { + dataSourceNames = append(dataSourceNames, dataSourceName) + } + sort.Strings(dataSourceNames) + + for _, dataSourceName := range dataSourceNames { + dataSource := provider.DataSourcesMap[dataSourceName] + if dataSource.Importer != nil { + t.Fatalf("the Data Source %q supports Import but Terraform does not support this - please remove the `Importer` from this Data Source", dataSourceName) + } + } +} + func TestDataSourcesHaveEnabledFieldsMarkedAsBooleans(t *testing.T) { // This test validates that Data Sources do not contain a field suffixed with `_enabled` that isn't a Boolean. // diff --git a/internal/services/dataprotection/data_protection_backup_vault_data_source.go b/internal/services/dataprotection/data_protection_backup_vault_data_source.go index 67e8f4a67d9d..3b5e112bb492 100644 --- a/internal/services/dataprotection/data_protection_backup_vault_data_source.go +++ b/internal/services/dataprotection/data_protection_backup_vault_data_source.go @@ -29,11 +29,6 @@ func dataSourceDataProtectionBackupVault() *pluginsdk.Resource { Read: pluginsdk.DefaultTimeout(5 * time.Minute), }, - Importer: pluginsdk.ImporterValidatingResourceId(func(id string) error { - _, err := backupvaults.ParseBackupVaultID(id) - return err - }), - Schema: map[string]*pluginsdk.Schema{ "name": { Type: pluginsdk.TypeString, diff --git a/internal/services/kusto/kusto_database_data_source.go b/internal/services/kusto/kusto_database_data_source.go index 250522303a36..bae7511c2ee3 100644 --- a/internal/services/kusto/kusto_database_data_source.go +++ b/internal/services/kusto/kusto_database_data_source.go @@ -12,7 +12,6 @@ import ( "github.com/hashicorp/go-azure-helpers/resourcemanager/location" "github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/databases" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/kusto/parse" kustoValidate "github.com/hashicorp/terraform-provider-azurerm/internal/services/kusto/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" @@ -22,11 +21,6 @@ func dataSourceKustoDatabase() *pluginsdk.Resource { return &pluginsdk.Resource{ Read: dataSourceKustoDatabaseRead, - Importer: pluginsdk.ImporterValidatingResourceId(func(id string) error { - _, err := parse.DatabaseID(id) - return err - }), - Timeouts: &pluginsdk.ResourceTimeout{ Read: pluginsdk.DefaultTimeout(5 * time.Minute), }, diff --git a/internal/services/network/virtual_hub_route_table_data_source.go b/internal/services/network/virtual_hub_route_table_data_source.go index 983f81593a35..f130b419272a 100644 --- a/internal/services/network/virtual_hub_route_table_data_source.go +++ b/internal/services/network/virtual_hub_route_table_data_source.go @@ -24,11 +24,6 @@ func dataSourceVirtualHubRouteTable() *pluginsdk.Resource { Read: pluginsdk.DefaultTimeout(5 * time.Minute), }, - Importer: pluginsdk.ImporterValidatingResourceId(func(id string) error { - _, err := parse.HubRouteTableID(id) - return err - }), - Schema: map[string]*pluginsdk.Schema{ "name": { Type: pluginsdk.TypeString,