From 0ab4862534a23a741fab2b41c52b66429f64a24c Mon Sep 17 00:00:00 2001 From: JT <100274846+jiaweitao001@users.noreply.github.com> Date: Fri, 14 Oct 2022 06:56:42 +0800 Subject: [PATCH] `azurerm_spring_cloud_connection`,` azurerm_app_service_connection`: fix inaccurate storage blob resource id (#18699) --- internal/services/serviceconnector/helper.go | 9 ++ .../service_connector_app_service_resource.go | 13 +- ...ice_connector_app_service_resource_test.go | 62 +++++++++ ...service_connector_spring_cloud_resource.go | 13 +- ...ce_connector_spring_cloud_resource_test.go | 66 +++++++++ .../parse/storage_account_default_blob.go | 75 ++++++++++ .../storage_account_default_blob_test.go | 128 ++++++++++++++++++ internal/services/storage/resourceids.go | 1 + .../storage_account_default_blob_id.go | 23 ++++ .../storage_account_default_blob_id_test.go | 88 ++++++++++++ 10 files changed, 474 insertions(+), 4 deletions(-) create mode 100644 internal/services/storage/parse/storage_account_default_blob.go create mode 100644 internal/services/storage/parse/storage_account_default_blob_test.go create mode 100644 internal/services/storage/validate/storage_account_default_blob_id.go create mode 100644 internal/services/storage/validate/storage_account_default_blob_id_test.go diff --git a/internal/services/serviceconnector/helper.go b/internal/services/serviceconnector/helper.go index 7446575c7696..6407d8c3a922 100644 --- a/internal/services/serviceconnector/helper.go +++ b/internal/services/serviceconnector/helper.go @@ -5,6 +5,7 @@ import ( "github.com/hashicorp/go-azure-sdk/resource-manager/servicelinker/2022-05-01/servicelinker" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" + "github.com/hashicorp/terraform-provider-azurerm/internal/services/storage/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/utils" @@ -270,6 +271,14 @@ func flattenTargetService(input servicelinker.TargetServiceBase) string { if value, ok := input.(servicelinker.AzureResource); ok { if value.Id != nil { targetServiceId = *value.Id + if parsedId, err := parse.StorageAccountDefaultBlobID(targetServiceId); err == nil { + storageAccountId := parse.StorageAccountId{ + SubscriptionId: parsedId.SubscriptionId, + ResourceGroup: parsedId.ResourceGroup, + Name: parsedId.StorageAccountName, + } + targetServiceId = storageAccountId.ID() + } } } diff --git a/internal/services/serviceconnector/service_connector_app_service_resource.go b/internal/services/serviceconnector/service_connector_app_service_resource.go index 8dfb611f8c6f..1dba7ec26303 100644 --- a/internal/services/serviceconnector/service_connector_app_service_resource.go +++ b/internal/services/serviceconnector/service_connector_app_service_resource.go @@ -11,6 +11,7 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-provider-azurerm/helpers/azure" "github.com/hashicorp/terraform-provider-azurerm/internal/sdk" + "github.com/hashicorp/terraform-provider-azurerm/internal/services/storage/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/services/web/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" @@ -122,9 +123,17 @@ func (r AppServiceConnectorResource) Create() sdk.ResourceFunc { serviceConnectorProperties := servicelinker.LinkerProperties{ AuthInfo: authInfo, - TargetService: servicelinker.AzureResource{ + } + + if _, err := parse.StorageAccountID(model.TargetResourceId); err == nil { + targetResourceId := model.TargetResourceId + "/blobServices/default" + serviceConnectorProperties.TargetService = servicelinker.AzureResource{ + Id: &targetResourceId, + } + } else { + serviceConnectorProperties.TargetService = servicelinker.AzureResource{ Id: &model.TargetResourceId, - }, + } } if model.ClientType != "" { diff --git a/internal/services/serviceconnector/service_connector_app_service_resource_test.go b/internal/services/serviceconnector/service_connector_app_service_resource_test.go index 78bd99ccdb1b..18f6c37a50e0 100644 --- a/internal/services/serviceconnector/service_connector_app_service_resource_test.go +++ b/internal/services/serviceconnector/service_connector_app_service_resource_test.go @@ -47,6 +47,21 @@ func TestAccServiceConnectorAppServiceCosmosdb_basic(t *testing.T) { }) } +func TestAccServiceConnectorAppServiceStorageBlob_basic(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_app_service_connection", "test") + r := ServiceConnectorAppServiceResource{} + + data.ResourceTest(t, r, []acceptance.TestStep{ + { + Config: r.storageBlob(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.ImportStep(), + }) +} + func TestAccServiceConnectorAppServiceCosmosdb_update(t *testing.T) { data := acceptance.BuildTestData(t, "azurerm_app_service_connection", "test") r := ServiceConnectorAppServiceResource{} @@ -83,6 +98,53 @@ func TestAccServiceConnectorAppService_complete(t *testing.T) { }) } +func (r ServiceConnectorAppServiceResource) storageBlob(data acceptance.TestData) string { + return fmt.Sprintf(` +provider "azurerm" { + features {} +} + +resource "azurerm_resource_group" "test" { + name = "acctestRG-%[3]d" + location = "%[1]s" +} + +resource "azurerm_storage_account" "test" { + name = "acctestacc%[2]s" + resource_group_name = azurerm_resource_group.test.name + location = azurerm_resource_group.test.location + account_tier = "Standard" + account_replication_type = "LRS" +} + +resource "azurerm_service_plan" "test" { + location = azurerm_resource_group.test.location + name = "testserviceplan%[2]s" + resource_group_name = azurerm_resource_group.test.name + sku_name = "P1v2" + os_type = "Linux" +} + +resource "azurerm_linux_web_app" "test" { + location = azurerm_resource_group.test.location + name = "testlinuxwebapp%[2]s" + resource_group_name = azurerm_resource_group.test.name + service_plan_id = azurerm_service_plan.test.id + + site_config {} +} + +resource "azurerm_app_service_connection" "test" { + name = "acctestserviceconnector%[3]d" + app_service_id = azurerm_linux_web_app.test.id + target_resource_id = azurerm_storage_account.test.id + authentication { + type = "systemAssignedIdentity" + } +} +`, data.Locations.Primary, data.RandomString, data.RandomInteger) +} + func (r ServiceConnectorAppServiceResource) cosmosdbBasic(data acceptance.TestData) string { template := r.template(data) return fmt.Sprintf(` diff --git a/internal/services/serviceconnector/service_connector_spring_cloud_resource.go b/internal/services/serviceconnector/service_connector_spring_cloud_resource.go index adcf52c4ea90..5dbcf824ea97 100644 --- a/internal/services/serviceconnector/service_connector_spring_cloud_resource.go +++ b/internal/services/serviceconnector/service_connector_spring_cloud_resource.go @@ -12,6 +12,7 @@ import ( "github.com/hashicorp/terraform-provider-azurerm/helpers/azure" "github.com/hashicorp/terraform-provider-azurerm/internal/sdk" "github.com/hashicorp/terraform-provider-azurerm/internal/services/springcloud/validate" + "github.com/hashicorp/terraform-provider-azurerm/internal/services/storage/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/utils" @@ -124,9 +125,17 @@ func (r SpringCloudConnectorResource) Create() sdk.ResourceFunc { serviceConnectorProperties := servicelinker.LinkerProperties{ AuthInfo: authInfo, - TargetService: servicelinker.AzureResource{ + } + + if _, err := parse.StorageAccountID(model.TargetResourceId); err == nil { + targetResourceId := model.TargetResourceId + "/blobServices/default" + serviceConnectorProperties.TargetService = servicelinker.AzureResource{ + Id: &targetResourceId, + } + } else { + serviceConnectorProperties.TargetService = servicelinker.AzureResource{ Id: &model.TargetResourceId, - }, + } } if model.ClientType != "" { diff --git a/internal/services/serviceconnector/service_connector_spring_cloud_resource_test.go b/internal/services/serviceconnector/service_connector_spring_cloud_resource_test.go index 0791751ecdf8..318eae803277 100644 --- a/internal/services/serviceconnector/service_connector_spring_cloud_resource_test.go +++ b/internal/services/serviceconnector/service_connector_spring_cloud_resource_test.go @@ -47,6 +47,21 @@ func TestAccServiceConnectorSpringCloudCosmosdb_basic(t *testing.T) { }) } +func TestAccServiceConnectorSpringCloudStorageBlob_basic(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_spring_cloud_connection", "test") + r := ServiceConnectorSpringCloudResource{} + + data.ResourceTest(t, r, []acceptance.TestStep{ + { + Config: r.storageBlob(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.ImportStep(), + }) +} + func TestAccServiceConnectorSpringCloudCosmosdb_update(t *testing.T) { data := acceptance.BuildTestData(t, "azurerm_spring_cloud_connection", "test") r := ServiceConnectorSpringCloudResource{} @@ -99,6 +114,57 @@ resource "azurerm_spring_cloud_connection" "test" { `, template, data.RandomString, data.RandomInteger) } +func (r ServiceConnectorSpringCloudResource) storageBlob(data acceptance.TestData) string { + return fmt.Sprintf(` +provider "azurerm" { + features {} +} + +resource "azurerm_resource_group" "test" { + name = "acctestRG-%[2]d" + location = "%[1]s" +} + +resource "azurerm_storage_account" "test" { + name = "acctestacc%[3]s" + resource_group_name = azurerm_resource_group.test.name + location = azurerm_resource_group.test.location + account_tier = "Standard" + account_replication_type = "LRS" +} + +resource "azurerm_spring_cloud_service" "test" { + name = "testspringcloudservice-%[3]s" + resource_group_name = azurerm_resource_group.test.name + location = azurerm_resource_group.test.location +} + +resource "azurerm_spring_cloud_app" "test" { + name = "testspringcloud-%[3]s" + resource_group_name = azurerm_resource_group.test.name + service_name = azurerm_spring_cloud_service.test.name + + identity { + type = "SystemAssigned" + } +} + +resource "azurerm_spring_cloud_java_deployment" "test" { + name = "deploy-%[3]s" + spring_cloud_app_id = azurerm_spring_cloud_app.test.id +} + +resource "azurerm_spring_cloud_connection" "test" { + name = "acctestserviceconnector%[2]d" + spring_cloud_id = azurerm_spring_cloud_java_deployment.test.id + target_resource_id = azurerm_storage_account.test.id + authentication { + type = "systemAssignedIdentity" + } +} +`, data.Locations.Primary, data.RandomInteger, data.RandomString) +} + func (r ServiceConnectorSpringCloudResource) cosmosdbUpdate(data acceptance.TestData) string { template := r.template(data) return fmt.Sprintf(` diff --git a/internal/services/storage/parse/storage_account_default_blob.go b/internal/services/storage/parse/storage_account_default_blob.go new file mode 100644 index 000000000000..1b697726ec2a --- /dev/null +++ b/internal/services/storage/parse/storage_account_default_blob.go @@ -0,0 +1,75 @@ +package parse + +// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +type StorageAccountDefaultBlobId struct { + SubscriptionId string + ResourceGroup string + StorageAccountName string + BlobServiceName string +} + +func NewStorageAccountDefaultBlobID(subscriptionId, resourceGroup, storageAccountName, blobServiceName string) StorageAccountDefaultBlobId { + return StorageAccountDefaultBlobId{ + SubscriptionId: subscriptionId, + ResourceGroup: resourceGroup, + StorageAccountName: storageAccountName, + BlobServiceName: blobServiceName, + } +} + +func (id StorageAccountDefaultBlobId) String() string { + segments := []string{ + fmt.Sprintf("Blob Service Name %q", id.BlobServiceName), + fmt.Sprintf("Storage Account Name %q", id.StorageAccountName), + fmt.Sprintf("Resource Group %q", id.ResourceGroup), + } + segmentsStr := strings.Join(segments, " / ") + return fmt.Sprintf("%s: (%s)", "Storage Account Default Blob", segmentsStr) +} + +func (id StorageAccountDefaultBlobId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Storage/storageAccounts/%s/blobServices/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroup, id.StorageAccountName, id.BlobServiceName) +} + +// StorageAccountDefaultBlobID parses a StorageAccountDefaultBlob ID into an StorageAccountDefaultBlobId struct +func StorageAccountDefaultBlobID(input string) (*StorageAccountDefaultBlobId, error) { + id, err := resourceids.ParseAzureResourceID(input) + if err != nil { + return nil, err + } + + resourceId := StorageAccountDefaultBlobId{ + SubscriptionId: id.SubscriptionID, + ResourceGroup: id.ResourceGroup, + } + + if resourceId.SubscriptionId == "" { + return nil, fmt.Errorf("ID was missing the 'subscriptions' element") + } + + if resourceId.ResourceGroup == "" { + return nil, fmt.Errorf("ID was missing the 'resourceGroups' element") + } + + if resourceId.StorageAccountName, err = id.PopSegment("storageAccounts"); err != nil { + return nil, err + } + if resourceId.BlobServiceName, err = id.PopSegment("blobServices"); err != nil { + return nil, err + } + + if err := id.ValidateNoEmptySegments(input); err != nil { + return nil, err + } + + return &resourceId, nil +} diff --git a/internal/services/storage/parse/storage_account_default_blob_test.go b/internal/services/storage/parse/storage_account_default_blob_test.go new file mode 100644 index 000000000000..a7c04286989e --- /dev/null +++ b/internal/services/storage/parse/storage_account_default_blob_test.go @@ -0,0 +1,128 @@ +package parse + +// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten + +import ( + "testing" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.Id = StorageAccountDefaultBlobId{} + +func TestStorageAccountDefaultBlobIDFormatter(t *testing.T) { + actual := NewStorageAccountDefaultBlobID("12345678-1234-9876-4563-123456789012", "resGroup1", "storageAccount1", "default").ID() + expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Storage/storageAccounts/storageAccount1/blobServices/default" + if actual != expected { + t.Fatalf("Expected %q but got %q", expected, actual) + } +} + +func TestStorageAccountDefaultBlobID(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *StorageAccountDefaultBlobId + }{ + + { + // empty + Input: "", + Error: true, + }, + + { + // missing SubscriptionId + Input: "/", + Error: true, + }, + + { + // missing value for SubscriptionId + Input: "/subscriptions/", + Error: true, + }, + + { + // missing ResourceGroup + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/", + Error: true, + }, + + { + // missing value for ResourceGroup + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/", + Error: true, + }, + + { + // missing StorageAccountName + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Storage/", + Error: true, + }, + + { + // missing value for StorageAccountName + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Storage/storageAccounts/", + Error: true, + }, + + { + // missing BlobServiceName + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Storage/storageAccounts/storageAccount1/", + Error: true, + }, + + { + // missing value for BlobServiceName + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Storage/storageAccounts/storageAccount1/blobServices/", + Error: true, + }, + + { + // valid + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Storage/storageAccounts/storageAccount1/blobServices/default", + Expected: &StorageAccountDefaultBlobId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroup: "resGroup1", + StorageAccountName: "storageAccount1", + BlobServiceName: "default", + }, + }, + + { + // upper-cased + Input: "/SUBSCRIPTIONS/12345678-1234-9876-4563-123456789012/RESOURCEGROUPS/RESGROUP1/PROVIDERS/MICROSOFT.STORAGE/STORAGEACCOUNTS/STORAGEACCOUNT1/BLOBSERVICES/DEFAULT", + Error: true, + }, + } + + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := StorageAccountDefaultBlobID(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %s", err) + } + if v.Error { + t.Fatal("Expect an error but didn't get one") + } + + if actual.SubscriptionId != v.Expected.SubscriptionId { + t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) + } + if actual.ResourceGroup != v.Expected.ResourceGroup { + t.Fatalf("Expected %q but got %q for ResourceGroup", v.Expected.ResourceGroup, actual.ResourceGroup) + } + if actual.StorageAccountName != v.Expected.StorageAccountName { + t.Fatalf("Expected %q but got %q for StorageAccountName", v.Expected.StorageAccountName, actual.StorageAccountName) + } + if actual.BlobServiceName != v.Expected.BlobServiceName { + t.Fatalf("Expected %q but got %q for BlobServiceName", v.Expected.BlobServiceName, actual.BlobServiceName) + } + } +} diff --git a/internal/services/storage/resourceids.go b/internal/services/storage/resourceids.go index 0faeca1705b9..3a93cf5035c7 100644 --- a/internal/services/storage/resourceids.go +++ b/internal/services/storage/resourceids.go @@ -3,6 +3,7 @@ package storage //go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=BlobInventoryPolicy -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Storage/storageAccounts/storageAccount1/inventoryPolicies/inventoryPolicy1 //go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=EncryptionScope -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Storage/storageAccounts/storageAccount1/encryptionScopes/encryptionScope1 //go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=StorageAccount -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Storage/storageAccounts/storageAccount1 +//go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=StorageAccountDefaultBlob -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Storage/storageAccounts/storageAccount1/blobServices/default //go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=StorageContainerResourceManager -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Storage/storageAccounts/storageAccount1/blobServices/default/containers/container1 //go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=StorageShareResourceManager -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Storage/storageAccounts/storageAccount1/fileServices/fileService1/fileshares/share1 //go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=StorageSyncGroup -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.StorageSync/storageSyncServices/storageSyncService1/syncGroups/syncGroup1 diff --git a/internal/services/storage/validate/storage_account_default_blob_id.go b/internal/services/storage/validate/storage_account_default_blob_id.go new file mode 100644 index 000000000000..7db0ab6c2c5d --- /dev/null +++ b/internal/services/storage/validate/storage_account_default_blob_id.go @@ -0,0 +1,23 @@ +package validate + +// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten + +import ( + "fmt" + + "github.com/hashicorp/terraform-provider-azurerm/internal/services/storage/parse" +) + +func StorageAccountDefaultBlobID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := parse.StorageAccountDefaultBlobID(v); err != nil { + errors = append(errors, err) + } + + return +} diff --git a/internal/services/storage/validate/storage_account_default_blob_id_test.go b/internal/services/storage/validate/storage_account_default_blob_id_test.go new file mode 100644 index 000000000000..b874ec79a05b --- /dev/null +++ b/internal/services/storage/validate/storage_account_default_blob_id_test.go @@ -0,0 +1,88 @@ +package validate + +// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten + +import "testing" + +func TestStorageAccountDefaultBlobID(t *testing.T) { + cases := []struct { + Input string + Valid bool + }{ + + { + // empty + Input: "", + Valid: false, + }, + + { + // missing SubscriptionId + Input: "/", + Valid: false, + }, + + { + // missing value for SubscriptionId + Input: "/subscriptions/", + Valid: false, + }, + + { + // missing ResourceGroup + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/", + Valid: false, + }, + + { + // missing value for ResourceGroup + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/", + Valid: false, + }, + + { + // missing StorageAccountName + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Storage/", + Valid: false, + }, + + { + // missing value for StorageAccountName + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Storage/storageAccounts/", + Valid: false, + }, + + { + // missing BlobServiceName + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Storage/storageAccounts/storageAccount1/", + Valid: false, + }, + + { + // missing value for BlobServiceName + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Storage/storageAccounts/storageAccount1/blobServices/", + Valid: false, + }, + + { + // valid + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Storage/storageAccounts/storageAccount1/blobServices/default", + Valid: true, + }, + + { + // upper-cased + Input: "/SUBSCRIPTIONS/12345678-1234-9876-4563-123456789012/RESOURCEGROUPS/RESGROUP1/PROVIDERS/MICROSOFT.STORAGE/STORAGEACCOUNTS/STORAGEACCOUNT1/BLOBSERVICES/DEFAULT", + Valid: false, + }, + } + for _, tc := range cases { + t.Logf("[DEBUG] Testing Value %s", tc.Input) + _, errors := StorageAccountDefaultBlobID(tc.Input, "test") + valid := len(errors) == 0 + + if tc.Valid != valid { + t.Fatalf("Expected %t but got %t", tc.Valid, valid) + } + } +}