Skip to content

Commit 94c2ab4

Browse files
committed
remove dead code
1 parent d0d0e66 commit 94c2ab4

File tree

2 files changed

+5
-36
lines changed

2 files changed

+5
-36
lines changed

parameter.go

Lines changed: 0 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,8 @@ package preview
33
import (
44
"github.com/aquasecurity/trivy/pkg/iac/terraform"
55
"github.com/hashicorp/hcl/v2"
6-
"github.com/zclconf/go-cty/cty"
76

87
"github.com/coder/preview/extract"
9-
"github.com/coder/preview/hclext"
108
"github.com/coder/preview/types"
119
)
1210

@@ -30,37 +28,3 @@ func RichParameters(modules terraform.Modules) ([]types.Parameter, hcl.Diagnosti
3028

3129
return params, diags
3230
}
33-
34-
func paramOption(block *terraform.Block) (*types.ParameterOption, hcl.Diagnostics) {
35-
p := newAttributeParser(block)
36-
opt := &types.ParameterOption{
37-
Name: p.attr("name").required().string(),
38-
Description: p.attr("description").string(),
39-
// Does it need to be a string?
40-
Value: p.attr("value").required().tryString(),
41-
Icon: p.attr("icon").string(),
42-
}
43-
if p.diags.HasErrors() {
44-
return nil, p.diags
45-
}
46-
return opt, nil
47-
}
48-
49-
func richParameterValue(block *terraform.Block) cty.Value {
50-
// Find the value of the parameter from the context.
51-
paramPath := append([]string{"data"}, block.Labels()...)
52-
valueRef := hclext.ScopeTraversalExpr(append(paramPath, "value")...)
53-
paramValue, diags := valueRef.Value(block.Context().Inner())
54-
if diags != nil && diags.HasErrors() {
55-
for _, diag := range diags {
56-
b := block.HCLBlock().Body.MissingItemRange()
57-
diag.Subject = &b
58-
}
59-
60-
// TODO: Figure out what to do with these diagnostics
61-
var _ = diags
62-
return cty.UnknownVal(cty.NilType)
63-
}
64-
65-
return paramValue
66-
}

plan.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,11 @@ func PlanJSONHook(dfs fs.FS, input Input) (func(ctx *tfcontext.Context, blocks t
4040
if planMod == nil {
4141
continue
4242
}
43+
44+
// TODO: Nested blocks might have an issue here with the correct context.
45+
// We want the "module context", which is the parent of the top level
46+
// block. Maybe there is a way to discover what that is via some
47+
// var set in the context.
4348
err = loadResourcesToContext(block.Context().Parent(), planMod.Resources)
4449
if err != nil {
4550
// TODO: Somehow handle this error

0 commit comments

Comments
 (0)