Skip to content

Commit

Permalink
Fix fields for the math downstep
Browse files Browse the repository at this point in the history
  • Loading branch information
STollenaar committed May 5, 2021
1 parent be4a6c1 commit fb5a75a
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions unitconverter/resource_math_downstep.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@ func ResourceMathDownStep() *schema.Resource {
// StepDown does the step down
func StepDown() func(d *schema.ResourceData, meta interface{}) error {
return func(d *schema.ResourceData, meta interface{}) error {
value := d.Get("inputValue").(float64)
unit := d.Get("inputUnit").(string)
value := d.Get("input_value").(float64)
unit := d.Get("input_unit").(string)

resultValue, resultUnit, errorUnit := doDownstep(value, unit)
d.Set("outputValue", resultValue)
d.Set("outputUnit", resultUnit)
d.Set("output_value", resultValue)
d.Set("output_unit", resultUnit)
d.SetId(fmt.Sprintf("%.2f", value))
return errorUnit
}
Expand Down Expand Up @@ -68,21 +68,21 @@ func isIntegral(val float64) bool {
// stepFields the schema used for the math resource
func stepFields() map[string]*schema.Schema {
s := map[string]*schema.Schema{
"inputValue": {
"input_value": {
Type: schema.TypeFloat,
Required: true,
ForceNew: true,
},
"inputUnit": {
"input_unit": {
Type: schema.TypeString,
Required: true,
ForceNew: true,
},
"outputValue": {
"output_value": {
Type: schema.TypeFloat,
Computed: true,
},
"outputUnit": {
"output_unit": {
Type: schema.TypeString,
Required: true,
ForceNew: true,
Expand Down

0 comments on commit fb5a75a

Please sign in to comment.