Open2

StepFunction -> ECS

ふじしろふじしろ

containerOverrideがうまくいかない

  1. StepFunctionからStates.Array()でECSの起動に成功
  2. cdkでの実装にあたりJsonPath.Array()を使用
  3. 対応しているものかと思いきや型の違いによりエラー
  4. 色々試すも解決せず
  5. evaluate expressionを用いて対応して解決した

https://qiita.com/kazuhiro1982/items/c2b56c7b8b26966ed25b
expressionの部分はJsonPathが文字列内に含まれていても勝手に置換してくれた

↓具体的なイメージとしてこういう書き方ができた

 expression: '[ "aggregate.sh", "target=$.target" ]',

https://docs.aws.amazon.com/cdk/api/v1/docs/aws-stepfunctions-tasks-readme.html#evaluate-expression

追記

この件についてはIssueが建てられており、その中で対策が提示されている
https://github.com/aws/aws-cdk/issues/24057

I ran into the same issue just now and could create a workaround for myself by using the same method call that JsonPath.listAt makes underneath directly (circumventing its validator). In Golang it ends up looking like this: awscdk.Token_AsList(awsstepfunctions.JsonPath_Array(jsii.String(awsstepfunctions.JsonPath_StringAt("$.foobar")))). I believe in Typescript it should look like this in the end: Token.asList(JsonPath.array(JsonPath.stringAt("$.foobar")))

(訳)私も今同じ問題に遭遇しましたが、そのJsonPath.listAt下にある同じメソッド呼び出しを直接使用することで(そのバリデーターを回避して)、回避策を作成することができました。Golang では、最終的には次のようになります。Typescriptawscdk.Token_AsList(awsstepfunctions.JsonPath_Array(jsii.String(awsstepfunctions.JsonPath_StringAt("$.foobar"))))では、最終的には次のようになると思います。Token.asList(JsonPath.array(JsonPath.stringAt("$.foobar")))

要確認