Skip to content

Commit db6a751

Browse files
committed
refactor: remove Cloud Functions resources and related configurations
1 parent de5504e commit db6a751

File tree

2 files changed

+1
-80
lines changed

2 files changed

+1
-80
lines changed

terraform/modules/cdn-glb/main.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ resource "google_compute_region_network_endpoint_group" "serverless_neg" {
66
network_endpoint_type = "SERVERLESS"
77

88
cloud_run {
9-
service = "tech-report-api-prod" # var.cloud_run_service_name
9+
service = var.cloud_run_service_name
1010
}
1111
}
1212

terraform/modules/run-service/main.tf

Lines changed: 0 additions & 79 deletions
Original file line numberDiff line numberDiff line change
@@ -25,85 +25,6 @@ provider "docker" {
2525
}
2626
}
2727

28-
locals {
29-
bucketName = "gcf-v2-uploads-226352634162-us-central1"
30-
}
31-
32-
data "archive_file" "source" {
33-
count = var.environment != "dev" ? 1 : 0
34-
type = "zip"
35-
source_dir = var.source_directory
36-
output_path = "/tmp/${var.function_name}.zip"
37-
}
38-
resource "google_storage_bucket_object" "zip" {
39-
count = var.environment != "dev" ? 1 : 0
40-
name = "${var.environment}-${var.function_name}-${data.archive_file.source[0].output_sha}"
41-
bucket = local.bucketName
42-
source = data.archive_file.source[0].output_path
43-
}
44-
45-
resource "google_cloudfunctions2_function" "function" {
46-
count = var.environment != "dev" ? 1 : 0
47-
name = "${var.function_name}-${var.environment}"
48-
location = var.region
49-
50-
build_config {
51-
runtime = "nodejs22"
52-
entry_point = var.entry_point
53-
54-
source {
55-
storage_source {
56-
bucket = local.bucketName
57-
object = google_storage_bucket_object.zip[0].name
58-
}
59-
}
60-
}
61-
62-
service_config {
63-
all_traffic_on_latest_revision = true
64-
available_memory = var.available_memory
65-
available_cpu = var.available_cpu
66-
ingress_settings = var.ingress_settings
67-
68-
environment_variables = var.environment_variables
69-
70-
min_instance_count = var.min_instances
71-
max_instance_count = var.max_instances
72-
timeout_seconds = 60
73-
max_instance_request_concurrency = var.max_instance_request_concurrency
74-
service_account_email = var.service_account_email
75-
}
76-
77-
labels = {
78-
owner = var.service_name
79-
environment = var.environment
80-
}
81-
82-
depends_on = [
83-
google_storage_bucket_object.zip
84-
]
85-
}
86-
87-
data "google_cloud_run_service" "run-service" {
88-
count = var.environment != "dev" ? 1 : 0
89-
name = google_cloudfunctions2_function.function[0].name
90-
location = var.region
91-
depends_on = [google_cloudfunctions2_function.function]
92-
}
93-
94-
95-
resource "google_cloud_run_v2_service_iam_member" "allow_unauthenticated" {
96-
count = var.environment != "dev" ? 1 : 0
97-
project = var.project
98-
location = var.region
99-
name = data.google_cloud_run_service.run-service[0].name
100-
role = "roles/run.invoker"
101-
member = "allUsers"
102-
}
103-
104-
# Native run service
105-
106-
10728
# Calculate hash of source files to determine if rebuild is needed
10829
locals {
10930
source_files = fileset(path.root, "${var.source_directory}/*")

0 commit comments

Comments
 (0)