forked from GoogleCloudPlatform/magic-modules
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(workflows): add user_env_vars field + tests (GoogleCloudPlatform…
- Loading branch information
1 parent
138f8b2
commit 7969d82
Showing
3 changed files
with
191 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
resource "google_service_account" "test_account" { | ||
provider = google-beta | ||
account_id = "<%= ctx[:vars]['account_id'] %>" | ||
display_name = "Test Service Account" | ||
} | ||
|
||
resource "google_workflows_workflow" "<%= ctx[:primary_resource_id] %>" { | ||
provider = google-beta | ||
name = "<%= ctx[:vars]['name'] %>" | ||
region = "us-central1" | ||
description = "Magic" | ||
service_account = google_service_account.test_account.id | ||
labels = { | ||
env = "test" | ||
} | ||
user_env_vars = { | ||
foo = "BAR" | ||
} | ||
source_contents = <<-EOF | ||
# 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 currentTime variable | ||
# - retrieves a list of Wikipedia articles related to the day of the week | ||
# from currentTime | ||
# - returns the list of articles as an output of the workflow | ||
# | ||
# Note: In Terraform you need to escape the $$ or it will cause errors. | ||
|
||
- getCurrentTime: | ||
call: http.get | ||
args: | ||
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: $${currentTime.body.dayOfWeek} | ||
result: wikiResult | ||
- returnOutput: | ||
return: $${wikiResult.body[1]} | ||
EOF | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters