vague memory

うろ覚えを無くしていこうともがき苦しむ人の備忘録

AWS Step Functions から CodeBuild 呼び出しでパラメータを渡す

Step Functions から CodeBuild が呼び出せますが、その際にパラメータを渡す方法にちょっと嵌ったのでメモ。

結論から、ドキュメント読みましょうでした。

Note
Parameters in Step Functions are expressed in PascalCase, even when the native service API is camelCase.

上記のページからパラメータごとに各API Referenceページにリンクされていますが、 API Reference 記載のままでは利用できません。

保存する際に以下のようなエラーになります。

The field "xxxxx" is not supported by Step Functions

環境変数を上書きする場合、environmentVariablesOverride を使用します。 記載されている構文が以下だった場合でも、

  • Request Syntax(抜粋)
   "environmentVariablesOverride": [ 
      { 
         "name": "string",
         "type": "string",
         "value": "string"
      }
   ],

Step Function の定義時の各キーは先頭大文字(EnvironmentVariablesOverride)にする必要があります。

  • State machine Definition
    "CodeBuild StartBuild": {
      "Type": "Task",
      "Resource": "arn:aws:states:::codebuild:startBuild.sync",
      "Parameters": {
        "ProjectName": "xxxxx",
        "EnvironmentVariablesOverride": [
          {
            "Name": "Env",
            "Type": "PLAINTEXT",
            "Value": "dev"
          }
        ]
      },
      "End": true
    }