question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

E3012 "String" recommended for an external template parameter where type is "Number"

See original GitHub issue

cfn-lint version: 0.18.0

I define some of my template with sub-templates and everything is packaged with that kind of command line

aws cloudformation package --template-file ./sources/template-source.yaml --s3-bucket my-bucket-build --output-template-file final-template.yaml 

In template-source I have a resource which type is AWS::CloudFormation::Stack. It’s definition looks like that :

    ManagerService:
        Type: AWS::CloudFormation::Stack
        Properties:
            TemplateURL: ../../../common/service.yaml
            Parameters:
                Cluster: !Ref Cluster
                DesiredCount: 1

Here is the definition of the parameter in my service template :

Parameters: 

    Cluster:
        Description: Please provide the ECS Cluster ID that this service should run on
        Type: String
        
    DesiredCount: 
        Description: How many instances of this task should we run across our cluster?
        Type: Number
        Default: 1

And cfn-lint return the following error :

cfn-lint source-template.yaml
E3012 Property Resources/ManagerService/Properties/Parameters/DesiredCount should be of type String

It says that type should be a String, but the type in the template is define as Number. Am I missing something ?

Thanks for your help

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:11 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
BatmanTheBlindcommented, Feb 20, 2020

For the moment, I’ve disabled the check with the follwing .cfnlintrc file :

include_checks:
- I
configure_rules:
  E3012:
    strict: False
1reaction
phenecommented, May 21, 2019

@kddejong List parameters do not pass through to sub stacks successfully. If you have a CommaDelimitedList type in your main stack and you attempt pass it through to a CommaDelimitedList in the sub stack, you will get a failure. Only types that can be coerced to strings can be passed through to a substack, like numbers and booleans.

The only way to pass a list through is to !Join [',', !Ref MyList] as you pass it through to the sub stack.

I think configuring E3012 with strict: False would do the trick here.

Read more comments on GitHub >

github_iconTop Results From Across the Web

E3012 "String" recommended for an external template ...
In template-source I have a resource which type is AWS::CloudFormation::Stack . It's definition looks like that : ManagerService: Type: AWS:: ...
Read more >
Parameters - AWS CloudFormation
Use parameters to pass values to your template when creating or updating a stack so that you can customize each stack deployment.
Read more >
Template parameters and template arguments
A non-type template parameter must have a structural type, which is one of the following types (optionally cv-qualified, the qualifiers are ...
Read more >
How to create function in TypeScript based on another, but ...
Here's one way. We define a type that describes the selectFromObj function where the object type T is fixed, but the return type...
Read more >
Templates - Azure Pipelines | Microsoft Learn
Parameter data types ; number, may be restricted to values: , otherwise any number-like string is accepted ; boolean, true or false ;...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found