Skip to content

Commit aecc2c0

Browse files
committed
chore: Adding Submodule for Standalone Workflow for ADC
- Added Submodule for Standalone workflow - Added Validations and metadata.display.yaml file for making submodule ADC compliant - Added relevant examples and test
1 parent f8b2ca4 commit aecc2c0

File tree

21 files changed

+938
-108
lines changed

21 files changed

+938
-108
lines changed

Makefile

Lines changed: 3 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

@@ -77,9 +77,10 @@ docker_test_lint:
7777
.PHONY: docker_generate_docs
7878
docker_generate_docs:
7979
docker run --rm -it \
80+
-e ENABLE_BPMETADATA=1 \
8081
-v "$(CURDIR)":/workspace \
8182
$(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'
83+
/bin/bash -c 'source /usr/local/bin/task_helper_functions.sh && generate_docs display'
8384

8485
# Alias for backwards compatibility
8586
.PHONY: generate_docs

examples/simple_workflow/README.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
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+
| workflow\_id | The id of the workflow. |
13+
| workflow\_region | The id of the workflow. |
14+
| workflow\_revision\_id | The revision\_id of the workflow. |
15+
16+
<!-- END OF PRE-COMMIT-TERRAFORM DOCS HOOK -->

examples/simple_workflow/main.tf

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
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+
module "service_account" {
18+
source = "terraform-google-modules/service-accounts/google"
19+
version = "~> 4.1.1"
20+
project_id = var.project_id
21+
prefix = "simple-workflow"
22+
names = ["simple"]
23+
project_roles = ["${var.project_id}=>roles/workflows.invoker"]
24+
}
25+
26+
module "standalone_workflow" {
27+
source = "../../modules/simple_workflow"
28+
29+
project_id = var.project_id
30+
workflow_name = "standalone-workflow"
31+
region = "us-central1"
32+
service_account_email = module.service_account.email
33+
service_account_create = true
34+
workflow_source = <<-EOF
35+
# This is a sample workflow that simply reads wikipedia
36+
# Note that $$ is needed for Terraform
37+
38+
main:
39+
steps:
40+
- readWikipedia:
41+
call: http.get
42+
args:
43+
url: https://en.wikipedia.org/w/api.php
44+
query:
45+
action: opensearch
46+
search: GoogleCloudPlatform
47+
result: wikiResult
48+
- returnOutput:
49+
return: $${wikiResult.body[1]}
50+
EOF
51+
}
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
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 "workflow_id" {
18+
description = "The id of the workflow."
19+
value = module.standalone_workflow.workflow_id
20+
}
21+
22+
output "workflow_region" {
23+
description = "The id of the workflow."
24+
value = module.standalone_workflow.workflow_region
25+
}
26+
27+
output "workflow_revision_id" {
28+
description = "The revision_id of the workflow."
29+
value = module.standalone_workflow.workflow_revision_id
30+
}
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: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
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+
required_version = ">= 0.13"
25+
}

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)