Adding tags to CfnCrawler
results in invalid tag input
#30992
-
I think I am missing something as everything I try to tag this CfnCrawler gives back:
As far as I can tell, in the CDK they're using Notes:
scenario 1:export interface TagProps {
/**
*key as string
*/
readonly key: string
/**
* value of tag as string
*/
readonly value: string
}
const tagProps: TagProps[] = [{key: "testKey", value: "testValue"}]
const crawler: glue.CfnCrawler = new glue.CfnCrawler(this, `Crawler`, {
...crawler props
tags: tagProps
}) Result: scenario 2:... TagProps interface
const tagProps: TagProps[] = [{key: "testKey", value: "testValue"}]
const crawler: glue.CfnCrawler = new glue.CfnCrawler(this, `Crawler`, {
...crawler props
tags: undefined
})
// Trying to use the CDK Tag class
tagProps.forEach((tag: TagProps) => new Tag(tag.key, tag.value, { includeResourceTypes: ['CfnCrawler']})) Also tried using the Result: scenario 3:... TagProps interface
const tagProps: TagProps[] = [{key: "testKey", value: "testValue"}]
const crawler: glue.CfnCrawler = new glue.CfnCrawler(this, `Crawler`, {
...crawler props
tags: undefined
})
// Trying to use the CDK Tag class
tagProps.forEach((tag: TagProps) => Tags.of(crawler).add(tag.key, tag.value, { includeResourceTypes: ['CfnCrawler']})) Also tried using the Result: scenario 4:... TagProps interface
const crawler: glue.CfnCrawler = new glue.CfnCrawler(this, `Crawler`, {
...crawler props
tags: undefined,
})
const tagProps: TagProps[] = [{key: "testKey", value: "testValue"}]
// Trying to use the exact "type" as the CfnCrawler as per Docs
let crawlerTags: {"Key": string, "Value": string}[] = []
tagProps.forEach((tag: commonLib.TagProps) => crawlerTags.push({"Key": tag.key, "Value": tag.value}))
const cfnCrawler = (crawler.node.defaultChild as CfnCrawler)
cfnCrawler.addPropertyOverride('Tags', crawlerTags) Result: scenario 5:... TagProps interface
const tagProps: TagProps[] = [{key: "testKey", value: "testValue"}]
const crawler: glue.CfnCrawler = new glue.CfnCrawler(this, `Crawler`, {
...crawler props
tags: tagProps ? new Map(tagProps.map(object => { return [object.key, object.value] })) : undefined,
}) Result: I would appreciate any help in this 😄 |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Hi, |
Beta Was this translation helpful? Give feedback.
Hi,
I had the same issue you did, but managed to get around it by using the
setTag
method by doingcrawler.tags.setTag('key','value')