-
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
[aws-resourcegroups] aws-resourcegroups requires an array for tags property but fails CFN stack creation with internal error #9040
Comments
Until this is resolved, you can use import * as cdk from '@aws-cdk/core';
import * as rg from '@aws-cdk/aws-resourcegroups';
export class Repro9040Stack extends cdk.Stack {
constructor(scope: cdk.Construct, id: string, props?: cdk.StackProps) {
super(scope, id, props);
const group = new rg.CfnGroup(this, 'MyGroup', {
name: 'mygroup'
});
group.addPropertyOverride('Tags', [
{
Key: 'Mykey',
Value: 'MyValue'
}
]);
}
} This will produce the following template: {
"Resources": {
"MyGroup": {
"Type": "AWS::ResourceGroups::Group",
"Properties": {
"Name": "mygroup",
"Tags": [
{
"Key": "Mykey",
"Value": "MyValue"
}
]
},
"Metadata": {
"aws:cdk:path": "Repro9040Stack/MyGroup"
}
}
}
} |
@eladb do we see this issue anywhere else in L1s? I'm not sure why this is getting typed as |
Any news on this? FYI, I have solved this with a CDK aspect:
|
Workaround for this bug in /// <summary>
/// Because of bug, we can't use CfnGroup directly
/// https://github.com/aws/aws-cdk/issues/9040
/// </summary>
public class CfnGroupTaggable : CfnGroup
{
public CfnGroupTaggable(Construct scope, string id, ICfnGroupProps props)
: base(scope, id, props) => Tags = new TagManager(TagType.KEY_VALUE, CFN_RESOURCE_TYPE_NAME);
public override TagManager Tags { get; }
} |
I think that problem start since this commit. |
This issue has not received any attention in 1 year. If you want to keep this issue open, please leave a comment below and auto-close will be canceled. |
description of the bug:
When adding tags to resource groups I am getting this error:
because the error keeps saying expects map of {key: value} I passed the tags like this:
This allowed me to get passed the CDK error, and it started creating the stack, however it failed with the internal error:
So I opened the cloudformation stack in designer and changed from:
This:
To This:
And it created successfully. So, to double check, I went back to the cdk app and changed the code to match what was successful in cloudformation:
And it errored out again:
Based on the above tests, CDK will not take the array, even though that is the only acceptable format for aws::resourcegroups::group . To verify, I checked the cdk code:
The above seems to indicate if it it is an array to throw the above error. Ref: https://github.com/aws/aws-cdk/pull/1762/files MapFormatter is the funciton that throws the error based on the output .
Environment
aws-cli/1.17.10 Python/2.7.16 Darwin/18.7.0 botocore/1.14.10 :
1.42.0 (build 3b64241)
~ node -v
v14.3.0
This is 🐛 Bug Report
The text was updated successfully, but these errors were encountered: