aws_sagemaker: Stack level tags get added to SageMaker CfnModelPackage causing deployment failure
- Dominant language
- TypeScript
- Stars
- 12.9k
- Forks
- 4.6k
- Avg merge
- 1d 19h
- Merged PRs (30d)
- 74
Description
### Describe the bug
When deploying a stack with tags set at the stack level, cdk tries to apply the tag to sagemaker model package which results in deployment error `Tags are not supported in Model Package versions. Please add them to the Model Package Group`.
The same code deployed without errors before this; the last successful deployment tested was in February 2025.
### Regression Issue
- [ ] Select this option if this issue appears to be a regression.
### Last Known Working CDK Version
2.175.1 (same version no longer works now)
### Expected Behavior
Tags should not be applied to untaggable resources as stated in the `Stack` class docstring:
### Current Behavior
CDK attempts to apply stack-level tags to sagemaker model package.
### Reproduction Steps
```py
from aws_cdk import App, Aws, Stack
from aws_cdk.aws_sagemaker import CfnModelPackage, CfnModelPackageGroup
class CustomStack(Stack):
def __init__(self, scope: App, construct_id: str, tags: dict):
super().__init__(scope, construct_id, tags=tags)
model_package_group = CfnModelPackageGroup(self, "ModelPackageGroup", model_package_group_name="name")
model_package = CfnModelPackage(
self,
"ModelPackage",
model_package_group_name=model_package_group.model_package_group_name,
model_package_version=1,
inference_specification=CfnModelPackage.InferenceSpecificationProperty(
containers=[
CfnModelPackage.ModelPackageContainerDefinitionProperty(
image=f"{Aws.ACCOUNT_ID}.dkr.ecr.{Aws.REGION}.amazonaws.com/test:latest",
)
],
supported_content_types=["application/x-recordio"],
supported_response_mime_types=["application/json"],
),
)
model_package.node.add_dependency(model_package_group)
```
### Possible Solution
_No response_
### Additional Information/Context
_No response_
### CDK CLI Version
2.175.1
### Framework Version
_No response_
### Node.js Version
2.175.1
### OS
Linux
### Language
Python
### Language Version
_No response_
### Other information
_No response_
Contributor guide
Research direction
Start by reproducing the provided Python stack with stack-level tags and inspect how AWS CDK applies tags to the SageMaker CfnModelPackage. Done means synthesis or deployment no longer applies tags to the untaggable model package, while supported resources such as the model package group can still receive stack-level tags.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- aws, python, typescript
- Domain
- cloud, infrastructure
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100