File tree 1 file changed +19
-2
lines changed 1 file changed +19
-2
lines changed Original file line number Diff line number Diff line change @@ -62,8 +62,25 @@ func parameterDataSource() *schema.Resource {
62
62
ReadContext : func (ctx context.Context , rd * schema.ResourceData , i interface {}) diag.Diagnostics {
63
63
rd .SetId (uuid .NewString ())
64
64
65
+ // 1. Read raw config to check if ptr fields are nil
66
+ // 2. Update rd with nil values (it is already broken)
67
+
68
+ //vm := rd.GetRawConfig().AsValueMap()["validation"].AsValueSlice()[0].AsValueMap()
69
+ //log.Println(vm)
70
+
71
+ val := rd .Get ("validation" )
72
+ v := val .([]interface {})
73
+ k := v [0 ].(map [string ]interface {})
74
+ k ["min" ] = nil
75
+ k ["max" ] = nil
76
+ v [0 ] = k
77
+ err := rd .Set ("validation" , v )
78
+ if err != nil {
79
+ return diag .FromErr (err )
80
+ }
81
+
65
82
var parameter Parameter
66
- err : = mapstructure .Decode (struct {
83
+ err = mapstructure .Decode (struct {
67
84
Value interface {}
68
85
Name interface {}
69
86
DisplayName interface {}
@@ -98,7 +115,7 @@ func parameterDataSource() *schema.Resource {
98
115
}(),
99
116
Icon : rd .Get ("icon" ),
100
117
Option : rd .Get ("option" ),
101
- Validation : rd . Get ( "validation" ) ,
118
+ Validation : val ,
102
119
Optional : func () bool {
103
120
// This hack allows for checking if the "default" field is present in the .tf file.
104
121
// If "default" is missing or is "null", then it means that this field is required,
You can’t perform that action at this time.
0 commit comments