Skip to content

Commit

Permalink
Revert "azurerm_storage_account: Plan time name validation (hashico…
Browse files Browse the repository at this point in the history
…rp#23799)"

This reverts commit 828f8cf.
  • Loading branch information
magodo committed Dec 7, 2023
1 parent 2d48f47 commit 001b003
Showing 1 changed file with 0 additions and 20 deletions.
20 changes: 0 additions & 20 deletions internal/services/storage/storage_account_resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import (

"github.com/Azure/azure-sdk-for-go/services/storage/mgmt/2021-09-01/storage" // nolint: staticcheck
azautorest "github.com/Azure/go-autorest/autorest"
"github.com/hashicorp/go-azure-helpers/lang/pointer"
"github.com/hashicorp/go-azure-helpers/lang/response"
"github.com/hashicorp/go-azure-helpers/resourcemanager/commonids"
"github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema"
Expand Down Expand Up @@ -1230,25 +1229,6 @@ func resourceStorageAccount() *pluginsdk.Resource {
},
CustomizeDiff: pluginsdk.CustomDiffWithAll(
pluginsdk.CustomizeDiffShim(func(ctx context.Context, d *pluginsdk.ResourceDiff, v interface{}) error {
client := v.(*clients.Client).Storage.AccountsClient
// The `name` only changes for the new resource creation scenario, in which case we will further check the name availability.
if d.HasChange("name") {
_, name := d.GetChange("name")
resp, err := client.CheckNameAvailability(ctx, storage.AccountCheckNameAvailabilityParameters{
Name: pointer.To(name.(string)),
Type: pointer.To("Microsoft.Storage/storageAccounts"),
})
if err != nil {
return err
}
if ok := resp.NameAvailable; ok != nil && !(*ok) {
errmsg := fmt.Sprintf("`name` is not available: [%s]", resp.Reason)
if msg := resp.Message; msg != nil {
errmsg += " " + *msg
}
return fmt.Errorf(errmsg)
}
}
if d.HasChange("account_kind") {
accountKind, changedKind := d.GetChange("account_kind")

Expand Down

0 comments on commit 001b003

Please sign in to comment.