Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/memes/terraform-google-cloudbuild
Helper module to setup various Cloud Build triggers
https://github.com/memes/terraform-google-cloudbuild
Last synced: 7 days ago
JSON representation
Helper module to setup various Cloud Build triggers
- Host: GitHub
- URL: https://github.com/memes/terraform-google-cloudbuild
- Owner: memes
- License: mit
- Created: 2022-02-09T00:31:00.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2024-12-27T19:56:43.000Z (25 days ago)
- Last Synced: 2024-12-27T20:28:36.145Z (25 days ago)
- Language: HCL
- Size: 189 KB
- Stars: 5
- Watchers: 2
- Forks: 2
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
# Google Cloud Build module for Terraform
![GitHub release](https://img.shields.io/github/v/release/memes/terraform-google-cloudbuild?sort=semver)
![Maintenance](https://img.shields.io/maintenance/yes/2024)
[![Contributor Covenant](https://img.shields.io/badge/Contributor%20Covenant-2.1-4baaaa.svg)](CODE_OF_CONDUCT.md)Google Cloud Build offers a variety of different ways to implement a GitOps-like
trigger, with support for many commercial Git hosting providers. The purpose of
these modules is to make it easier to create a Cloud Build trigger for common
trigger scenarios; e.g. a GitHub App trigger, a GSR trigger, etc.While it is possible to use this root module directly, the scenario specific
submodules have additional validation to make it easier to provision a suitable
trigger without running afoul of the full Cloud Build trigger constraints. To
reinforce this, all examples use a scenario module.> TL;DR - PREFER TO USE THE SCENARIO SPECIFIC SUBMODULE FOR YOUR TRIGGER!
## Scenario modules
* [GitHub](modules/github/)
Use this module to add a Cloud Build trigger for source that is hosted in
GitHub (or GitHub Enterprise), and the Cloud Build app for GitHub is
authorized to access the repository. An alternative is to allow GCP to mirror
the source to a GSR and use the [Google Source](modules/google-source-repo)
module instead.* [Google Source Repository](modules/google-source-repo/)
Use this module to add a Cloud Build trigger that reacts to changes in
GSR. This includes cases where source from an external repository is being
mirrored into GSR (e.g. from BitBucket, GitLab, or an existing GitHub mirrored
repository).## Contributing
See [CONTRIBUTING](CONTRIBUTING.md) for guidelines.
## Requirements
| Name | Version |
|------|---------|
| [terraform](#requirement\_terraform) | >= 0.14.5 |
| [google](#requirement\_google) | >= 4.36.0 |## Modules
No modules.
## Resources
| Name | Type |
|------|------|
| [google_cloudbuild_trigger.trigger](https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/cloudbuild_trigger) | resource |
| [google_service_account.sa](https://registry.terraform.io/providers/hashicorp/google/latest/docs/data-sources/service_account) | data source |## Inputs
| Name | Description | Type | Default | Required |
|------|-------------|------|---------|:--------:|
| [name](#input\_name) | The name to give to the Cloud Build trigger. | `string` | n/a | yes |
| [project\_id](#input\_project\_id) | The GCP project id where the Cloud Build trigger will be installed. | `string` | n/a | yes |
| [trigger\_config](#input\_trigger\_config) | The trigger\_config variable defines the type of trigger (GitHub, GSR, etc), and
the specific configuration options needed. The combination of fields is too
complex to validate effectively, use a scenario specific submodule which hides
this complexity! |object({| n/a | yes |
gsr = object({
project_id = string
name = string
branch_regex = string
tag_regex = string
})
github = object({
owner = string
name = string
branch_regex = string
tag_regex = string
is_pr_trigger = bool
comment_control = string
})
pubsub = object({
topic = string
service_account_email = string
})
webhook = object({
secret = string
})
})
| [description](#input\_description) | An optional description to apply to the Cloud Build trigger. | `string` | `""` | no |
| [dir](#input\_dir) | The directory path, relative to repository root, where the Cloud Build run will
be executed. Default is an empty string. | `string` | `""` | no |
| [disabled](#input\_disabled) | A flag to create/modify the Cloud Build trigger into a disabled state. | `bool` | `false` | no |
| [filename](#input\_filename) | The path, relative to repository root, to the Cloud Build YAML file. The default
configuration will declare the filename 'cloudbuild.yml'. | `string` | `"cloudbuild.yml"` | no |
| [ignored\_files](#input\_ignored\_files) | An optional set of file globs to ignore when determining the set of source
changes. If provided, the list of changed files will be filtered through this
list of globs, and the trigger action will proceed only if there are unfiltered
files remaining. Default is an empty list, meaning any changes in repo should
trigger the action, subject to `included_files`. | `list(string)` | `[]` | no |
| [included\_files](#input\_included\_files) | An optional set of file globs to explicitly match when determining the set of
source changes. If provided, the list of changed files will be filtered through this
list of globs, and the trigger action will proceed only if there are positive
matches. Default is an empty list, meaning any changes in repo should
trigger the action, subject to `ignored_files`. | `list(string)` | `[]` | no |
| [invert\_regex](#input\_invert\_regex) | If set, the tag or branch regular expressions used to match GitHub events will
be effectively inverted, and events that *do not match* the tag or branch pattern
will be executed. Default is false. | `bool` | `false` | no |
| [location](#input\_location) | Specifies the location of the Cloud Build pool to use for the triggered workload.
The default value is 'global', but any supported Cloud Build location may be used. | `string` | `"global"` | no |
| [service\_account](#input\_service\_account) | An optional way to override the service account used by Cloud Build. If left
empty (default), the standard Cloud Build service account for project specified
in `project_id` will be used during execution. | `string` | `""` | no |
| [substitutions](#input\_substitutions) | A map of substitution key:value pairs that can be referenced in the build
definition. Default is empty. | `map(string)` | `{}` | no |
| [tags](#input\_tags) | An optional set of tags to annotate the Cloud Build trigger. | `set(string)` | `[]` | no |## Outputs
| Name | Description |
|------|-------------|
| [id](#output\_id) | The fully-qualified identifier of the created Cloud Build trigger. |
| [trigger\_id](#output\_trigger\_id) | The project-local identifier of the created Cloud Build trigger. |