@@ -3,10 +3,8 @@ package preview
33import  (
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- }
0 commit comments