Skip to content

Commit

Permalink
Merge pull request #188 from alexkonkin/bug/project_add_disable_depen…
Browse files Browse the repository at this point in the history
…dent_services

disable_dependent_services argument/variable have been added
  • Loading branch information
aaron-lane authored May 3, 2019
2 parents c212232 + 59993ec commit fc22676
Show file tree
Hide file tree
Showing 13 changed files with 39 additions and 6 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ Extending the adopted spec, each change should have a link to its corresponding
## [Unreleased]

### Added

- The ability to change bucket location. [#170]
- The argument disable_dependent_services and corresponding variable [#188]

## [2.1.3] - 2019-04-03

Expand Down Expand Up @@ -133,6 +133,7 @@ Extending the adopted spec, each change should have a link to its corresponding
[0.2.1]: https://github.com/terraform-google-modules/terraform-google-project-factory/compare/v0.2.0...v0.2.1
[0.2.0]: https://github.com/terraform-google-modules/terraform-google-project-factory/compare/v0.1.0...v0.2.0

[#188]: https://github.com/terraform-google-modules/terraform-google-project-factory/pull/188
[#170]: https://github.com/terraform-google-modules/terraform-google-project-factory/pull/170
[#180]: https://github.com/terraform-google-modules/terraform-google-project-factory/pull/180
[#178]: https://github.com/terraform-google-modules/terraform-google-project-factory/pull/178
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ determining that location is as follows:
| bucket\_name | A name for a GCS bucket to create (in the bucket_project project), useful for Terraform state (optional) | string | `""` | no |
| bucket\_project | A project to create a GCS bucket (bucket_name) in, useful for Terraform state (optional) | string | `""` | no |
| credentials\_path | Path to a service account credentials file with rights to run the Project Factory. If this file is absent Terraform will fall back to Application Default Credentials. | string | `""` | no |
| disable\_dependent\_services | Whether services that are enabled and which depend on this service should also be disabled when this service is destroyed. | string | `"true"` | no |
| disable\_services\_on\_destroy | Whether project services will be disabled when the resources are destroyed | string | `"true"` | no |
| domain | The domain name (optional). | string | `""` | no |
| folder\_id | The ID of a folder to host this project | string | `""` | no |
Expand Down
1 change: 1 addition & 0 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -50,4 +50,5 @@ module "project-factory" {
bucket_name = "${var.bucket_name}"
auto_create_network = "${var.auto_create_network}"
disable_services_on_destroy = "${var.disable_services_on_destroy}"
disable_dependent_services = "${var.disable_dependent_services}"
}
1 change: 1 addition & 0 deletions modules/core_project_factory/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
| bucket\_name | A name for a GCS bucket to create (in the bucket_project project), useful for Terraform state (optional) | string | `""` | no |
| bucket\_project | A project to create a GCS bucket (bucket_name) in, useful for Terraform state (optional) | string | `""` | no |
| credentials\_path | Path to a service account credentials file with rights to run the Project Factory. If this file is absent Terraform will fall back to Application Default Credentials. | string | `""` | no |
| disable\_dependent\_services | Whether services that are enabled and which depend on this service should also be disabled when this service is destroyed. | string | `"true"` | no |
| disable\_services\_on\_destroy | Whether project services will be disabled when the resources are destroyed | string | `"true"` | no |
| folder\_id | The ID of a folder to host this project | string | `""` | no |
| group\_email | The email address of a group to control the project by being assigned group_role. | string | n/a | yes |
Expand Down
3 changes: 2 additions & 1 deletion modules/core_project_factory/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,8 @@ resource "google_project_service" "project_services" {
project = "${google_project.main.project_id}"
service = "${element(var.activate_apis, count.index)}"

disable_on_destroy = "${var.disable_services_on_destroy}"
disable_on_destroy = "${var.disable_services_on_destroy}"
disable_dependent_services = "${var.disable_dependent_services}"

depends_on = ["google_project.main"]
}
Expand Down
6 changes: 6 additions & 0 deletions modules/core_project_factory/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -129,3 +129,9 @@ variable "disable_services_on_destroy" {
default = "true"
type = "string"
}

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."
default = "true"
type = "string"
}
1 change: 1 addition & 0 deletions modules/gsuite_enabled/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ The roles granted are specifically:
| bucket\_project | A project to create a GCS bucket (bucket_name) in, useful for Terraform state (optional) | string | `""` | no |
| create\_group | Whether to create the group or not | string | `"false"` | no |
| credentials\_path | Path to a Service Account credentials file with permissions documented in the readme | 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. | string | `"true"` | no |
| disable\_services\_on\_destroy | Whether project services will be disabled when the resources are destroyed | string | `"true"` | no |
| domain | The domain name (optional). | string | `""` | no |
| folder\_id | The ID of a folder to host this project | string | `""` | no |
Expand Down
1 change: 1 addition & 0 deletions modules/gsuite_enabled/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -87,4 +87,5 @@ module "project-factory" {
bucket_name = "${var.bucket_name}"
auto_create_network = "${var.auto_create_network}"
disable_services_on_destroy = "${var.disable_services_on_destroy}"
disable_dependent_services = "${var.disable_dependent_services}"
}
6 changes: 6 additions & 0 deletions modules/gsuite_enabled/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -139,3 +139,9 @@ variable "disable_services_on_destroy" {
default = "true"
type = "string"
}

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."
default = "true"
type = "string"
}
1 change: 1 addition & 0 deletions modules/project_services/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ See [examples/project_services](./examples/project_services) for an example.
| Name | Description | Type | Default | Required |
|------|-------------|:----:|:-----:|:-----:|
| activate\_apis | The list of apis to activate within the project | list | 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 | string | `"true"` | 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 | string | `"true"` | no |
| enable\_apis | Whether to actually enable the APIs. If false, this module is a no-op. | string | `"true"` | no |
| project\_id | The GCP project you want to enable APIs on | string | n/a | yes |
Expand Down
9 changes: 5 additions & 4 deletions modules/project_services/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,9 @@
APIs configuration
*****************************************/
resource "google_project_service" "project_services" {
count = "${var.enable_apis ? length(var.activate_apis) : 0}"
project = "${var.project_id}"
service = "${element(var.activate_apis, count.index)}"
disable_on_destroy = "${var.disable_services_on_destroy}"
count = "${var.enable_apis ? length(var.activate_apis) : 0}"
project = "${var.project_id}"
service = "${element(var.activate_apis, count.index)}"
disable_on_destroy = "${var.disable_services_on_destroy}"
disable_dependent_services = "${var.disable_dependent_services}"
}
6 changes: 6 additions & 0 deletions modules/project_services/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,9 @@ variable "disable_services_on_destroy" {
default = "true"
type = "string"
}

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 = "true"
type = "string"
}
6 changes: 6 additions & 0 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -125,3 +125,9 @@ variable "disable_services_on_destroy" {
default = "true"
type = "string"
}

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."
default = "true"
type = "string"
}

0 comments on commit fc22676

Please sign in to comment.