cfn-language-discussion icon indicating copy to clipboard operation
cfn-language-discussion copied to clipboard

New YAML plz

Open richardhboyd opened this issue 2 years ago • 2 comments

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Tell us about your request

What do you want us to build? Support a newer version of YAML that doesn’t treat AWS Account ID strings as sexagesimal integers

Tell us about the problem you are trying to solve. What are you trying to do, and why is it hard?

What outcome are you trying to achieve, ultimately, and why is it hard/impossible to do right now? What is the impact of not having this problem solved? The more details you can provide, the better we will be able to understand and solve the problem.

The current version of YAML used by CFN has a very nice feature

Are you currently working around this issue?

How are you currently solving this problem?

Horrible horrible string escaping and CFN mapping shenanigans.

Some people say “use a !ref AccountId” but that doesn’t help when the account ID is a key in a CFN mapping

What is the expect behavior with this new feature

Please include some code examples showing how this feature can be used.

Don’t strip leading zeroes form account IDs

Additional context

Anything else we should know?

Attachments

If you think you might have additional information that you wouldd like to include via an attachment, please do - we will take a look. (Remember to remove any personally-identifiable information.)

https://blog.rowanudell.com/aws-accounts-with-leading-zeros/ https://github.com/aws/serverless-application-model/issues/1469

https://github.com/aws/serverless-application-model/issues/200#issuecomment-570701231

richardhboyd avatar May 09 '22 23:05 richardhboyd

@richardhboyd Thanks for your contribution! We'll triage and take a look at it. Stay tuned for updates!

muneebar avatar May 10 '22 18:05 muneebar

Support a newer version of YAML that doesn’t treat AWS Account ID strings as sexagesimal integers

For the record, a newer version would mean >= yaml 1.2, which has (among others) these changes:

  • Only true and false strings are parsed as booleans (including True and TRUE); y, yes, on, and their negative counterparts are parsed as strings.
  • Underlines _ cannot be used within numerical values.
  • Octal values need a 0o prefix; e.g. 010 is now parsed with the value 10 rather than 8.
  • The binary and sexagesimal integer formats have been dropped.

Notes: Only upgrading the yaml spec will not completely solve the issue. 001122334455 will no longer be read as octal (so 155826477 in decimal), but still as 1122334455 (without leading zeros). This means that resource providers should know how to add zeroes to construct an account id.

An alternative would be to be aware of the resource schema when parsing yaml, and not converting to an (internal) integer, when the resource property expects a string.

It would also be nice if cfn-lint can flag for these changes. Customers might be using 'yes/no' instead of 'true/false' for booleans

benbridts avatar May 20 '22 16:05 benbridts