terratest icon indicating copy to clipboard operation
terratest copied to clipboard

OutputAll does not support number type

Open madpipeline opened this issue 1 year ago • 1 comments

Describe the solution you'd like Just like we have the ability to easily "cast" to string, to also be able to "cast" to a number type, like float.

Describe alternatives you've considered Alternatively we can use Atoi and similar functions to convert the string to int or float, but this makes the tests codebase more bloated.

madpipeline avatar Aug 27 '24 20:08 madpipeline

After testing I see that this is supported and I can use this:

alarmThreshold := int(outputs["alarm_threshold"].(float64))

This could be useful to be shown in the https://github.com/gruntwork-io/terratest/blob/master/modules/terraform/output_test.go#L377 as an example.

madpipeline avatar Aug 27 '24 20:08 madpipeline

Got it. Will close this issue since you've already found the solution.

james00012 avatar Sep 04 '24 02:09 james00012