Skip to content

Commit

Permalink
added virtual desktop application group name validation rule
Browse files Browse the repository at this point in the history
  • Loading branch information
ritesh-modi committed Oct 27, 2020
1 parent cef64fd commit ad0ca68
Showing 1 changed file with 11 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@ package desktopvirtualization
import (
"fmt"
"log"
"regexp"
"time"

"github.com/Azure/azure-sdk-for-go/services/preview/desktopvirtualization/mgmt/2019-12-10-preview/desktopvirtualization"
"github.com/hashicorp/terraform-plugin-sdk/helper/schema"
"github.com/hashicorp/terraform-plugin-sdk/helper/validation"
"github.com/terraform-providers/terraform-provider-azurerm/azurerm/helpers/azure"
"github.com/terraform-providers/terraform-provider-azurerm/azurerm/helpers/tf"
"github.com/terraform-providers/terraform-provider-azurerm/azurerm/helpers/validate"
"github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/clients"
"github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/services/desktopvirtualization/parse"
"github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/tags"
Expand Down Expand Up @@ -40,10 +40,16 @@ func resourceArmVirtualDesktopApplicationGroup() *schema.Resource {

Schema: map[string]*schema.Schema{
"name": {
Type: schema.TypeString,
Required: true,
ForceNew: true,
ValidateFunc: validate.DevSpaceName(),
Type: schema.TypeString,
Required: true,
ForceNew: true,
ValidateFunc: validation.All(
validation.StringIsNotEmpty,
validation.StringMatch(
regexp.MustCompile("^[-a-zA-Z0-9]{1,260}$"),
"Virtual desktop application group name must be 1 - 260 characters long, contain only letters, numbers and hyphens.",
),
),
},

"location": azure.SchemaLocation(),
Expand Down

0 comments on commit ad0ca68

Please sign in to comment.