-
Notifications
You must be signed in to change notification settings - Fork 8
Fix #14 #15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
austinwiltshire
wants to merge
1
commit into
simplifi:main
Choose a base branch
from
austinwiltshire:fix_14
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Fix #14 #15
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,110 +1 @@ | ||
# terraform-google-cloud-build-slack-notifier | ||
|
||
[](https://www.travis-ci.com/simplifi/terraform-google-cloud-build-slack-notifier) | ||
|
||
A Terraform module to enable Slack notifications for Cloud Build events. | ||
|
||
**Note - This will add the following resources to your project:** | ||
|
||
- Google Cloud Storage Bucket for storing the notifier configuration | ||
- Google Pub/Sub for events emitted from Cloud Build | ||
- Google Cloud Run for processing the events emitted from Cloud Build | ||
|
||
This module is based on the instructions found in GCP's [Configuring Slack notifications](https://cloud.google.com/build/docs/configuring-notifications/configure-slack) guide. | ||
|
||
## Setup | ||
|
||
You will need a Slack app incoming webhook url stored in a Google Secret Manager | ||
secret for this to work. | ||
|
||
- Create a [Slack app](https://api.slack.com/apps?new_app=1) for your desired Slack workspace. | ||
- Activate [incoming webhooks](https://api.slack.com/messaging/webhooks) to post messages from Cloud Build to Slack. | ||
- Create a new secret in Google Secret Manager and store the webhook url in it. | ||
|
||
## Pre-commit Hooks | ||
|
||
[Pre-commit](https://pre-commit.com/) hooks have been configured for this repo. | ||
|
||
The enabled hooks check for a variety of common problems in Terraform code, and | ||
will run any time you commit to your branch. | ||
|
||
Pre-commit (and dependencies) can be installed by following the instructions | ||
found here: | ||
|
||
- [Install `pre-commit`](https://pre-commit.com/#install) | ||
- [Install `terraform-docs`](https://github.com/terraform-docs/terraform-docs#installation) | ||
|
||
To enable the hooks locally, run the following from the root of this repo: | ||
`pre-commit install` | ||
|
||
To uninstall the hooks, run the following from the root of this repo: | ||
`pre-commit uninstall` | ||
|
||
To skip running the hooks when you commit: | ||
`git commit -n` aka `git commit --no-verify` | ||
|
||
**Currently enabled plugins:** | ||
|
||
- [pre-commit-terraform](https://github.com/antonbabenko/pre-commit-terraform) | ||
- `terraform_fmt`: Rewrites all Terraform configuration files to a canonical format | ||
- `terraform_docs`: Inserts input and output documentation into `README.md` | ||
- `terraform_validate`: Validates all Terraform configuration files | ||
- [pre-commit-hooks](https://github.com/pre-commit/pre-commit-hooks) | ||
- `end-of-file-fixer`: Makes sure files end in a newline and only a newline | ||
- `trailing-whitespace`: Trims trailing whitespace | ||
- `check-merge-conflict`: Check for files that contain merge conflict strings | ||
|
||
<!-- BEGINNING OF PRE-COMMIT-TERRAFORM DOCS HOOK --> | ||
## Requirements | ||
|
||
| Name | Version | | ||
|------|---------| | ||
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 0.13 | | ||
| <a name="requirement_google"></a> [google](#requirement\_google) | >= 3.20 | | ||
| <a name="requirement_google-beta"></a> [google-beta](#requirement\_google-beta) | >= 3.30 | | ||
| <a name="requirement_random"></a> [random](#requirement\_random) | >= 2.1 | | ||
|
||
## Modules | ||
|
||
No modules. | ||
|
||
## Resources | ||
|
||
| Name | Type | | ||
|------|------| | ||
| [google-beta_google_cloud_run_service.cloud_build_notifier](https://registry.terraform.io/providers/hashicorp/google-beta/latest/docs/resources/google_cloud_run_service) | resource | | ||
| [google-beta_google_project_service_identity.pubsub](https://registry.terraform.io/providers/hashicorp/google-beta/latest/docs/resources/google_project_service_identity) | resource | | ||
| [google_project_iam_member.notifier_project_roles](https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/project_iam_member) | resource | | ||
| [google_project_iam_member.pubsub_invoker_roles](https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/project_iam_member) | resource | | ||
| [google_project_iam_member.pubsub_project_roles](https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/project_iam_member) | resource | | ||
| [google_project_service.apis](https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/project_service) | resource | | ||
| [google_pubsub_subscription.cloud_builds](https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/pubsub_subscription) | resource | | ||
| [google_pubsub_topic.cloud_builds](https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/pubsub_topic) | resource | | ||
| [google_secret_manager_secret_iam_member.notifier_secret_accessor](https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/secret_manager_secret_iam_member) | resource | | ||
| [google_service_account.notifier](https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/service_account) | resource | | ||
| [google_service_account.pubsub_invoker](https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/service_account) | resource | | ||
| [google_storage_bucket.cloud_build_notifier](https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/storage_bucket) | resource | | ||
| [google_storage_bucket_object.cloud_build_notifier_config](https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/storage_bucket_object) | resource | | ||
| [google_storage_bucket_object.slack_template](https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/storage_bucket_object) | resource | | ||
| [random_id.cloud_build_notifier](https://registry.terraform.io/providers/hashicorp/random/latest/docs/resources/id) | resource | | ||
| [random_id.cloud_build_notifier_service](https://registry.terraform.io/providers/hashicorp/random/latest/docs/resources/id) | resource | | ||
| [google_secret_manager_secret_version.slack_webhook_url](https://registry.terraform.io/providers/hashicorp/google/latest/docs/data-sources/secret_manager_secret_version) | data source | | ||
|
||
## Inputs | ||
|
||
| Name | Description | Type | Default | | ||
|------|-------------|------|---------| | ||
| <a name="input_cloud_build_event_filter"></a> [cloud\_build\_event\_filter](#input\_cloud\_build\_event\_filter) | The CEL filter to apply to incoming Cloud Build events. | `string` | `"build.substitutions['BRANCH_NAME'] == 'main' && build.status in [Build.Status.SUCCESS, Build.Status.FAILURE, Build.Status.TIMEOUT]"` | | ||
| <a name="input_cloud_build_notifier_image"></a> [cloud\_build\_notifier\_image](#input\_cloud\_build\_notifier\_image) | The image to use for the notifier. | `string` | `"us-east1-docker.pkg.dev/gcb-release/cloud-build-notifiers/slack:latest"` | | ||
| <a name="input_disable_services_on_destroy"></a> [disable\_services\_on\_destroy](#input\_disable\_services\_on\_destroy) | If true, the service APIs used will be disabled on destroy. | `bool` | `false` | | ||
| <a name="input_name"></a> [name](#input\_name) | The name to use on all resources created. | `string` | n/a | | ||
| <a name="input_override_slack_template_json"></a> [override\_slack\_template\_json](#input\_override\_slack\_template\_json) | Custom template to use for the Slack notifications, which overrides the default. | `string` | `""` | | ||
| <a name="input_project_id"></a> [project\_id](#input\_project\_id) | Project ID of the project in which Cloud Build is running. | `string` | n/a | | ||
| <a name="input_region"></a> [region](#input\_region) | The region in which to deploy the notifier service. | `string` | `"us-central1"` | | ||
| <a name="input_slack_webhook_url_secret_id"></a> [slack\_webhook\_url\_secret\_id](#input\_slack\_webhook\_url\_secret\_id) | The ID of an existing Google Secret Manager secret, containing a Slack webhook URL. This is usually the `id` from the output of a `google_secret_manager_secret` resource. | `string` | n/a | | ||
| <a name="input_slack_webhook_url_secret_project"></a> [slack\_webhook\_url\_secret\_project](#input\_slack\_webhook\_url\_secret\_project) | The project ID containing the slack\_webhook\_url\_secret\_id. | `string` | n/a | | ||
|
||
## Outputs | ||
|
||
No outputs. | ||
<!-- END OF PRE-COMMIT-TERRAFORM DOCS HOOK --> | ||
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. | ||
This file was deleted.
Oops, something went wrong.
Empty file.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The README.md has been replaced with Lorem ipsum placeholder text, removing all useful project documentation including setup instructions, usage examples, and module documentation.
Module Documentation
Contributing
Contributions are welcome! Please follow the contribution guidelines.
License
This project is licensed under the MIT License. See the LICENSE file for details.
Copilot uses AI. Check for mistakes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think copilot is using the latest models which is why it gets this totally wrong.