-
Notifications
You must be signed in to change notification settings - Fork 4.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
aws cloudformation package
breaks certain string literals in templates
#3991
Comments
aws cloudformation package
modifies certain string values to numbersaws cloudformation package
removes quotes of certain string values
aws cloudformation package
removes quotes of certain string valuesaws cloudformation package
removes quotes of certain string literals
$ python3
Python 3.7.2 (default, Feb 12 2019, 08:15:36)
[Clang 10.0.0 (clang-1000.11.45.5)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from awscli.customizations.cloudformation.yamlhelper import yaml_parse, yaml_dump
>>> parsed = yaml_parse('sevens: "077777777777"\neights: "088888888888"')
>>> parsed
OrderedDict([('sevens', '077777777777'), ('eights', '088888888888')])
>>> yaml_dump(parsed)
"sevens: '077777777777'\neights: 088888888888\n" It seems quotes are erased during dumping to yaml. $ python3
Python 3.7.2 (default, Feb 12 2019, 08:15:36)
[Clang 10.0.0 (clang-1000.11.45.5)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import yaml
>>> yaml
<module 'yaml' from '/usr/local/Cellar/awscli/1.16.110/libexec/lib/python3.7/site-packages/yaml/__init__.py'>
>>> yaml.dump({"sevens": "077777777777", "eights": "088888888888"}, default_flow_style=False)
"eight: 088888888888\nseven: '077777777777'\n" Seems a bug of PyYAML?:thinking: |
I thought PyYAML generates invalid yaml, but PyYAML parses correctly (as string type) without quotes.
I suspect either PyYAML or the yaml parser used in CloudFormation API is not following the yaml spec (related to octal base int type and string type without quotes) and causing this issue. https://yaml.org/type/int.html In any case, |
aws cloudformation package
removes quotes of certain string literalsaws cloudformation package
breaks certain string literals in templates
Any updates? |
I guessed that CloudFormation API uses SnakeYAML from its behavior, so I filed an issue for SnakeYAML. https://bitbucket.org/snakeyaml/snakeyaml/issues/442 The SnakeYAML author says that it is a bug in YAML 1.1 spec... I think aws-cli should dump strings in YAML with quotes for parser interoperability. |
We are looking into this issue. @sanathkr, what are your thoughts? |
We are running into a similar issue. We have Account ID as the key in template.yaml: template.yaml
After the packaged.yaml
The subsequent
We would appreciate suggestions to any workarounds. Thanks! |
Having the exact same issue outlined by @beibeiyang above. Any updates? |
I'm experiencing the same weird issue. Very weird. Things up to 7 are working, and 8 will break as per above issue. |
I've also encountered the same issue (awscli 1.16.199), any updates or plans to produce updates? |
Same issue here, when following instructions to create a bucket policy for us-east-2, using was-cli 1.16.260: |
I've switched to use AWS CDK after all. |
@justnance Is this still being worked on? Is there a workaround? |
This breaks the creation of Cognito UserPool because the MFAConfiguration requires quotes surrounding the "OFF" value these are stripped off by the cli . Is there any workaround to force quotes ? |
@idm-ryou Did you find a workaround in the sam template for account_id map lookup? |
@lmayorga1980 I found a workaround. I had to move the reference to the offending numerical string to the top level template file (since I was using it in a nested stack), and then add |
Today I faced strange error with templates and parameters which were working without any issues:
This Investigation showed that aws-cli 2 (2.0.7 and 2.0.9) converts these strings to just This should be fixed ASAP. |
We were having the same problem in our SAM template since our account starts with a '0' as well. I was able to get around it by using See here: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/pseudo-parameter-reference.html |
I have just run into the same issue when trying to stand up one AWS genomics' cloudformation stacks. It uses a parameter of type
So it appears that at some point yes and no become true and false. The workaround is to just pass the strings |
Experiencing the same issue with account IDs as Map keys. |
This causes problems for a string with colons like so: Resources:
WindowsFileSystemWithAllConfigs:
Type: "AWS::FSx::FileSystem"
# ...
WindowsConfiguration:
WeeklyMaintenanceStartTime: "4:16:30"
DailyAutomaticBackupStartTime: "01:00"
# ... It will be come Example error while deploying:
|
We’re running into this on our end as well. It's surprising and concerning that this issue is 2 years old is still unaddressed. |
I just ran into this issue to seems sporadic as well was working and all of a sudden stopped working on a template that was working |
I have encountered the same issue. I can replicate this issue on v 1.19.97 of the CLI |
Encounter this issue in aws-cli/2.7.3 Python/3.9.11. The single quote from Time being remove by package for AWS::DLM::LifecyclePlicy PolicyDetails Schedules CreateRules. Submitted Template: Produced by package command: |
I see the issue when trying to create a custom resource for the AWS Instance Scheduler. It works in the CodeBuild image It does not work with CodeBuild image The input looks like this:
Output looks like this:
|
CloudFormation template
template.yml
template_child.yml
Commands to reproduce
Quotes of
Value8
andValue9
are removed afteraws cloudformation package
.It seems that leads to the values interpreted as numbers during stack operation.
If I use the values for
!Sub
, values will be like9.9999999999E10
, which is unintended and cause errors.The text was updated successfully, but these errors were encountered: