It is not guaranteed that all tags are supported in CDK or CloudFormation, as CDK essentially generates CloudFormation templates. Despite the fact that AWS resources themselves may support tagging, CDK is still a relatively new project with frequent updates, making it sometimes challenging to differentiate between intended functionality and minor bugs.
Currently, CloudFormation's AWS::Logs::LogGroup resource lacks tagging support. Although a PR to add tags via CloudFormation was recently merged in May 2021, it has yet to be publicly released. As a result, tagging for this particular resource is not currently supported by CDK/CloudFormation; an update to CDK will likely be required once this feature becomes available in CloudFormation.
To determine tag support, one can apply tags to all resources within a CDK app construct using the CDK aspect. Refer to Tagging. By replacing myConstruct
with the entire CDK app construct, all resources in the app will inherit the tag, facilitating easy application of project-wide tags such as project code or environment identifiers.
Tags.of(myConstruct).add('key', 'value');
This process can also be accomplished using core.Tag.add:
# In Python
from aws_cdk import (
core
)
core.Tag.add(
scope=app,
key=key,
value=value
)
If a CDK-created AWS resource lacks a specific tag, it indicates that CDK does not currently support tagging for that particular resource.
Before spending significant time troubleshooting issues, it's advisable to search through CDK GitHub issues to potentially uncover existing bug reports.