aws-samples / appstream-serverless-image-creation-automation

This repository contains the file associated with the Amazon AppStream 2.0 Serverless Image Automation blog posts.
MIT No Attribution
10 stars 6 forks source link

State machine state definitions use input JSON incorrectly #3

Open rc-jonnyl opened 1 year ago

rc-jonnyl commented 1 year ago

Many of the Task States for the state machine created in the Windows CloudFormation use parameters from the "AutomationParameters" dictionary in the input JSON. for example:

"Check Builder Status (Create)": {
                  "Type": "Task",
                  "Resource": "arn:aws:states:::aws-sdk:appstream:describeImageBuilders",
                  "Parameters": {
                    "Names.$": "States.Array($.AutomationParameters.ImageBuilderName)"
                  },
                  "ResultPath": "$.BuilderStatus",
                  "Next": "Is Builder Created and Running?"
                },

This JSON path does not however match the actual input JSON. Example input data:

{
  "ExecutedVersion": "$LATEST",
  "Payload": {
    "AutomationParameters": {
      "ImageBuilderName": "Automated_Builder",
      "ImageBuilderType": "stream.standard.medium",
      ...

To get these States to function, I therefore had to update the parameters to include ".Payload" in the path:

"Parameters": {
                    "Names.$": "States.Array($.Payload.AutomationParameters.ImageBuilderName)"
                  },
rc-jonnyl commented 1 year ago

This appears to also be an issue in the lambda functions e.g.

S3Bucket = event['AutomationParameters']['PackageS3Bucket']