Skip to content

Commit 29d08b6

Browse files
author
Olivier Cervello
authored
Allow updating Cloud Function's source
1 parent 8a74ad9 commit 29d08b6

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

main.tf

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,12 @@
1414
* limitations under the License.
1515
*/
1616

17+
locals {
18+
// we append the app hash to the filename as a temporary workaround for https://github.com/terraform-providers/terraform-provider-google/issues/1938
19+
md5_hash = "${lower(replace(base64encode(data.archive_file.main.output_md5), "=", ""))}"
20+
storage_object_name = "event_function-${random_string.random_suffix.result}-${local.md5_hash}.zip"
21+
}
22+
1723
/******************************************
1824
Scheduled Function Definition
1925
*****************************************/
@@ -94,7 +100,7 @@ resource "google_storage_bucket" "main" {
94100
}
95101

96102
resource "google_storage_bucket_object" "main" {
97-
name = "event_function-${random_string.random_suffix.result}.zip"
103+
name = "${local.storage_object_name}"
98104
bucket = "${google_storage_bucket.main.name}"
99105
source = "${data.archive_file.main.output_path}"
100106
content_disposition = "attachment"

0 commit comments

Comments
 (0)