stacker icon indicating copy to clipboard operation
stacker copied to clipboard

default lookup doesn't retain value type

Open Spareo opened this issue 7 years ago • 2 comments
trafficstars

I am passing in an environment file with the following line in it:

BaselineCapacity: 2

In my blueprint I have the following variable defined:

"BaselineCapacity": {
            "type": int,
            "description": "The number of instances to maintain during market close hours"
  },

And finally, in my config.yml I have the following under one of my stacks

BaselineCapacity: ${default BaselineCapacity::1}

When I run stacker build I get the following error:

Value for variable BaselineCapacity must be of type <type 'int'>. Actual type: <type 'str'>.

Spareo avatar Aug 31 '18 00:08 Spareo

Hey @Spareo - thanks for the bug report. @troyready - not sure what the best way would be to deal with this. I'm wondering if we should have a cast lookup that can cast values as different types.

Another option is to make it so default knows the type of the variable and automatically tries to cast it correctly, though that would be a much deeper change.

phobologic avatar Sep 03 '18 18:09 phobologic

I like the cast idea. Would meet the need here in a simple way, and could always be cast off (pun not intended) in the future if it was made irrelevant.

troyready avatar Sep 30 '18 16:09 troyready