aws / aws/aws-cdk

(stepfunctions-tasks): SageMaker CreateModel roleArn should be able to take a JsonPath

Open
#24,903 1 comment 0 reactions 0 assignees View on GitHub
@aws-cdk/aws-stepfunctions-tasks bug effort/medium p3
Dominant language
TypeScript
Stars
12.9k
Forks
4.6k
Avg merge
2d 3h
Merged PRs (30d)
83

Description

### Describe the bug

the role parameter should be able to take in a JsonPath from a stepfunction workflow.

https://docs.aws.amazon.com/cdk/api/v1/docs/@aws-cdk_aws-stepfunctions-tasks.SageMakerCreateModel.html#role

### Expected Behavior

successful build

### Current Behavior

```
error TS2322: Type '{ role: TaskRole; }' is not assignable to type 'IRole'.
Object literal may only specify known properties, and 'role' does not exist in type 'IRole'.

38 role: { role: TaskRole.fromRoleArnJsonPath('$.roleArn') },
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

node_modules/aws-cdk-lib/aws-stepfunctions-tasks/lib/sagemaker/create-model.d.ts:17:14
17 readonly role?: iam.IRole;
~~~~
The expected type comes from property 'role' which is declared here on type 'SageMakerCreateModelProps'

Found 1 error.
```

### Reproduction Steps

```javascript
new SageMakerCreateModel(this, 'Create Model', {
modelName: JsonPath.format(
'{}-{}',
JsonPath.stringAt('$.jobName'),
JsonPath.stringAt('$.suffix')
),
role: { role: TaskRole.fromRoleArnJsonPath('$.roleArn') },
credentials: { role: TaskRole.fromRoleArnJsonPath('$.roleArn') },
primaryContainer: new ContainerDefinition({
image: DockerImage.fromJsonExpression(
JsonPath.stringAt('$.image')
),
modelS3Location: S3Location.fromJsonExpression(
JsonPath.stringAt('$.modelS3Location')
),
environmentVariables: TaskInput.fromJsonPathAt(
JsonPath.stringAt('$.environmentVariables')
),
})
```

### Possible Solution

_No response_

### Additional Information/Context

_No response_

### CDK CLI Version

2.14.0

### Framework Version

_No response_

### Node.js Version

14

### OS

linux

### Language

Typescript

### Language Version

_No response_

### Other information

_No response_

Contributor guide

Open the contributing guide

Research direction

Start with the SageMakerCreateModel entry point and the declared role type in node_modules/aws-cdk-lib/aws-stepfunctions-tasks/lib/sagemaker/create-model.d.ts. Reproduce the TypeScript error using the JsonPath role example and inspect the surrounding stepfunctions-tasks implementation. Done means a JsonPath-based role is accepted and the reported build succeeds.

Written by the indexing model from the issue text.

Assessment

Tech stack
aws, typescript
Domain
cloud, infrastructure
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.