• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

Scalr / terraform-provider-scalr / 16587228491

29 Jul 2025 05:09AM UTC coverage: 63.854% (-0.3%) from 64.163%
16587228491

push

github

web-flow
SCALRCORE-35309 Provider > Namespaces support. (#441)

* SCALRCORE-35309 Provider > Namespaces support.

* SCALRCORE-35309 changelog

* SCALRCORE-35309

242 of 444 new or added lines in 6 files covered. (54.5%)

8748 of 13700 relevant lines covered (63.85%)

301.36 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

81.48
/internal/framework/validation/string_is_namespace_name.go
1
package validation
2

3
import (
4
        "context"
5
        "fmt"
6
        "regexp"
7

8
        "github.com/hashicorp/terraform-plugin-framework-validators/helpers/validatordiag"
9
        "github.com/hashicorp/terraform-plugin-framework/schema/validator"
10
)
11

12
// Compile-time interface check
13
var _ validator.String = stringIsNamespaceNameValidator{}
14

15
type stringIsNamespaceNameValidator struct{}
16

17
func (v stringIsNamespaceNameValidator) Description(_ context.Context) string {
105✔
18
        return "must only contain letters, numbers, dashes, and underscores"
105✔
19
}
105✔
20

NEW
21
func (v stringIsNamespaceNameValidator) MarkdownDescription(ctx context.Context) string {
×
NEW
22
        return v.Description(ctx)
×
NEW
23
}
×
24

25
func (v stringIsNamespaceNameValidator) ValidateString(ctx context.Context, req validator.StringRequest, resp *validator.StringResponse) {
52✔
26
        if req.ConfigValue.IsNull() || req.ConfigValue.IsUnknown() {
52✔
NEW
27
                return
×
NEW
28
        }
×
29

30
        value := req.ConfigValue.ValueString()
52✔
31

52✔
32
        // Regex to match only letters, numbers, dashes, and underscores
52✔
33
        validNamespaceName := regexp.MustCompile(`^[a-zA-Z0-9_-]+$`)
52✔
34

52✔
35
        if !validNamespaceName.MatchString(value) {
53✔
36
                resp.Diagnostics.Append(validatordiag.InvalidAttributeValueDiagnostic(
1✔
37
                        req.Path,
1✔
38
                        v.Description(ctx),
1✔
39
                        fmt.Sprintf("%q", value),
1✔
40
                ))
1✔
41

1✔
42
                return
1✔
43
        }
1✔
44
}
45

46
func StringIsNamespaceName() validator.String {
1,619✔
47
        return stringIsNamespaceNameValidator{}
1,619✔
48
}
1,619✔
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc