Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions stackit/internal/services/telemetrylink/link/resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"errors"
"fmt"
"net/http"
"regexp"
"strings"
"time"

Expand Down Expand Up @@ -172,10 +173,22 @@ func (r *telemetryLinkResource) Schema(_ context.Context, _ resource.SchemaReque
"display_name": schema.StringAttribute{
Description: schemaDescriptions["display_name"],
Required: true,
Validators: []validator.String{
stringvalidator.RegexMatches(
regexp.MustCompile(`^[a-zA-Z0-9][a-zA-Z0-9\-\ ]*$`),
"The display name must start with an alphanumeric character and can only contain letters, numbers, spaces, and hyphens.",
),
},
},
"description": schema.StringAttribute{
Description: schemaDescriptions["description"],
Optional: true,
Validators: []validator.String{
stringvalidator.RegexMatches(
regexp.MustCompile(`^[a-zA-Z0-9][a-zA-Z0-9\-\ ]*$`),
"The description must start with an alphanumeric character and can only contain letters, numbers, spaces, and hyphens.",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the API docs this is mentioned differently (API docs)

description	
string <= 1024 characters

The description is a longer text chosen by the user to provide more context for the resource.

),
},
},
"region": schema.StringAttribute{
Description: schemaDescriptions["region"],
Expand Down