Skip to content

Commit

Permalink
feat: Add option for skipping the gcloud CLI download (#393)
Browse files Browse the repository at this point in the history
Co-authored-by: Josef Reinhard Brandl <josef.brandl@senacor.com>
  • Loading branch information
MajorBreakfast and MajorBreakfast committed Mar 17, 2020
1 parent d3bd3ee commit a534603
Show file tree
Hide file tree
Showing 11 changed files with 37 additions and 0 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ Extending the adopted spec, each change should have a link to its corresponding

## [Unreleased]

- Added `skip_gcloud_download` option which can be used to skip downloading the gcloud CLI if it is already installed

## [7.0.0] - 2020-01-15

### Fixed
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@ determining that location is as follows:
| sa\_role | A role to give the default Service Account for the project (defaults to none) | string | `""` | no |
| shared\_vpc | The ID of the host project which hosts the shared VPC | string | `""` | no |
| shared\_vpc\_subnets | List of subnets fully qualified subnet IDs (ie. projects/$project_id/regions/$region/subnetworks/$subnet_id) | list(string) | `<list>` | no |
| skip\_gcloud\_download | Whether to skip downloading gcloud (assumes gcloud is already available outside the module) | bool | `"false"` | no |
| usage\_bucket\_name | Name of a GCS bucket to store GCE usage reports in (optional) | string | `""` | no |
| usage\_bucket\_prefix | Prefix in the GCS bucket to store GCE usage reports in (optional) | string | `""` | no |
| use\_tf\_google\_credentials\_env\_var | Use GOOGLE_CREDENTIALS environment variable to run gcloud auth activate-service-account with. | bool | `"false"` | no |
Expand Down
1 change: 1 addition & 0 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ module "project-factory" {
python_interpreter_path = var.python_interpreter_path
pip_executable_path = var.pip_executable_path
use_tf_google_credentials_env_var = var.use_tf_google_credentials_env_var
skip_gcloud_download = var.skip_gcloud_download
}

/******************************************
Expand Down
6 changes: 6 additions & 0 deletions modules/core_project_factory/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,8 @@ module "gcloud_delete" {
enabled = var.default_service_account == "delete"
use_tf_google_credentials_env_var = var.use_tf_google_credentials_env_var

skip_download = var.skip_gcloud_download

create_cmd_entrypoint = "${path.module}/scripts/modify-service-account.sh"
create_cmd_body = <<-EOT
--project_id='${google_project.main.project_id}' \
Expand All @@ -189,6 +191,8 @@ module "gcloud_deprivilege" {
enabled = var.default_service_account == "deprivilege"
use_tf_google_credentials_env_var = var.use_tf_google_credentials_env_var

skip_download = var.skip_gcloud_download

create_cmd_entrypoint = "${path.module}/scripts/modify-service-account.sh"
create_cmd_body = <<-EOT
--project_id='${google_project.main.project_id}' \
Expand All @@ -215,6 +219,8 @@ module "gcloud_disable" {
enabled = var.default_service_account == "disable"
use_tf_google_credentials_env_var = var.use_tf_google_credentials_env_var

skip_download = var.skip_gcloud_download

create_cmd_entrypoint = "${path.module}/scripts/modify-service-account.sh"
create_cmd_body = <<-EOT
--project_id='${google_project.main.project_id}' \
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 @@ -189,3 +189,9 @@ variable "use_tf_google_credentials_env_var" {
type = bool
default = false
}

variable "skip_gcloud_download" {
description = "Whether to skip downloading gcloud (assumes gcloud is already available outside the module)"
type = bool
default = false
}
1 change: 1 addition & 0 deletions modules/gsuite_enabled/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ The roles granted are specifically:
| shared\_vpc | The ID of the host project which hosts the shared VPC | string | `""` | no |
| shared\_vpc\_enabled | If shared VPC should be used | bool | `"false"` | no |
| shared\_vpc\_subnets | List of subnets fully qualified subnet IDs (ie. projects/$project_id/regions/$region/subnetworks/$subnet_id) | list(string) | `<list>` | no |
| skip\_gcloud\_download | Whether to skip downloading gcloud (assumes gcloud is already available outside the module) | bool | `"false"` | no |
| usage\_bucket\_name | Name of a GCS bucket to store GCE usage reports in (optional) | string | `""` | no |
| usage\_bucket\_prefix | Prefix in the GCS bucket to store GCE usage reports in (optional) | string | `""` | no |
| use\_tf\_google\_credentials\_env\_var | Use GOOGLE_CREDENTIALS environment variable to run gcloud auth activate-service-account with. | bool | `"false"` | 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 @@ -99,6 +99,7 @@ module "project-factory" {
disable_dependent_services = var.disable_dependent_services
python_interpreter_path = var.python_interpreter_path
use_tf_google_credentials_env_var = var.use_tf_google_credentials_env_var
skip_gcloud_download = var.skip_gcloud_download
}

/******************************************
Expand Down
6 changes: 6 additions & 0 deletions modules/gsuite_enabled/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -200,3 +200,9 @@ variable "use_tf_google_credentials_env_var" {
type = bool
default = false
}

variable "skip_gcloud_download" {
description = "Whether to skip downloading gcloud (assumes gcloud is already available outside the module)"
type = bool
default = false
}
1 change: 1 addition & 0 deletions modules/shared_vpc/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ module "project-factory" {
disable_dependent_services = var.disable_dependent_services
python_interpreter_path = var.python_interpreter_path
use_tf_google_credentials_env_var = var.use_tf_google_credentials_env_var
skip_gcloud_download = var.skip_gcloud_download
}

/******************************************
Expand Down
6 changes: 6 additions & 0 deletions modules/shared_vpc/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -194,3 +194,9 @@ variable "use_tf_google_credentials_env_var" {
type = bool
default = false
}

variable "skip_gcloud_download" {
description = "Whether to skip downloading gcloud (assumes gcloud is already available outside the module)"
type = bool
default = false
}
6 changes: 6 additions & 0 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -202,3 +202,9 @@ variable "budget_alert_spent_percents" {
type = list(number)
default = [0.5, 0.7, 1.0]
}

variable "skip_gcloud_download" {
description = "Whether to skip downloading gcloud (assumes gcloud is already available outside the module)"
type = bool
default = false
}

0 comments on commit a534603

Please sign in to comment.