diff --git a/gcp/cloud-run-v2/main.tf b/gcp/cloud-run-v2/main.tf index 18cf0a2..2732c4f 100644 --- a/gcp/cloud-run-v2/main.tf +++ b/gcp/cloud-run-v2/main.tf @@ -256,7 +256,7 @@ module "trigger_provision" { repository_name = var.repository_name description = "Provision ${var.name} Service (CI/CD)" filename = "${var.service_path}/cloudbuild.yaml" - include = ["${var.service_path}/**"] + include = concat(["${var.service_path}/**"], var.dependencies) exclude = ["${var.service_path}/functions/**"] environment = var.environment diff --git a/gcp/cloud-run-v2/variables.tf b/gcp/cloud-run-v2/variables.tf index 9f61478..34fe707 100644 --- a/gcp/cloud-run-v2/variables.tf +++ b/gcp/cloud-run-v2/variables.tf @@ -219,3 +219,9 @@ variable "eventarc_triggers" { })) default = [] } + +variable "dependencies" { + description = "A list of glob-format dependencies for the cloudbuild trigger" + type = list(string) + default = [] +} \ No newline at end of file diff --git a/test/gcp/cloud-run-v2.tf b/test/gcp/cloud-run-v2.tf index 5cf0d75..69095e8 100644 --- a/test/gcp/cloud-run-v2.tf +++ b/test/gcp/cloud-run-v2.tf @@ -8,6 +8,7 @@ module "cloud-run-api-my-awesome-api" { environment = "preview" repository_name = "my-repo-in-github" service_path = "/services/my-awesome-api" + dependencies = ["services/shared/**", "services/types/**"] env_vars = { "ENVIRONMENT" = "preview" "DEBUG" = "true"