Allow trigger branching strategy customisation#98
Conversation
3102193 to
2ae93f1
Compare
| variable "branching_strategy" { | ||
| description = "Branching strategy for different environments" | ||
| type = map(any) | ||
| default = { |
There was a problem hiding this comment.
By removing this default values, won't this be affecting triggers created with this module ?
There was a problem hiding this comment.
The default is now specified in locals:
If no variable is passed it defaults to null and the second arg of the coalesce function is used.
There was a problem hiding this comment.
Thanks, all good. It looks like the default values before where slightly different to the ones in the variables. All good now
There was a problem hiding this comment.
Pull request overview
This PR updates the Cloud Build trigger module to support caller-provided trigger branching strategies (with defaults applied internally), and wires that capability through the Cloud Run v2 Job module so parent modules can customize trigger branch matching per project needs.
Changes:
- Add a
trigger_branching_strategyinput tocloud-run-v2-joband pass it through to the trigger module. - Change
cloud-cloudbuild-triggerto accept a nullablebranching_strategyinput and apply module defaults vialocals. - Remove unused
validatebranching defaults (previously present in the variable default).
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| gcp/cloud-run-v2-job/variables.tf | Adds a new variable to allow passing a trigger branching strategy from parent modules. |
| gcp/cloud-run-v2-job/main.tf | Passes the new branching strategy variable into the Cloud Build trigger module. |
| gcp/cloud-cloudbuild-trigger/variables.tf | Makes branching strategy default nullable to enable caller customization. |
| gcp/cloud-cloudbuild-trigger/main.tf | Switches trigger branch selection to use a locally-resolved default strategy when none is provided. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
6af0629 to
d34e07a
Compare
The Cloud Build trigger is updated to allow parent modules to specify a custom branching strategy based on a project's needs. Here the Cloud Run v2 Job is updated to take advantage of this. Additional modules can be updated in the future to allow for a customised branching strategy to be passed. Validation defaults are removed as they're unused in the module.
d34e07a to
18cc76c
Compare
| variable "branching_strategy" { | ||
| description = "Branching strategy for different environments" | ||
| type = map(any) | ||
| default = { |
There was a problem hiding this comment.
Thanks, all good. It looks like the default values before where slightly different to the ones in the variables. All good now
|
🎉 This PR is included in version 1.70.0 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |

The Cloud Build trigger is updated to allow parent modules to specify a
custom branching strategy based on a project's needs.
Here the Cloud Run v2 Job is updated to take advantage of this.
Additional modules can be updated in the future to allow for a
customised branching strategy to be passed.
Validation defaults are removed as they're unused in the module.