Skip to content

Commit 7382552

Browse files
Update validation for Auto Upgrade Profile name
Replaces fixed 'default' value validation with a regex and length check for the 'name' argument in KubernetesFleetAutoUpgradeProfileResource. Updates documentation to reflect the new validation requirements and clarify resource creation behavior.
1 parent 76fdfe2 commit 7382552

2 files changed

Lines changed: 9 additions & 2 deletions

File tree

internal/services/containers/kubernetes_fleet_auto_upgrade_profile_resource.go

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package containers
33
import (
44
"context"
55
"fmt"
6+
"regexp"
67
"time"
78

89
"github.com/hashicorp/go-azure-helpers/lang/pointer"
@@ -44,7 +45,13 @@ func (r KubernetesFleetAutoUpgradeProfileResource) Arguments() map[string]*plugi
4445
ForceNew: true,
4546
Required: true,
4647
Type: pluginsdk.TypeString,
47-
ValidateFunc: validation.StringInSlice([]string{"default"}, false),
48+
ValidateFunc: validation.All(
49+
validation.StringLenBetween(1, 50),
50+
validation.StringMatch(
51+
regexp.MustCompile(`^[a-z0-9]([-a-z0-9]*[a-z0-9])?$`),
52+
"name must start and end with a lowercase letter or number, and can only contain lowercase letters, numbers, and hyphens",
53+
),
54+
),
4855
},
4956

5057
"resource_group_name": commonschema.ResourceGroupName(),

website/docs/r/kubernetes_fleet_auto_upgrade_profile.html.markdown

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ resource "azurerm_kubernetes_fleet_auto_upgrade_profile" "example" {
3636

3737
The following arguments are supported:
3838

39-
* `name` - (Required) The name of the Auto Upgrade Profile. Must be `default`.
39+
* `name` - (Required) The name of the Auto Upgrade Profile. Changing this forces a new resource to be created.
4040

4141
* `resource_group_name` - (Required) The name of the Resource Group where the Kubernetes Fleet Auto Upgrade Profile should exist.
4242

0 commit comments

Comments
 (0)