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

Scalr / terraform-provider-scalr / 14248986470

03 Apr 2025 05:21PM UTC coverage: 67.499% (-2.1%) from 69.557%
14248986470

push

github

web-flow
SCALRCORE-32300 BE > Provider > `scalr_variable` resource doesn't offer any way to expose/use variable value (#409)

* SCALRCORE-32300 Refactor scalr_variable resource to Terraform Plugin Framework

* SCALRCORE-32300 Add back variable state upgraders

* SCALRCORE-32300 Update changelog

* SCALRCORE-32300 Improve handling of unknown computed workspace_id, environment_id

* SCALRCORE-32300 Cosmetics

---------

Co-authored-by: Vladyslav Vlasenko <fl4shqq@gmail.com>

213 of 543 new or added lines in 6 files covered. (39.23%)

51 existing lines in 2 files now uncovered.

7811 of 11572 relevant lines covered (67.5%)

225.16 hits per line

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

76.19
/internal/framework/planmodifiers/stringmodifier/use_state_or_null_for_unknown.go
1
package stringmodifier
2

3
import (
4
        "context"
5

6
        "github.com/hashicorp/terraform-plugin-framework/resource/schema/planmodifier"
7
)
8

9
func UseStateOrNullForUnknown() planmodifier.String {
3,064✔
10
        return useStateOrNullForUnknownModifier{}
3,064✔
11
}
3,064✔
12

13
type useStateOrNullForUnknownModifier struct{}
14

15
func (m useStateOrNullForUnknownModifier) Description(_ context.Context) string {
528✔
16
        return "Use state value if planned value is unknown, even if it is null."
528✔
17
}
528✔
18

NEW
19
func (m useStateOrNullForUnknownModifier) MarkdownDescription(ctx context.Context) string {
×
NEW
20
        return m.Description(ctx)
×
NEW
21
}
×
22

23
func (m useStateOrNullForUnknownModifier) PlanModifyString(_ context.Context, req planmodifier.StringRequest, resp *planmodifier.StringResponse) {
264✔
24
        // Do nothing on resource creation.
264✔
25
        if req.State.Raw.IsNull() {
328✔
26
                return
64✔
27
        }
64✔
28

29
        // Do nothing if there is a known planned value.
30
        if !req.PlanValue.IsUnknown() {
396✔
31
                return
196✔
32
        }
196✔
33

34
        // Do nothing if there is an unknown configuration value.
35
        if req.ConfigValue.IsUnknown() {
4✔
NEW
36
                return
×
NEW
37
        }
×
38

39
        resp.PlanValue = req.StateValue
4✔
40
}
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