-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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
Issue importing with CfnInclude when template do not have quotes #13709
Comments
Hi @vincent851 , Thanks for opening the issue. Can you please attach the template that is causing this error? Thanks, |
AWSTemplateFormatVersion: 2010-09-09
Resources:
RootRole:
Type: "AWS::IAM::Role"
Properties:
AssumeRolePolicyDocument:
Version: 2012-10-17
Statement:
-
Effect: "Allow"
Principal:
Service:
- "ec2.amazonaws.com"
Action:
- "sts:AssumeRole"
Path: "/"
RolePolicies:
Type: "AWS::IAM::Policy"
Properties:
PolicyName: "root"
PolicyDocument:
Version: 2012-10-17
Statement:
- Effect: "Allow"
Action: "*"
Resource: "*"
Roles:
- Ref: "RootRole"
RootInstanceProfile:
Type: "AWS::IAM::InstanceProfile"
Properties:
Path: "/"
Roles:
- Ref: "RootRole" |
I am editing the above to remove the quotes to match the issue I have. the above will still work with AWS CLI but will not work when deploying via CDK. the CDK Will built but deployment will fail |
Thanks for the template @vincent851 . I can confirm I'm able to reproduce the problem. I have a guess what happens (the YAML library interprets |
Currently, we are using the `yaml-1.1` schema when de-serializing YAML documents, Unfortunately, this has the side effect of treating unquoted parts of the template like '2010-09-09' as Date objects, instead of just simple strings. This has been noted by a customer using the cloudformation-include module, but I assume a very similar problem exists for other places we parse YAML, like cloudformation-diff. Switch to the `core` schema from `yaml-1.1`, where those are treated as strings, instead of dates. Fixes aws#13709
Currently, we are using the `yaml-1.1` schema when de-serializing YAML documents, Unfortunately, this has the side effect of treating unquoted parts of the template like '2010-09-09' as Date objects, instead of just simple strings. This has been noted by a customer using the cloudformation-include module, but I assume a very similar problem exists for other places we parse YAML, like cloudformation-diff. Switch to the `core` schema from `yaml-1.1`, where those are treated as strings, instead of dates. Fixes aws#13709
Currently, we are using the `yaml-1.1` schema when de-serializing YAML documents, Unfortunately, this has the side effect of treating unquoted parts of the template like '2010-09-09' as Date objects, instead of just simple strings. This has been noted by a customer using the cloudformation-include module, but I assume a very similar problem exists for other places we parse YAML, like cloudformation-diff. Switch to the `core` schema from `yaml-1.1`, where those are treated as strings, instead of dates. Fixes #13709 ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
|
Currently, we are using the `yaml-1.1` schema when de-serializing YAML documents, Unfortunately, this has the side effect of treating unquoted parts of the template like '2010-09-09' as Date objects, instead of just simple strings. This has been noted by a customer using the cloudformation-include module, but I assume a very similar problem exists for other places we parse YAML, like cloudformation-diff. Switch to the `core` schema from `yaml-1.1`, where those are treated as strings, instead of dates. Fixes aws#13709 ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
Currently, we are using the `yaml-1.1` schema when de-serializing YAML documents, Unfortunately, this has the side effect of treating unquoted parts of the template like '2010-09-09' as Date objects, instead of just simple strings. This has been noted by a customer using the cloudformation-include module, but I assume a very similar problem exists for other places we parse YAML, like cloudformation-diff. Switch to the `core` schema from `yaml-1.1`, where those are treated as strings, instead of dates. Fixes aws#13709 ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
I encounter this issue when trying to import CloudFormation YAML Template to create IAM role.
The template have the following header:
AWSTemplateFormatVersion: 2010-09-09
and also version with date
Version: 2012-10-17.
The error I encounter is when trying to deploy the template to the AWS via CDK.
The build is fine but when deploying I encounter the following error:
failed: Error [ValidationError]: Template format error: unsupported value for AWSTemplateFormatVersion.
I noticed that the same template can be deploy via AWS CLI and validated without issue using:
aws cloudformation create-stack --stack-name
and
aws cloudformation validate-template --template-body
I think this is a bug because AWS CLI have no issue with this why would deploying via CDK raises error.
Reproduction Steps
Deploying via CDK with any template with the above header would work that do not have quotes around the date.
What did you expect to happen?
it would throw an error
failed: Error [ValidationError]: Template format error: unsupported value for AWSTemplateFormatVersion.
What actually happened?
failed: Error [ValidationError]: Template format error: unsupported value for AWSTemplateFormatVersion.
Environment
Other
This is 🐛 Bug Report
The text was updated successfully, but these errors were encountered: