Skip to content

Commit

Permalink
Expose disable_on_destroy for service APIs used by module (#10)
Browse files Browse the repository at this point in the history
* Expose disable_on_destroy for service APIs used by module

* Update README

* Default to false for disable_services

* Update README

* Update README again
  • Loading branch information
cjonesy authored Apr 22, 2024
1 parent 41ee3d8 commit 8cdd640
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ No modules.
|------|-------------|------|---------|
| <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 |
Expand Down
8 changes: 4 additions & 4 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ resource "google_project_service" "apis" {
# Cloud Run is used to run the notifier
"run.googleapis.com",
])
project = var.project_id
service = each.key

disable_dependent_services = true
project = var.project_id
service = each.key
disable_on_destroy = var.disable_services_on_destroy
disable_dependent_services = var.disable_services_on_destroy
}

# ------------------------------------------------------------------------------
Expand Down
6 changes: 6 additions & 0 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -49,3 +49,9 @@ variable "override_slack_template_json" {
type = string
default = ""
}

variable "disable_services_on_destroy" {
description = "If true, the service APIs used will be disabled on destroy."
type = bool
default = false
}

0 comments on commit 8cdd640

Please sign in to comment.