• 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_url.go
1
package validation
2

3
import (
4
        "context"
5
        "fmt"
6
        "net/url"
7
        "strings"
8

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

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

16
type stringIsValidURLValidator struct{}
17

UNCOV
18
func (v stringIsValidURLValidator) Description(_ context.Context) string {
×
UNCOV
19
        return "must be a valid URL with a host and an https scheme"
×
UNCOV
20
}
×
21

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

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

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

×
UNCOV
33
        parsedURL, err := url.ParseRequestURI(value)
×
UNCOV
34
        if err != nil {
×
35
                resp.Diagnostics.Append(validatordiag.InvalidAttributeValueDiagnostic(
×
36
                        req.Path,
×
37
                        v.Description(ctx),
×
38
                        fmt.Sprintf("%q", value),
×
39
                ))
×
40
                return
×
41
        }
×
42

UNCOV
43
        if parsedURL.Host == "" {
×
44
                resp.Diagnostics.Append(validatordiag.InvalidAttributeValueDiagnostic(
×
45
                        req.Path,
×
46
                        "URL must include a host",
×
47
                        fmt.Sprintf("%q", value),
×
48
                ))
×
49
        }
×
50

UNCOV
51
        if strings.ToLower(parsedURL.Scheme) != "https" {
×
52
                resp.Diagnostics.Append(validatordiag.InvalidAttributeValueDiagnostic(
×
53
                        req.Path,
×
54
                        "URL scheme must be https",
×
55
                        fmt.Sprintf("%q", value),
×
56
                ))
×
57
        }
×
58
}
59

UNCOV
60
func StringIsValidURL() validator.String {
×
UNCOV
61
        return stringIsValidURLValidator{}
×
UNCOV
62
}
×
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