-
Notifications
You must be signed in to change notification settings - Fork 597
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
From Cloudformation documentation, tags should be expressed as arrays of Key/Value #3719
Comments
If you use your template against the service early validation will fail with:
From this I think you need to follow the Tag structure of mapping like |
Hello @kddejong, thanks for your input. I am not sure about what you call the "service early validation", I suppose this is related to the CLI command So I have tested it with the following template: AWSTemplateFormatVersion: '2010-09-09'
Resources:
TesJobDefinition:
Properties:
Tags:
- Key: key
Value: value
Type: Container
Type: AWS::Batch::JobDefinition And the result seems to be a success (0 status code): ❯ aws cloudformation validate-template --template-body file://test.yaml
{
"Parameters": []
} Can you give me a bit more details so that I am sure that we are talking about the same validation process? Also the comments I have highlighted in the issue description make the distinction between what is said in the Clouformation documentation and the Cloudformation specification. Where is this specification available if this is not the documentation? |
Early validation is where the property values are validated against the provider schema To use this feature you have to create a stack with that template. |
OK, so looking at the provider schema (eu-west-3 in my case) for "Tags" : {
"type" : "object"
} Now I understand your point, so the issue is troposphere generating an array of Key/Value instead of a dictionary or me badly using troposhere. |
CloudFormation Lint Version
cfn-lint 1.10.0
What operating system are you using?
Linux hepao 6.6.49-NixOS SMP PREEMPT_DYNAMIC Wed Sep 4 11:28:31 UTC 2024 x86_64 GNU/Linux
Describe the bug
Looking at CloudFormation documentation regarding tags on, for instance, Batch job definitions, a template for this type of resource would be (from my understanding):
But
cfn-lint
validation fails:Expected behavior
The expectation would be that the example template is valid.
Nevertheless, I must say that I find the Cloudformation documentation on this point particularly awkward as I would have expected an object to express a list of tags.
As a matter of fact, this is what
cfn-lint
currently considers as valid:But as the current CloudFormation documentation goes, other tools like cloudtools/troposphere seem to follow it and generate tags as arrays of Key/Value.
Looking at PRs related to this, I have stumbled upon #3437 which seems to say that the Cloudformation specification says "object" and the documentation says "array".
As troposphere also uses the Cloudformation specification to generate most of its code, I am rather puzzled...
So, which one is right?
And where is the source of truth if not the Cloudformation documentation?
Reproduction template
The text was updated successfully, but these errors were encountered: