Skip to content

Commit df68cf2

Browse files
committed
debugging
1 parent 1b387a3 commit df68cf2

File tree

2 files changed

+59
-52
lines changed

2 files changed

+59
-52
lines changed

modules/data_warehouse/main.tf

+7
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ module "project-services" {
4646
"storage.googleapis.com",
4747
"storage-api.googleapis.com",
4848
"workflows.googleapis.com",
49+
"workflowexecutions.googleapis.com"
4950
]
5051

5152
activate_api_identities = [
@@ -68,6 +69,12 @@ resource "time_sleep" "wait_after_apis" {
6869
depends_on = [module.project-services]
6970
}
7071

72+
# resource "google_project_service_identity" "default" {
73+
# provider = google-beta
74+
# project = module.project-services.project_id
75+
# service = "workflows.googleapis.com"
76+
# }
77+
7178
# Create random ID to be used for deployment uniqueness
7279
resource "random_id" "id" {
7380
byte_length = 4

modules/data_warehouse/workflows.tf

+52-52
Original file line numberDiff line numberDiff line change
@@ -74,61 +74,61 @@ resource "google_workflows_workflow" "workflow" {
7474
]
7575
}
7676

77-
data "google_client_config" "current" {
77+
# data "google_client_config" "current" {
7878

79-
}
79+
# }
8080

81-
## Trigger the execution of the setup workflow with an API call
82-
data "http" "call_workflows_setup" {
83-
url = "https://workflowexecutions.googleapis.com/v1/projects/${module.project-services.project_id}/locations/${var.region}/workflows/${google_workflows_workflow.workflow.name}/executions"
84-
method = "POST"
85-
request_headers = {
86-
Accept = "application/json"
87-
Authorization = "Bearer ${data.google_client_config.current.access_token}" }
88-
depends_on = [
89-
google_storage_bucket.raw_bucket,
90-
google_bigquery_routine.sp_bigqueryml_generate_create,
91-
google_bigquery_routine.sp_bigqueryml_model,
92-
google_bigquery_routine.sproc_sp_demo_lookerstudio_report,
93-
google_bigquery_routine.sp_provision_lookup_tables,
94-
google_workflows_workflow.workflow,
95-
google_storage_bucket.raw_bucket,
96-
google_cloudfunctions2_function.notebook_deploy_function,
97-
time_sleep.wait_after_function,
98-
google_service_account_iam_member.workflow_auth_function
99-
]
100-
}
81+
# ## Trigger the execution of the setup workflow with an API call
82+
# data "http" "call_workflows_setup" {
83+
# url = "https://workflowexecutions.googleapis.com/v1/projects/${module.project-services.project_id}/locations/${var.region}/workflows/${google_workflows_workflow.workflow.name}/executions"
84+
# method = "POST"
85+
# request_headers = {
86+
# Accept = "application/json"
87+
# Authorization = "Bearer ${data.google_client_config.current.access_token}" }
88+
# depends_on = [
89+
# google_storage_bucket.raw_bucket,
90+
# google_bigquery_routine.sp_bigqueryml_generate_create,
91+
# google_bigquery_routine.sp_bigqueryml_model,
92+
# google_bigquery_routine.sproc_sp_demo_lookerstudio_report,
93+
# google_bigquery_routine.sp_provision_lookup_tables,
94+
# google_workflows_workflow.workflow,
95+
# google_storage_bucket.raw_bucket,
96+
# google_cloudfunctions2_function.notebook_deploy_function,
97+
# time_sleep.wait_after_function,
98+
# google_service_account_iam_member.workflow_auth_function
99+
# ]
100+
# }
101101

102-
# Sleep for 120 seconds to allow the workflow to execute and finish setup
103-
resource "time_sleep" "wait_after_workflow_execution" {
104-
create_duration = "120s"
105-
depends_on = [
106-
data.http.call_workflows_setup,
107-
]
108-
}
102+
# # Sleep for 120 seconds to allow the workflow to execute and finish setup
103+
# resource "time_sleep" "wait_after_workflow_execution" {
104+
# create_duration = "120s"
105+
# depends_on = [
106+
# data.http.call_workflows_setup,
107+
# ]
108+
# }
109109

110-
## Trigger the execution of the setup workflow with an API call
111-
data "http" "call_workflows_state_1" {
112-
url = "https://workflowexecutions.googleapis.com/v1/projects/${module.project-services.project_id}/locations/${var.region}/workflows/${google_workflows_workflow.workflow.name}/executions"
113-
method = "GET"
114-
request_headers = {
115-
Accept = "application/json"
116-
Authorization = "Bearer ${data.google_client_config.current.access_token}" }
117-
depends_on = [
118-
time_sleep.wait_after_workflow_execution,
119-
]
120-
}
110+
# ## Trigger the execution of the setup workflow with an API call
111+
# data "http" "call_workflows_state_1" {
112+
# url = "https://workflowexecutions.googleapis.com/v1/projects/${module.project-services.project_id}/locations/${var.region}/workflows/${google_workflows_workflow.workflow.name}/executions"
113+
# method = "GET"
114+
# request_headers = {
115+
# Accept = "application/json"
116+
# Authorization = "Bearer ${data.google_client_config.current.access_token}" }
117+
# depends_on = [
118+
# time_sleep.wait_after_workflow_execution,
119+
# ]
120+
# }
121121

122-
data "http" "retry_workflows_1" {
123-
count = data.http.call_workflows_state_1.executions[0].state == "SUCCEEDED" || data.http.call_workflows_state_1.executions[0].state == "ACTIVE" ? 0 : 1
124-
url = "https://workflowexecutions.googleapis.com/v1/projects/${module.project-services.project_id}/locations/${var.region}/workflows/${google_workflows_workflow.workflow.name}/executions"
125-
method = "POST"
126-
request_headers = {
127-
Accept = "application/json"
128-
Authorization = "Bearer ${data.google_client_config.current.access_token}" }
129-
depends_on = [
130-
data.http.call_workflows_state_1]
131-
}
122+
# data "http" "retry_workflows_1" {
123+
# count = jsonencode(data.http.call_workflows_state_1).executions[0].state == "SUCCEEDED" || data.http.call_workflows_state_1.executions[0].state == "ACTIVE" ? 0 : 1
124+
# url = "https://workflowexecutions.googleapis.com/v1/projects/${module.project-services.project_id}/locations/${var.region}/workflows/${google_workflows_workflow.workflow.name}/executions"
125+
# method = "POST"
126+
# request_headers = {
127+
# Accept = "application/json"
128+
# Authorization = "Bearer ${data.google_client_config.current.access_token}" }
129+
# depends_on = [
130+
# data.http.call_workflows_state_1]
131+
# }
132132

133133
# # Sleep for 30 seconds to recheck the workflow state
134134
# resource "time_sleep" "wait_to_recheck_workflow" {
@@ -164,9 +164,9 @@ data "http" "retry_workflows_1" {
164164

165165
# Sleep for 120 seconds to allow the workflow to execute and finish setup
166166
resource "time_sleep" "complete_workflow" {
167-
count = data.http.call_workflows_state_1.executions[0].state == "SUCCEEDED" ? 0 : 1
167+
# count = data.http.call_workflows_state_1.executions[0].state == "SUCCEEDED" ? 0 : 1
168168
create_duration = "120s"
169169
depends_on = [
170-
data.http.retry_workflows_1,
170+
# data.http.retry_workflows_1,
171171
]
172172
}

0 commit comments

Comments
 (0)