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

Scalr / terraform-provider-scalr / 13991652200

21 Mar 2025 12:23PM UTC coverage: 69.591% (-0.05%) from 69.639%
13991652200

push

github

web-flow
SCALRCORE-33829 Add workload-identity-provider and assume-service-acc… (#405)

* SCALRCORE-33829 Add workload-identity-provider and assume-service-account-policy resources.

* SCALRCORE-33829 changelog

* Update internal/provider/assume_service_account_policy_resource.go

Co-authored-by: Petro Protsakh <p.protsakh@scalr.com>

* SCALRCORE-33829 CR fixes

* SCALRCORE-33829 fix linter

---------

Co-authored-by: Petro Protsakh <p.protsakh@scalr.com>

308 of 450 new or added lines in 4 files covered. (68.44%)

7781 of 11181 relevant lines covered (69.59%)

202.25 hits per line

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

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

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

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

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

31
        value := req.ConfigValue.ValueString()
62✔
32

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

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

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

60
func StringIsValidURL() validator.String {
1,472✔
61
        return stringIsValidURLValidator{}
1,472✔
62
}
1,472✔
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

© 2025 Coveralls, Inc