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

Scalr / terraform-provider-scalr / 19468430585

18 Nov 2025 01:47PM UTC coverage: 61.522% (-2.8%) from 64.37%
19468430585

push

github

web-flow
Merge pull request #476 from Scalr/SCALRCORE-36442

SCALRCORE-36442 Provider > Crash when importing system IAM role

169 of 339 new or added lines in 10 files covered. (49.85%)

330 existing lines in 13 files now uncovered.

8925 of 14507 relevant lines covered (61.52%)

247.16 hits per line

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

0.0
/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

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

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

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

UNCOV
30
        value := req.ConfigValue.ValueString()
×
UNCOV
31

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

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

×
UNCOV
42
                return
×
UNCOV
43
        }
×
44
}
45

UNCOV
46
func StringIsNamespaceName() validator.String {
×
UNCOV
47
        return stringIsNamespaceNameValidator{}
×
UNCOV
48
}
×
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