Hi,
It seems that Sceptre somehow interprets variables starting with 0 as octal and converts them to decimal. This is a an Issue because we have user names that start with 0. Here is the example
Sceptre Config file:
sceptre_user_data:
env:
user: {{ var.user }}
sceptre --var "user=03303560" launch TEST/s3
When I execute this the value in the deployed cloudformation template becomes 886640.
Is it possible to do something about this?
Thanks!
Hi, this is probably due to how YAML works.
(more info: https://stackoverflow.com/questions/54820256/how-to-read-load-yaml-parameters-with-leading-zeros-as-a-string)
I'd suggest to treat these numbers as strings 'user="03303560"' unless you really need it to be an integer starting with zero.
Thanks @1oglop1 , that make sense. I need to figure out because actually I use sceptre --var "user=${USER}" launch TEST/s3 and then I pass User as env variable in gitlab-ci:
variables:
USER: 03303560
Therefore, I need to substitute $USER for 03303560
Blind shot, but try out this:
sceptre_user_data:
env:
user: !!str {{ var.user }}
https://yaml.org/type/str.html
here is what's going to happen (what I expect to happen):
sceptre --var "user=03303560" will be rendered correctly from jinja!!str 03303560 will make sure that whatever the value is, it's represented as string.After using !!str 03303560 the string was still converted to 886640
Most helpful comment
Hi, this is probably due to how YAML works.
(more info: https://stackoverflow.com/questions/54820256/how-to-read-load-yaml-parameters-with-leading-zeros-as-a-string)
I'd suggest to treat these numbers as strings 'user="03303560"' unless you really need it to be an integer starting with zero.