@@ -101,26 +101,26 @@ func (r *integerResource) Create(ctx context.Context, req resource.CreateRequest
101
101
return
102
102
}
103
103
104
- max := int (plan .Max .ValueInt64 ())
105
- min := int (plan .Min .ValueInt64 ())
104
+ maxVal := int (plan .Max .ValueInt64 ())
105
+ minVal := int (plan .Min .ValueInt64 ())
106
106
seed := plan .Seed .ValueString ()
107
107
108
- if max < min {
108
+ if maxVal < minVal {
109
109
resp .Diagnostics .AddError (
110
110
"Create Random Integer Error" ,
111
- "The minimum (min ) value needs to be smaller than or equal to maximum (max ) value." ,
111
+ "The minimum (minVal ) value needs to be smaller than or equal to maximum (maxVal ) value." ,
112
112
)
113
113
return
114
114
}
115
115
116
116
rand := random .NewRand (seed )
117
- number := rand .Intn ((max + 1 )- min ) + min
117
+ number := rand .Intn ((maxVal + 1 )- minVal ) + minVal
118
118
119
119
u := & integerModelV0 {
120
120
ID : types .StringValue (strconv .Itoa (number )),
121
121
Keepers : plan .Keepers ,
122
- Min : types .Int64Value (int64 (min )),
123
- Max : types .Int64Value (int64 (max )),
122
+ Min : types .Int64Value (int64 (minVal )),
123
+ Max : types .Int64Value (int64 (maxVal )),
124
124
Result : types .Int64Value (int64 (number )),
125
125
}
126
126
@@ -179,7 +179,7 @@ func (r *integerResource) ImportState(ctx context.Context, req resource.ImportSt
179
179
return
180
180
}
181
181
182
- min , err := strconv .ParseInt (parts [1 ], 10 , 64 )
182
+ minVal , err := strconv .ParseInt (parts [1 ], 10 , 64 )
183
183
if err != nil {
184
184
resp .Diagnostics .AddError (
185
185
"Import Random Integer Error" ,
@@ -189,7 +189,7 @@ func (r *integerResource) ImportState(ctx context.Context, req resource.ImportSt
189
189
return
190
190
}
191
191
192
- max , err := strconv .ParseInt (parts [2 ], 10 , 64 )
192
+ maxVal , err := strconv .ParseInt (parts [2 ], 10 , 64 )
193
193
if err != nil {
194
194
resp .Diagnostics .AddError (
195
195
"Import Random Integer Error" ,
@@ -204,8 +204,8 @@ func (r *integerResource) ImportState(ctx context.Context, req resource.ImportSt
204
204
state .ID = types .StringValue (parts [0 ])
205
205
state .Keepers = types .MapNull (types .StringType )
206
206
state .Result = types .Int64Value (result )
207
- state .Min = types .Int64Value (min )
208
- state .Max = types .Int64Value (max )
207
+ state .Min = types .Int64Value (minVal )
208
+ state .Max = types .Int64Value (maxVal )
209
209
210
210
if len (parts ) == 4 {
211
211
state .Seed = types .StringValue (parts [3 ])
0 commit comments