This site is in read only mode. Please continue to browse, but replying, likes, and other actions are disabled for now.

⚠️ We've moved!

Hi there!

To reduce project dependency on 3rd party paid services the StackStorm TSC has decided to move the Q/A from this forum to Github Discussions. This will make user experience better integrated with the native Github flow, as well as the questions closer to the community where they can provide answers.

Use 🔗 Github Discussions to ask your questions.

A way to pass values to the next task in a workflow

I’m making a package that creates an EC2 instance.
(Of course I understand that there are AWS packs, but for studying)

Get the information after EC2 instance creation, and print it as standard output.

It worked fine so far, but if you try to get the instance information in the next workflow, you get an error for some reason.

However, if you create another workflow and follow the steps below, you can retrieve the values ​​without problems.

  1. Save the same JSON data (*) to a file
  2. Echo the file to task 1 for standard output
  3. In Task 2, retrieve the JSON value of 2.
    (*) I don’t know if it is the same because it is saved after standard output …

What is the cause?

[yaml]

    tasks:
      task1:
        action: hmpack.aws_ec2_create
        input:
          AMI_ID: "<% $ .AMI_ID%>"
          Instance_Type: "<% $ .Instance_Type%>"
          Key_Name: "<% $ .Key_Name%>"
          Tag_Name: "<% $ .Tag_Name%>"
        publish:
          json_result: "<% task (task1) .result.stdout%>"
        on-success:
          -task2
      task2:
        action: core.local
        input:
           cmd: "echo <% $ .json_result.Reservations [0] .Instances [0] .PublicDnsName%> >> /data/ec2.log"

[ERROR]

"state_info": "Failed to run task [error=Can not evaluate YAQL expression [expression=$.json_result.Reservations[0].Instances[0].PublicDnsName, error=Unknown function \"#property#Reservations\", data={}], wf=hmpack.deploy_machine.main, task=task2]:
Traceback (most recent call last):
  File \"/opt/stackstorm/mistral/lib/python2.7/site-packages/mistral/engine/task_handler.py\", line 63, in run_task
    task.run()
:

Hi @h-murakami. I’d suggest you look into Orquesta workflows as mistral is soon to be deprecated. Orquesta — StackStorm 3.1.0 documentation