Skip to content

Commit 617f212

Browse files
committed
Merge branch 'main' into tech-sort-and-versions
2 parents 233925e + 217d079 commit 617f212

File tree

3 files changed

+7
-31
lines changed

3 files changed

+7
-31
lines changed

.gitignore

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -3,27 +3,10 @@
33

44
# Terraform
55
.terraform
6-
*.tfstate
7-
*.tfstate.*
86
*.terraform.lock.hcl
9-
secret.tfvars
10-
override.tf
11-
override.tf.json
12-
*_override.tf
13-
*_override.tf.json
14-
*tfplan*
15-
.terraformrc
16-
terraform.rc
17-
*.tfvars
18-
*.local.tfvars
19-
spec.yaml
20-
21-
# env
22-
.envrc
237

248
# CLI
259
.DS_Store
2610

27-
2811
node_modules/
2912
src/coverage/

terraform/modules/run-service/main.tf

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,14 @@ provider "docker" {
1818
}
1919
}
2020

21-
# Calculate hash of source files to determine if rebuild is needed
22-
locals {
23-
source_files = fileset(path.root, "${var.source_directory}/*")
24-
source_hash = substr(sha1(join("", [for f in local.source_files : filesha1(f)])), 0, 8)
21+
# Calculate hash of source files using git (respects .gitignore)
22+
data "external" "source_hash" {
23+
program = ["bash", "-c", "cd ${var.source_directory} && echo '{\"hash\":\"'$(git ls-files -s | sha1sum | cut -c1-8)'\"}'"]
2524
}
2625

2726
# Build Docker image
2827
resource "docker_image" "function_image" {
29-
name = "${var.region}-docker.pkg.dev/${var.project}/report-api/${var.service_name}:${local.source_hash}"
28+
name = "${var.region}-docker.pkg.dev/${var.project}/report-api/${var.service_name}:${data.external.source_hash.result.hash}"
3029

3130
build {
3231
context = var.source_directory
@@ -44,7 +43,7 @@ resource "google_cloud_run_v2_service" "service" {
4443
location = var.region
4544

4645
deletion_protection = false
47-
ingress = "INGRESS_TRAFFIC_INTERNAL_LOAD_BALANCER"
46+
ingress = var.ingress_settings
4847

4948
template {
5049
service_account = var.service_account_email

terraform/modules/run-service/variables.tf

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -40,15 +40,9 @@ variable "available_cpu" {
4040
}
4141
variable "ingress_settings" {
4242
type = string
43-
default = "ALLOW_ALL"
44-
description = "String value that controls what traffic can reach the function. Allowed values are ALLOW_ALL, ALLOW_INTERNAL_AND_GCLB and ALLOW_INTERNAL_ONLY. Check ingress documentation to see the impact of each settings value. Changes to this field will recreate the cloud function."
43+
default = "INGRESS_TRAFFIC_INTERNAL_LOAD_BALANCER"
44+
description = "String value that controls what traffic can reach the function. Check ingress documentation to see the impact of each settings value. Changes to this field will recreate the cloud function."
4545
}
46-
variable "vpc_connector_egress_settings" {
47-
type = string
48-
default = null
49-
description = "The egress settings for the connector, controlling what traffic is diverted through it. Allowed values are ALL_TRAFFIC and PRIVATE_RANGES_ONLY. Defaults to PRIVATE_RANGES_ONLY. If unset, this field preserves the previously set value."
50-
}
51-
5246
variable "timeout" {
5347
default = "60s"
5448
type = string

0 commit comments

Comments
 (0)