Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Force function deployment every time #29

Merged
merged 5 commits into from
Dec 9, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 3 additions & 7 deletions terraform/cloud_function/pubsub_triggered/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ resource "google_cloudfunctions_function" "function" {
available_memory_mb = var.function_memory
entry_point = var.function_entry_point
environment_variables = var.function_env_vars
name = format("%s%s-%s", var.function_name, var.branch_suffix, random_string.random.result)
labels = { last_deployed_at = timestamp() }
name = format("%s%s", var.function_name, var.branch_suffix)
project = var.project_id
runtime = var.function_runtime
service_account_email = var.function_service_account_email
Expand All @@ -24,13 +25,8 @@ resource "google_cloudfunctions_function" "function" {
}
}

resource "random_string" "random" {
length = 4
special = false
}

resource "google_storage_bucket_object" "functioncode" {
name = format("pubsub_function_sources/%s/sourcecode%s.zip", var.function_name, random_string.random.result)
name = format("pubsub_function_sources/%s/sourcecode%s.zip", var.function_name, var.branch_suffix)
bucket = var.source_code_bucket_name
source = format("%s/%s/%s.zip", var.source_code_root_path, var.function_name, var.function_name)
}
10 changes: 3 additions & 7 deletions terraform/cloud_function/scheduled/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ resource "google_cloudfunctions_function" "function" {
available_memory_mb = var.function_memory
entry_point = var.function_entry_point
environment_variables = var.function_env_vars
name = format("%s%s-%s", var.function_name, var.branch_suffix, random_string.random.result)
labels = { last_deployed_at = timestamp() }
name = format("%s%s", var.function_name, var.branch_suffix)
project = var.project_id
region = var.project_region
runtime = var.function_runtime
Expand All @@ -21,13 +22,8 @@ resource "google_cloudfunctions_function" "function" {
vpc_connector_egress_settings = var.function_vpc_connector_egress_settings
}

resource "random_string" "random" {
length = 4
special = false
}

resource "google_storage_bucket_object" "functioncode" {
name = format("http_function_sources/%s/sourcecode%s.zip", var.function_name, random_string.random.result)
name = format("http_function_sources/%s/sourcecode%s.zip", var.function_name, var.branch_suffix)
bucket = var.source_code_bucket_name
source = "${var.source_code_root_path}/${var.function_name}/${var.function_name}.zip"
}
Expand Down