[stepfunctions]: Adjusting parameters in ContainerOverride of EcsRunTask
- Dominant language
- TypeScript
- Stars
- 12.9k
- Forks
- 4.6k
- Avg merge
- 2d 3h
- Merged PRs (30d)
- 83
Description
### Describe the bug
The EcsRunTask construct only accepts an array of strings as override commands. It cannot produce substitutable output like "Command.$": "$.commands" that's needed to read the override command from the execution input. This is a limitation of the CDK implementation, not of the ECS optimized integration itself. Using the 'CallAwsService' construct allows you to get around this, but the CallAwsService doesn't allow you to set the IntegrationPattern as RUN_JOB (.sync).
In simpler terms:
Using Amazon States language, you can set the ContainerOverride field for an EcsRunTask, for example, as
`"Command.$": "States.Array($.Foo,$.Bar,$.FooBar)"`
However, if you use CDK, this is not possible, because there is no method to adjust parameters in the ContainerOverride method.
CDK code will always generate:
`"Command": "States.Array($.Foo,$.Bar,$.FooBar)"`
missing the .$ after Command.
### Expected Behavior
What I expect is for there to be a way to adjust previously set parameters for the ContainerOverride. (As a side, having the ability to set a new execution role for the container override would also be incredibly useful).
Currently, neither of the two are possible. ContainerOverride's 'command' only accepts JsonPath.listAt. However, it doesn't accept JsonPath.stringAt() or JsonPath.Array().
### Current Behavior
If you try to set the container field as
```
const FooBar = new tasks.EcsRunTask(this, 'Foobar', {
containerOverrides: [{
command: JsonPath.array(('States.Array($.Foo,$.Bar,$.Foo,$.Bar,$.Foo)'),
}],
```
There'll be a red squiggly line under command, saying:
Type 'string' is not assignable to type 'string[]'
If you put square brackets around it:
```
const FooBar = new tasks.EcsRunTask(this, 'Foobar', {
containerOverrides: [{
command: [JsonPath.array(('States.Array($.Foo,$.Bar,$.Foo,$.Bar,$.Foo)')],
}],
```
You get an error saying:
''Cannot use JsonPath fields in an array, they must be used in objects''
### Possible Solution
_No response_
### Additional Information/Context
-
### CDK CLI Version
2.63.2
### Framework Version
_No response_
### Node.js Version
v19.4.0
### OS
MacOS
### Language
Typescript
### Language Version
_No response_
### Other information
_No response_
Contributor guide
Research direction
Start at the EcsRunTask ContainerOverride API and the Amazon States Language emitted for containerOverrides; compare how CallAwsService handles parameterized fields and integration patterns. Done means a CDK caller can express Command.$ for an ECS container override, with tests proving the synthesized definition preserves the correct .$ form.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- aws, typescript
- Domain
- cloud, infrastructure
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100