Skip to content

Commit a5a507c

Browse files
committed
Adding Submodule for Standalone Workflow for ADC
1 parent f8b2ca4 commit a5a507c

File tree

21 files changed

+960
-108
lines changed

21 files changed

+960
-108
lines changed

Makefile

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
# Make will use bash instead of sh
1919
SHELL := /usr/bin/env bash
2020

21-
DOCKER_TAG_VERSION_DEVELOPER_TOOLS := 1
21+
DOCKER_TAG_VERSION_DEVELOPER_TOOLS := 1.25
2222
DOCKER_IMAGE_DEVELOPER_TOOLS := cft/developer-tools
2323
REGISTRY_URL := gcr.io/cloud-foundation-cicd
2424

@@ -68,6 +68,7 @@ docker_test_integration:
6868
.PHONY: docker_test_lint
6969
docker_test_lint:
7070
docker run --rm -it \
71+
-e ENABLE_BPMETADATA=1 \
7172
-e EXCLUDE_LINT_DIRS \
7273
-v "$(CURDIR)":/workspace \
7374
$(REGISTRY_URL)/${DOCKER_IMAGE_DEVELOPER_TOOLS}:${DOCKER_TAG_VERSION_DEVELOPER_TOOLS} \
@@ -77,9 +78,10 @@ docker_test_lint:
7778
.PHONY: docker_generate_docs
7879
docker_generate_docs:
7980
docker run --rm -it \
81+
-e ENABLE_BPMETADATA=1 \
8082
-v "$(CURDIR)":/workspace \
8183
$(REGISTRY_URL)/${DOCKER_IMAGE_DEVELOPER_TOOLS}:${DOCKER_TAG_VERSION_DEVELOPER_TOOLS} \
82-
/bin/bash -c 'source /usr/local/bin/task_helper_functions.sh && generate_docs'
84+
/bin/bash -c 'source /usr/local/bin/task_helper_functions.sh && generate_docs display'
8385

8486
# Alias for backwards compatibility
8587
.PHONY: generate_docs

examples/simple_workflow/README.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<!-- BEGINNING OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
2+
## Inputs
3+
4+
| Name | Description | Type | Default | Required |
5+
|------|-------------|------|---------|:--------:|
6+
| project\_id | The ID of the project in which to provision resources. | `string` | n/a | yes |
7+
8+
## Outputs
9+
10+
| Name | Description |
11+
|------|-------------|
12+
| gcs\_bucket | Name of GCS Bucket. |
13+
| workflow\_id | The id of the workflow. |
14+
| workflow\_region | The id of the workflow. |
15+
| workflow\_revision\_id | The revision\_id of the workflow. |
16+
17+
<!-- END OF PRE-COMMIT-TERRAFORM DOCS HOOK -->

examples/simple_workflow/main.tf

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
/**
2+
* Copyright 2025 Google LLC
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
data "google_project" "project" {
18+
project_id = var.project_id
19+
}
20+
21+
data "google_compute_default_service_account" "default" {
22+
project = var.project_id
23+
}
24+
25+
resource "random_string" "string" {
26+
length = 8
27+
lower = true
28+
upper = false
29+
special = false
30+
numeric = false
31+
}
32+
33+
module "gcs_buckets" {
34+
source = "terraform-google-modules/cloud-storage/google"
35+
version = "~> 3.4.0"
36+
location = "us-central1"
37+
project_id = var.project_id
38+
names = ["wf-bucket"]
39+
prefix = random_string.string.result
40+
set_admin_roles = true
41+
admins = ["serviceAccount:${data.google_compute_default_service_account.default.email}"]
42+
force_destroy = { wf-bucket = true }
43+
}
44+
45+
module "standalone_workflow" {
46+
source = "../../modules/simple_workflow"
47+
48+
project_id = var.project_id
49+
workflow_name = "standalone-workflow"
50+
region = "us-central1"
51+
service_account_email = data.google_compute_default_service_account.default.email
52+
service_account_create = true
53+
workflow_source = <<-EOF
54+
# This is a sample workflow that simply reads wikipedia
55+
# Note that $$ is needed for Terraform
56+
57+
main:
58+
steps:
59+
- readWikipedia:
60+
call: http.get
61+
args:
62+
url: https://en.wikipedia.org/w/api.php
63+
query:
64+
action: opensearch
65+
search: GoogleCloudPlatform
66+
result: wikiResult
67+
- returnOutput:
68+
return: $${wikiResult.body[1]}
69+
EOF
70+
}
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
/**
2+
* Copyright 2025 Google LLC
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
output "gcs_bucket" {
18+
description = "Name of GCS Bucket."
19+
value = module.gcs_buckets.bucket.name
20+
}
21+
22+
output "workflow_id" {
23+
description = "The id of the workflow."
24+
value = module.standalone_workflow.workflow_id
25+
}
26+
27+
output "workflow_region" {
28+
description = "The id of the workflow."
29+
value = module.standalone_workflow.workflow_region
30+
}
31+
32+
output "workflow_revision_id" {
33+
description = "The revision_id of the workflow."
34+
value = module.standalone_workflow.workflow_revision_id
35+
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
/**
2+
* Copyright 2025 Google LLC
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
variable "project_id" {
18+
description = "The ID of the project in which to provision resources."
19+
type = string
20+
}
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
/**
2+
* Copyright 2025 Google LLC
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
terraform {
18+
required_providers {
19+
google = {
20+
source = "hashicorp/google"
21+
version = "~> 4.0"
22+
}
23+
24+
random = {
25+
version = "~> 3.4.3"
26+
}
27+
}
28+
required_version = ">= 0.13"
29+
}

main.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ resource "google_cloud_scheduler_job" "workflow" {
7272
count = local.enable_scheduler
7373
project = var.project_id
7474
name = var.workflow_trigger.cloud_scheduler.name
75-
description = "Cloud Scheduler for Workflow Jpb"
75+
description = "Cloud Scheduler for Workflow Job"
7676
schedule = var.workflow_trigger.cloud_scheduler.cron
7777
time_zone = var.workflow_trigger.cloud_scheduler.time_zone
7878
attempt_deadline = var.workflow_trigger.cloud_scheduler.deadline

metadata.display.yaml

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
# Copyright 2025 Google LLC
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
apiVersion: blueprints.cloud.google.com/v1alpha1
16+
kind: BlueprintMetadata
17+
metadata:
18+
name: terraform-google-cloud-workflow-display
19+
annotations:
20+
config.kubernetes.io/local-config: "true"
21+
spec:
22+
info:
23+
title: terraform-google-cloud-workflow
24+
source:
25+
repo: https://github.com/GoogleCloudPlatform/terraform-google-cloud-workflows.git
26+
sourceType: git
27+
ui:
28+
input:
29+
variables:
30+
project_id:
31+
name: project_id
32+
title: Project Id
33+
region:
34+
name: region
35+
title: Region
36+
service_account_create:
37+
name: service_account_create
38+
title: Service Account Create
39+
service_account_email:
40+
name: service_account_email
41+
title: Service Account Email
42+
workflow_description:
43+
name: workflow_description
44+
title: Workflow Description
45+
workflow_labels:
46+
name: workflow_labels
47+
title: Workflow Labels
48+
workflow_name:
49+
name: workflow_name
50+
title: Workflow Name
51+
workflow_source:
52+
name: workflow_source
53+
title: Workflow Source
54+
workflow_trigger:
55+
name: workflow_trigger
56+
title: Workflow Trigger

0 commit comments

Comments
 (0)