Tags not working after version 0.34.0
See original GitHub issueDescribe the bug After adding this PR (https://github.com/awslabs/aws-cdk/pull/2185) into the library we cannot deploy Tags anymore. We get a validation error
To Reproduce With version:
$ cdk --version
0.34.0 (build 523807c)
Create new sample App:
$ cdk init sample-app --language=typescript
Add tags:
#!/usr/bin/env node
import cdk = require('@aws-cdk/cdk');
import { CdkHacksStack } from '../lib/cdk-hacks-stack';
const app = new cdk.App();
new CdkHacksStack(app, 'CdkHacksStack', {
env: {
region: 'eu-west-1'
},
tags: {
hack: 'nope!'
}
});
Run deploy:
$ npx cdk deploy
Result:
❌ CdkHacksStack failed: MultipleValidationErrors: There were 3 validation errors:
* MissingRequiredParameter: Missing required key 'Key' in params.Tags[0]
* MissingRequiredParameter: Missing required key 'Value' in params.Tags[0]
* UnexpectedParameter: Unexpected key '0' found in params.Tags[0]
There were 3 validation errors:
* MissingRequiredParameter: Missing required key 'Key' in params.Tags[0]
* MissingRequiredParameter: Missing required key 'Value' in params.Tags[0]
* UnexpectedParameter: Unexpected key '0' found in params.Tags[0]
Expected behavior It should deploy the app without validation errors.
Version:
- OS: OS X
- Programming Language: Typescript
- CDK Version: 0.34.0
I’ve been debugging a bit and it looks like in the class param_validator
the Tags object is an array of arrays [ [ { Key: 'hack', Value: 'nope!' } ] ]
. Manually changing this file to flatten the Tags
object solves the problem:
if (params.Tags) {
params.Tags = params.Tags[0];
}
The unique way I found the feature working is when passing the parameters in the CLI.
Issue Analytics
- State:
- Created 4 years ago
- Reactions:7
- Comments:6 (6 by maintainers)
Top Results From Across the Web
Missing tags after SVN to Git conversion - Stack Overflow
In the SVN repo are tags from version 0.1 up to 0.35.2, but in the Git repo I only have the tags 0.33.10,...
Read more >Changelog Validation error | Package Validation Suite | 0.34.0 ...
To fix the error you have to publish a new version which replaces the unreleased tag by the new version being published.
Read more >SAMTOOLS SORT — Snakemake Wrappers tags/0.34.0 ...
Sort bam file with samtools. Software dependencies¶. samtools ==1.6. Example¶. This wrapper can be used in the following way:.
Read more >fabric8io/docker-maven-plugin
Use this variable if you are using an older version of docker not ... if set to true then certificates will be regenerated...
Read more >Unified Service Tagging - Datadog Docs
To configure pod-level metrics, add the following standard labels ( tags.datadoghq.com ) to the pod spec of a Deployment, StatefulSet, or Job:.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hi @skinny85 , using the flatmap does the job (as it returns and empty array), so your pr works. I was been more “brute” on my code change.
I notice another “issue” with the constructor part.
That will not synth the tags. It will apply them, with your change, but not synth them.
If you do applyAspect, it does synth fine.
This might be either a think that I didn’t pick up in my tests, or something todo with the division of the synth and deploy steps.
Hi @AlexRex ,
I might be wrong but I think that it seems that there has been an issue with a refactoring of the code:
I think this: https://github.com/awslabs/aws-cdk/commit/b2e196446be7693d991ce725d8e506d74a6c5d3c#diff-a8a1e8d6c0687920790eb29fc6ea3eabL241
does not produce the same as: https://github.com/awslabs/aws-cdk/commit/b2e196446be7693d991ce725d8e506d74a6c5d3c#diff-d36d206d318a0ef98e48d1789880b6e9R143
So I think is related to https://github.com/awslabs/aws-cdk/pull/2731
Might be worth checking with @eladb about the refactoring from https://github.com/awslabs/aws-cdk/pull/2731.
I am really happy to help, and will probably spend a bit of time tomorrow morning trying to understand the cruds of the refactoring done, but my knowledge of cdk code/core is limited to a month trying to get that cdk deploy tags working 😉
Thanks and apologies again @AlexRex