Skip to content

Commit

Permalink
Fix update to function code triggers new rollout
Browse files Browse the repository at this point in the history
  • Loading branch information
Myad Tahajody committed Feb 3, 2021
1 parent cb611f2 commit f8f82e5
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -125,4 +125,4 @@ terraform.rc

.terraform.lock.hcl

functions/**/*.zip
*.zip
23 changes: 18 additions & 5 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -35,23 +35,36 @@ variable "bored_service_account" {
default = "[email protected]"
}

variable "bucket_name" {
type = string
default = "bored-dev-bucket"
}

variable "bucket_archive_filepath" {
type = string
default = "bored.zip"
}

resource "google_storage_bucket" "bucket" {
name = "bored-dev-bucket"
name = var.bucket_name
}

data "archive_file" "http_trigger" {
type = "zip"
output_path = "./functions/bored-proxy/bored.zip"
output_path = format("%s/%s", path.root, var.bucket_archive_filepath)
source {
content = file("./functions/bored-proxy/index.js")
filename = "index.js"
}
}

resource "google_storage_bucket_object" "archive" {
name = "bored.zip"
bucket = google_storage_bucket.bucket.name
source = data.archive_file.http_trigger.output_path
name = format("%s#%s", var.bucket_archive_filepath, data.archive_file.http_trigger.output_md5)
bucket = google_storage_bucket.bucket.name
source = data.archive_file.http_trigger.output_path
content_disposition = "attachment"
content_encoding = "gzip"
content_type = "application/zip"
}

resource "google_cloudfunctions_function" "function" {
Expand Down

0 comments on commit f8f82e5

Please sign in to comment.