olehborysevych commented on code in PR #25793:
URL: https://github.com/apache/beam/pull/25793#discussion_r1138592901
##########
learning/tour-of-beam/frontend/lib/repositories/client/cloud_functions_client.dart:
##########
@@ -37,7 +37,7 @@ class CloudFunctionsTobClient extends TobClient {
Future<GetSdksResponse> getSdks() async {
final json = await http.get(
Uri.parse(
- '$cloudFunctionsBaseUrl/getSdkList',
+ '${cloudFunctionsBaseUrl}getSdkList',
Review Comment:
@nausharipov this will be needed for Cloud function multitenancy. Are you OK
with this and similar changes below. This is already deployed to staging
environment
##########
learning/tour-of-beam/terraform/cloud_functions/variables.tf:
##########
@@ -0,0 +1,46 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+variable "service_account_id" {
+ description = "The name of Service Account to run Cloud Function"
+}
+
+variable "project_id" {
Review Comment:
@ruslan-ikhsan can we reuse project_id declared on the main level? Why we
have separate project variable for cloud functions. I don't think we will ever
have resources in different projects
##########
learning/tour-of-beam/terraform/environment/test/state.tfbackend:
##########
@@ -0,0 +1,20 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+bucket = "tfstate-bucket-tob-1"
Review Comment:
@ruslan-ikhsan do we need this in PR?
##########
learning/tour-of-beam/terraform/provider.tf:
##########
@@ -0,0 +1,35 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+terraform {
+ backend "gcs" {
+ }
Review Comment:
@ruslan-ikhsan I think we should not rely on default bucket name and provide
a bucket name for state.
##########
learning/tour-of-beam/terraform/functions_buckets/variables.tf:
##########
@@ -0,0 +1,31 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+#Generates archive of source code
+variable "cloudfunctions_bucket" {
+ description = "The name of the bucket to store cloud functions' source code"
+}
+
+variable "region" {
+ description = "The GCS region"
+}
+
+data "archive_file" "source_code" {
Review Comment:
@ruslan-ikhsan it's not mandatory but please consider if it would be better
to extract data to a separate data-sources.tf file. Again this is not
necessary.
##########
learning/tour-of-beam/terraform/cloud_functions/main.tf:
##########
@@ -0,0 +1,59 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+
+resource "google_cloudfunctions_function" "cloud_function" {
+ count = length(var.entry_point_names)
+ name =
"${var.environment}_${var.entry_point_names[count.index]}"
+ runtime = "go116"
+ available_memory_mb = 128
+ project = var.project_id
+ service_account_email = var.service_account_id
+ source_archive_bucket = var.source_archive_bucket
+ source_archive_object = var.source_archive_object
+ region = var.region
+ ingress_settings = "ALLOW_ALL"
+ # Get the source code of the cloud function as a Zip compression
+ trigger_http = true
+ # Name of the function that will be executed when the Google Cloud Function
is triggered
+ entry_point = var.entry_point_names[count.index]
+
+ environment_variables = {
+ DATASTORE_PROJECT_ID=var.project_id
+ GOOGLE_PROJECT_ID=var.project_id
+ PLAYGROUND_ROUTER_HOST=var.pg_router_host
+ }
+
+ timeouts {
+ create = "20m"
+ delete = "20m"
+ }
+
+}
+
+# Create IAM entry so all users can invoke the function
+resource "google_cloudfunctions_function_iam_member" "invoker" {
+ count = length(google_cloudfunctions_function.cloud_function)
+ project =
google_cloudfunctions_function.cloud_function[count.index].project
Review Comment:
@ruslan-ikhsan since they all go to same project and region I think we can
simplify this a little bit by use a variable
##########
learning/tour-of-beam/terraform/api_enable/variables.tf:
##########
@@ -0,0 +1,20 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+variable "project_id" {
Review Comment:
@ruslan-ikhsan Why are we redeclaring project_id?
##########
learning/tour-of-beam/frontend/pubspec.yaml:
##########
@@ -23,7 +23,7 @@ publish_to: 'none'
version: 0.1.0
environment:
- sdk: '>=2.18.1 <3.0.0'
+ sdk: '>=2.19.2 <4.0.0'
Review Comment:
@nausharipov this should also go away after merge with FE PRs
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]