This sample shows how to use Terraform's google_workflows_workflow resource to deploy a Workflow split across a main workflow YAML file and a subflow YAML file.
You can see main.tf for Terraform, workflow.yaml for the main workflow YAML file and subworkflow.yaml for the subworkflow YAML file used by the main workflow.
-
Initialize terraform:
terraform init
-
See the planned changes:
terraform plan -var="project_id=YOUR-PROJECT-ID" -var="region=YOUR-GCP-REGION"
-
Create workflow:
terraform apply -var="project_id=YOUR-PROJECT-ID" -var="region=YOUR-GCP-REGION"
-
Once workflow is created, you can see it in the list:
gcloud workflows list --location YOUR-GCP-REGION
-
Cleanup:
terraform destroy -var="project_id=YOUR-PROJECT-ID" -var="region=YOUR-GCP-REGION"
You can optionally execute the workflow using gcloud:
gcloud workflows execute sample-workflow
Thanks to Jamie Thomson @jamiet for the templatefile
idea.