diff --git a/manifest/v1alpha/validator.go b/manifest/v1alpha/validator.go index df9d0611..2de13cfe 100644 --- a/manifest/v1alpha/validator.go +++ b/manifest/v1alpha/validator.go @@ -47,7 +47,7 @@ const ( GCSNonDomainNameBucketMaxLength int = 63 CloudWatchNamespaceRegex string = `^[0-9A-Za-z.\-_/#:]{1,255}$` HeaderNameRegex string = `^([a-zA-Z0-9]+[_-]?)+$` - AzureResourceIDRegex string = `^\/subscriptions\/[a-zA-Z0-9-]+\/resourceGroups\/[a-zA-Z0-9-]+\/providers\/[a-zA-Z0-9-\._]+\/[a-zA-Z0-9-_]+\/[a-zA-Z0-9-_]+$` //nolint:lll + AzureResourceIDRegex string = `^\/subscriptions\/[a-zA-Z0-9-]+\/resourceGroups\/[a-zA-Z0-9-._()]+\/providers\/[a-zA-Z0-9-.()_]+\/[a-zA-Z0-9-_()]+\/[a-zA-Z0-9-_()]+$` //nolint:lll ) // Values used to validate time window size diff --git a/manifest/v1alpha/validator_test.go b/manifest/v1alpha/validator_test.go index d515cc0c..31c94fb5 100644 --- a/manifest/v1alpha/validator_test.go +++ b/manifest/v1alpha/validator_test.go @@ -894,6 +894,11 @@ func TestValidateAzureResourceID(t *testing.T) { resourceID: "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg/providers/Microsoft.Compute/virtualMachines/vm-123_x", //nolint:lll isValid: true, }, + { + desc: "valid resource id with _ in rg", + resourceID: "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/mc_().rg-xxx-01_ups-aks_eu_west/providers/Microsoft.()Network/loadBalancers1_-()/kubernetes", //nolint:lll + isValid: true, + }, } val := v.New()