From e3e5458106bce5e3cc9995c2bc630f476439f71a Mon Sep 17 00:00:00 2001 From: Imran Nayer Date: Mon, 6 Jul 2020 17:02:54 -0500 Subject: [PATCH] feat: Added variable for service dependency in binary_authorization sub module (#584) --- modules/binary-authorization/README.md | 2 ++ modules/binary-authorization/main.tf | 6 ++++-- modules/binary-authorization/variables.tf | 12 ++++++++++++ 3 files changed, 18 insertions(+), 2 deletions(-) diff --git a/modules/binary-authorization/README.md b/modules/binary-authorization/README.md index 9c3f6b7fa..b458e8b9a 100644 --- a/modules/binary-authorization/README.md +++ b/modules/binary-authorization/README.md @@ -35,6 +35,8 @@ module "quality-attestor" { | Name | Description | Type | Default | Required | |------|-------------|:----:|:-----:|:-----:| | attestor-name | Name of the attestor | string | n/a | yes | +| disable\_dependent\_services | Whether services that are enabled and which depend on this service should also be disabled when this service is destroyed. https://www.terraform.io/docs/providers/google/r/google_project_service.html#disable_dependent_services | bool | `"false"` | no | +| disable\_services\_on\_destroy | Whether project services will be disabled when the resources are destroyed. https://www.terraform.io/docs/providers/google/r/google_project_service.html#disable_on_destroy | bool | `"false"` | no | | project\_id | Project ID to apply services into | string | n/a | yes | ## Outputs diff --git a/modules/binary-authorization/main.tf b/modules/binary-authorization/main.tf index 29ccb2178..4c3693d04 100644 --- a/modules/binary-authorization/main.tf +++ b/modules/binary-authorization/main.tf @@ -27,9 +27,11 @@ module "project-services" { source = "terraform-google-modules/project-factory/google//modules/project_services" version = "~> 8.0" - project_id = var.project_id - + project_id = var.project_id activate_apis = local.required_enabled_apis + + disable_services_on_destroy = var.disable_services_on_destroy + disable_dependent_services = var.disable_dependent_services } resource "google_binary_authorization_attestor" "attestor" { diff --git a/modules/binary-authorization/variables.tf b/modules/binary-authorization/variables.tf index 1b8578077..1e7994b12 100644 --- a/modules/binary-authorization/variables.tf +++ b/modules/binary-authorization/variables.tf @@ -34,3 +34,15 @@ variable crypto-algorithm { default = "RSA_SIGN_PKCS1_4096_SHA512" description = "Algorithm used for the async signing keys" } + +variable "disable_services_on_destroy" { + description = "Whether project services will be disabled when the resources are destroyed. https://www.terraform.io/docs/providers/google/r/google_project_service.html#disable_on_destroy" + default = false + type = bool +} + +variable "disable_dependent_services" { + description = "Whether services that are enabled and which depend on this service should also be disabled when this service is destroyed. https://www.terraform.io/docs/providers/google/r/google_project_service.html#disable_dependent_services" + default = false + type = bool +}