aws / aws/aws-cli

`aws cloudformation package` breaks certain string literals in templates

Open
#3,991 28 comments 8 reactions 0 assignees View on GitHub
bug cloudformation package-deploy customization p2
Dominant language
Python
Stars
17.3k
Forks
4.6k
Avg merge
1d 2h
Merged PRs (30d)
13

Description

### CloudFormation template
#### `template.yml`
```yaml
Parameters:
Value7:
Type: String
Default: "077777777777"
Value8:
Type: String
Default: "088888888888"
Value9:
Type: String
Default: "099999999999"
Resources:
NestedStack:
Type: AWS::CloudFormation::Stack
Properties:
TemplateURL: ./template_child.yml
```

#### `template_child.yml`
```yaml
# This template is not so important
Resources:
Dummy:
Type: Custom::Whatever
Properties:
ServiceToken: whatever
Value1: whatever
```

### Commands to reproduce
```console
$ uname -a
Darwin xxxxxxx 18.2.0 Darwin Kernel Version 18.2.0: Thu Dec 20 20:46:53 PST 2018; root:xnu-4903.241.1~1/RELEASE_X86_64 x86_64

$ aws --version
aws-cli/1.16.110 Python/3.7.2 Darwin/18.2.0 botocore/1.12.100

$ aws cloudformation package --s3-bucket BUCKET_NAME --template-file template.yml
Uploading to 137ce8b72427772da39a43ddc087908a.template 101 / 101.0 (100.00%)
Parameters:
Value7:
Type: String
Default: '077777777777'
Value8:
Type: String
Default: 088888888888
Value9:
Type: String
Default: 099999999999
Resources:
NestedStack:
Type: AWS::CloudFormation::Stack
Properties:
TemplateURL: https://s3.amazonaws.com/BUCKET_NAME/137ce8b72427772da39a43ddc087908a.template
```

Quotes of `Value8` and `Value9` are removed after `aws 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 like `9.9999999999E10`, which is unintended and cause errors.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.