Skip to content

Commit

Permalink
fix: Update workflow_basic.tf.erb (GoogleCloudPlatform#8369)
Browse files Browse the repository at this point in the history
  • Loading branch information
averikitsch authored and ericayyliu committed Jul 26, 2023
1 parent 62c5578 commit dcf79c2
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions mmv1/templates/terraform/examples/workflow_basic.tf.erb
Original file line number Diff line number Diff line change
Expand Up @@ -9,30 +9,31 @@ resource "google_workflows_workflow" "<%= ctx[:primary_resource_id] %>" {
description = "Magic"
service_account = google_service_account.test_account.id
source_contents = <<-EOF
# This is a sample workflow, feel free to replace it with your source code
# This is a sample workflow. You can replace it with your source code.
#
# This workflow does the following:
# - reads current time and date information from an external API and stores
# the response in CurrentDateTime variable
# the response in currentTime variable
# - retrieves a list of Wikipedia articles related to the day of the week
# from CurrentDateTime
# from currentTime
# - returns the list of articles as an output of the workflow
# FYI, In terraform you need to escape the $$ or it will cause errors.
#
# Note: In Terraform you need to escape the $$ or it will cause errors.

- getCurrentTime:
call: http.get
args:
url: https://us-central1-workflowsample.cloudfunctions.net/datetime
result: CurrentDateTime
url: https://timeapi.io/api/Time/current/zone?timeZone=Europe/Amsterdam
result: currentTime
- readWikipedia:
call: http.get
args:
url: https://en.wikipedia.org/w/api.php
query:
action: opensearch
search: $${CurrentDateTime.body.dayOfTheWeek}
result: WikiResult
search: $${currentTime.body.dayOfWeek}
result: wikiResult
- returnOutput:
return: $${WikiResult.body[1]}
return: $${wikiResult.body[1]}
EOF
}

0 comments on commit dcf79c2

Please sign in to comment.