Skip to content

Commit

Permalink
feat: add support for included_files and ignored_files of `google…
Browse files Browse the repository at this point in the history
…_cloudbuild_trigger` (#207)
  • Loading branch information
jumpeiMano authored Nov 3, 2022
1 parent 9bb2800 commit d2e5a75
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 0 deletions.
2 changes: 2 additions & 0 deletions modules/tf_cloudbuild_workspace/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ This module creates:
| buckets\_force\_destroy | When deleting the bucket for storing CloudBuild logs/TF state, this boolean option will delete all contained objects. If false, Terraform will fail to delete buckets which contain objects. | `bool` | `false` | no |
| cloudbuild\_apply\_filename | Optional Cloud Build YAML definition used for terraform apply. Defaults to using inline definition. | `string` | `null` | no |
| cloudbuild\_env\_vars | Optional list of environment variables to be used in builds. List of strings of form KEY=VALUE expected. | `list(string)` | `[]` | no |
| cloudbuild\_ignored\_files | Optional list. Changes only affecting ignored files will not invoke a build. | `list(string)` | `[]` | no |
| cloudbuild\_included\_files | Optional list. Changes affecting at least one of these files will invoke a build. | `list(string)` | `[]` | no |
| cloudbuild\_plan\_filename | Optional Cloud Build YAML definition used for terraform plan. Defaults to using inline definition. | `string` | `null` | no |
| cloudbuild\_sa | Custom SA id of form projects/{{project}}/serviceAccounts/{{email}} to be used by the CloudBuild trigger. Defaults to being created if empty. | `string` | `""` | no |
| cloudbuild\_sa\_roles | Optional to assign to custom CloudBuild SA. Map of project name or any static key to object with project\_id and list of roles. | <pre>map(object({<br> project_id = string<br> roles = list(string)<br> }))</pre> | `{}` | no |
Expand Down
2 changes: 2 additions & 0 deletions modules/tf_cloudbuild_workspace/cb.tf
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,8 @@ resource "google_cloudbuild_trigger" "triggers" {
substitutions = merge(local.default_subst, var.substitutions)
service_account = local.cloudbuild_sa
filename = local.default_triggers_explicit[each.key]
included_files = var.cloudbuild_included_files
ignored_files = var.cloudbuild_ignored_files

depends_on = [
google_project_iam_member.cb_sa_roles
Expand Down
12 changes: 12 additions & 0 deletions modules/tf_cloudbuild_workspace/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,18 @@ variable "cloudbuild_env_vars" {
default = []
}

variable "cloudbuild_included_files" {
description = "Optional list. Changes affecting at least one of these files will invoke a build."
type = list(string)
default = []
}

variable "cloudbuild_ignored_files" {
description = "Optional list. Changes only affecting ignored files will not invoke a build."
type = list(string)
default = []
}

variable "buckets_force_destroy" {
description = "When deleting the bucket for storing CloudBuild logs/TF state, this boolean option will delete all contained objects. If false, Terraform will fail to delete buckets which contain objects."
type = bool
Expand Down

0 comments on commit d2e5a75

Please sign in to comment.