Skip to content
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

String starting with 0 ("0xx..") is taken as integer with "aws cloudformation package" command #6908

Closed
AnuragChandra10 opened this issue May 2, 2022 · 5 comments
Assignees
Labels
bug This issue is a bug. cloudformation package-deploy response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days.

Comments

@AnuragChandra10
Copy link

Describe the bug

While creating a package using aws cloudformation package command and then using the aws cloudformation create-stack command using to create the packaged template leads to take a string parameter starting with "0" as string. This happens only with aws-cli/1.23.1 (likely with aws-cli 1.x versions as aws-cli/1.23.1 is a fairly new version at present).

Expected Behavior

The parameter stored should be the account ID as it is: 012345678901

Current Behavior

The string is being stored as a number with scientific notation.

Reproduction Steps

Use a Template with parameter starting with "0":

Mappings: 
  GovAccountMapping: 
    dev: 
      AccountId: "012345678901"

Resources:
  BasicParameter:
    Type: AWS::SSM::Parameter
    Properties:
      Name: "accountId"
      Type: String
      Value: !FindInMap [GovAccountMapping, dev , AccountId]
      Description: SSM Parameter for running date command.

Package command: aws cloudformation package --template-file parameter.yaml --s3-bucket bucket-name --output-template-file packaged-template.yaml

Stack creation: aws cloudformation create-stack --stack-name myteststack --template-body file://packaged-template.yaml

Possible Solution

A workaround at present is to use the --use-json option to format the output template as json.

Additional Information/Context

No response

CLI version used

aws-cli/1.23.1

Environment details (OS name and version, etc.)

Mac OS

@AnuragChandra10 AnuragChandra10 added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels May 2, 2022
@tim-finnigan tim-finnigan self-assigned this May 2, 2022
@tim-finnigan tim-finnigan added cloudformation package-deploy and removed needs-triage This issue or PR still needs to be triaged. labels May 2, 2022
@tim-finnigan
Copy link
Contributor

Hi @AnuragChandra10 thanks for reaching out. Could you provide the debug logs by adding --debug to the command? (Please redact any sensitive information.) That would help give us more insight into what's going on.

@tim-finnigan tim-finnigan added the response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days. label May 2, 2022
@AnuragChandra10
Copy link
Author

Hi @tim-finnigan please find the requested logs:

package command output:
package-cmd-output.txt

create-stack command output:
create-stack-cmd-output.txt

@tim-finnigan
Copy link
Contributor

Thanks @AnuragChandra10. I found this was reported in another issue here: #3991 (comment) and they mentioned a workaround:

I was able to get around it by using !Ref 'AWS::AccountId' where I needed the account ID.

Would that work in your case?

I saw a couple of other issues in different repositories where this problem was also mentioned:
aws-cloudformation/aws-cloudformation-templates#210 and aws/serverless-application-model#200.

@tim-finnigan
Copy link
Contributor

We haven't heard back in over a month so I'm going to close this. If you're still experiencing the issue please follow up on my earlier comment and we can reopen this.

@github-actions
Copy link

github-actions bot commented Jun 6, 2022

⚠️COMMENT VISIBILITY WARNING⚠️

Comments on closed issues are hard for our team to see.
If you need more assistance, please open a new issue that references this one. If you wish to keep having a conversation with other community members under this issue feel free to do so.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This issue is a bug. cloudformation package-deploy response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days.
Projects
None yet
Development

No branches or pull requests

2 participants